diff --git a/Makefile b/Makefile index 3c96a8b5..ca1d0bda 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ VERSION_FILE=version PACKAGE_VERSION := $(shell cat ${VERSION_FILE}) SPEC_PATCHED_FILE=./metal_openapi.fixed.yaml -OPENAPI_CODEGEN_TAG=v7.0.0 +OPENAPI_CODEGEN_TAG=v7.4.0 OPENAPI_CODEGEN_IMAGE=openapitools/openapi-generator-cli:${OPENAPI_CODEGEN_TAG} CURRENT_UID := $(shell id -u) CURRENT_GID := $(shell id -g) diff --git a/equinix_metal/.openapi-generator/VERSION b/equinix_metal/.openapi-generator/VERSION index 41225218..ba7f754d 100644 --- a/equinix_metal/.openapi-generator/VERSION +++ b/equinix_metal/.openapi-generator/VERSION @@ -1 +1 @@ -7.0.0 \ No newline at end of file +7.4.0 diff --git a/equinix_metal/README.md b/equinix_metal/README.md index fdb39fef..f0cde588 100644 --- a/equinix_metal/README.md +++ b/equinix_metal/README.md @@ -86,6 +86,7 @@ This Python package is automatically generated by the [OpenAPI Generator](https: - API version: 1.0.0 - Package version: 0.8.0 +- Generator version: 7.4.0 - Build package: org.openapitools.codegen.languages.PythonClientCodegen ## Requirements. @@ -131,7 +132,6 @@ Please follow the [installation procedure](#installation--usage) and then run th ```python -import time import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint diff --git a/equinix_metal/docs/AWSFabricProvider.md b/equinix_metal/docs/AWSFabricProvider.md index 514a3304..10f1e306 100644 --- a/equinix_metal/docs/AWSFabricProvider.md +++ b/equinix_metal/docs/AWSFabricProvider.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **account_id** | **str** | AWS Account ID | @@ -19,7 +20,7 @@ json = "{}" # create an instance of AWSFabricProvider from a JSON string aws_fabric_provider_instance = AWSFabricProvider.from_json(json) # print the JSON string representation of the object -print AWSFabricProvider.to_json() +print(AWSFabricProvider.to_json()) # convert the object into a dict aws_fabric_provider_dict = aws_fabric_provider_instance.to_dict() diff --git a/equinix_metal/docs/ActivateHardwareReservationRequest.md b/equinix_metal/docs/ActivateHardwareReservationRequest.md index 63c89e8d..64b6cfb1 100644 --- a/equinix_metal/docs/ActivateHardwareReservationRequest.md +++ b/equinix_metal/docs/ActivateHardwareReservationRequest.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **description** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of ActivateHardwareReservationRequest from a JSON string activate_hardware_reservation_request_instance = ActivateHardwareReservationRequest.from_json(json) # print the JSON string representation of the object -print ActivateHardwareReservationRequest.to_json() +print(ActivateHardwareReservationRequest.to_json()) # convert the object into a dict activate_hardware_reservation_request_dict = activate_hardware_reservation_request_instance.to_dict() diff --git a/equinix_metal/docs/Address.md b/equinix_metal/docs/Address.md index 3c67a5c6..437380c9 100644 --- a/equinix_metal/docs/Address.md +++ b/equinix_metal/docs/Address.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **address** | **str** | | [optional] @@ -23,7 +24,7 @@ json = "{}" # create an instance of Address from a JSON string address_instance = Address.from_json(json) # print the JSON string representation of the object -print Address.to_json() +print(Address.to_json()) # convert the object into a dict address_dict = address_instance.to_dict() diff --git a/equinix_metal/docs/Attribute.md b/equinix_metal/docs/Attribute.md index 6c1483db..87443fb0 100644 --- a/equinix_metal/docs/Attribute.md +++ b/equinix_metal/docs/Attribute.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **created_at** | **datetime** | Datetime when the block was created. | [optional] [readonly] @@ -20,7 +21,7 @@ json = "{}" # create an instance of Attribute from a JSON string attribute_instance = Attribute.from_json(json) # print the JSON string representation of the object -print Attribute.to_json() +print(Attribute.to_json()) # convert the object into a dict attribute_dict = attribute_instance.to_dict() diff --git a/equinix_metal/docs/AttributeData.md b/equinix_metal/docs/AttributeData.md index 4cf08db7..7795d563 100644 --- a/equinix_metal/docs/AttributeData.md +++ b/equinix_metal/docs/AttributeData.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -20,7 +21,7 @@ json = "{}" # create an instance of AttributeData from a JSON string attribute_data_instance = AttributeData.from_json(json) # print the JSON string representation of the object -print AttributeData.to_json() +print(AttributeData.to_json()) # convert the object into a dict attribute_data_dict = attribute_data_instance.to_dict() diff --git a/equinix_metal/docs/AuthToken.md b/equinix_metal/docs/AuthToken.md index 89ef527d..1943fdf6 100644 --- a/equinix_metal/docs/AuthToken.md +++ b/equinix_metal/docs/AuthToken.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **created_at** | **datetime** | | [optional] @@ -24,7 +25,7 @@ json = "{}" # create an instance of AuthToken from a JSON string auth_token_instance = AuthToken.from_json(json) # print the JSON string representation of the object -print AuthToken.to_json() +print(AuthToken.to_json()) # convert the object into a dict auth_token_dict = auth_token_instance.to_dict() diff --git a/equinix_metal/docs/AuthTokenInput.md b/equinix_metal/docs/AuthTokenInput.md index 257b2154..62616dbd 100644 --- a/equinix_metal/docs/AuthTokenInput.md +++ b/equinix_metal/docs/AuthTokenInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **description** | **str** | | [optional] @@ -18,7 +19,7 @@ json = "{}" # create an instance of AuthTokenInput from a JSON string auth_token_input_instance = AuthTokenInput.from_json(json) # print the JSON string representation of the object -print AuthTokenInput.to_json() +print(AuthTokenInput.to_json()) # convert the object into a dict auth_token_input_dict = auth_token_input_instance.to_dict() diff --git a/equinix_metal/docs/AuthTokenList.md b/equinix_metal/docs/AuthTokenList.md index 35645697..10391fbd 100644 --- a/equinix_metal/docs/AuthTokenList.md +++ b/equinix_metal/docs/AuthTokenList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **api_keys** | [**List[AuthToken]**](AuthToken.md) | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of AuthTokenList from a JSON string auth_token_list_instance = AuthTokenList.from_json(json) # print the JSON string representation of the object -print AuthTokenList.to_json() +print(AuthTokenList.to_json()) # convert the object into a dict auth_token_list_dict = auth_token_list_instance.to_dict() diff --git a/equinix_metal/docs/AuthTokenProject.md b/equinix_metal/docs/AuthTokenProject.md index 2fdd0453..5d6aeead 100644 --- a/equinix_metal/docs/AuthTokenProject.md +++ b/equinix_metal/docs/AuthTokenProject.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **backend_transfer_enabled** | **bool** | | [optional] @@ -35,7 +36,7 @@ json = "{}" # create an instance of AuthTokenProject from a JSON string auth_token_project_instance = AuthTokenProject.from_json(json) # print the JSON string representation of the object -print AuthTokenProject.to_json() +print(AuthTokenProject.to_json()) # convert the object into a dict auth_token_project_dict = auth_token_project_instance.to_dict() diff --git a/equinix_metal/docs/AuthTokenUser.md b/equinix_metal/docs/AuthTokenUser.md index 147b6229..d220f479 100644 --- a/equinix_metal/docs/AuthTokenUser.md +++ b/equinix_metal/docs/AuthTokenUser.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **avatar_thumb_url** | **str** | | [optional] @@ -37,7 +38,7 @@ json = "{}" # create an instance of AuthTokenUser from a JSON string auth_token_user_instance = AuthTokenUser.from_json(json) # print the JSON string representation of the object -print AuthTokenUser.to_json() +print(AuthTokenUser.to_json()) # convert the object into a dict auth_token_user_dict = auth_token_user_instance.to_dict() diff --git a/equinix_metal/docs/AuthenticationApi.md b/equinix_metal/docs/AuthenticationApi.md index 8cfeb790..d6b183b8 100644 --- a/equinix_metal/docs/AuthenticationApi.md +++ b/equinix_metal/docs/AuthenticationApi.md @@ -22,9 +22,8 @@ Creates a API key for the current user. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.auth_token import AuthToken from equinix_metal.models.auth_token_input import AuthTokenInput @@ -68,6 +67,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **auth_token_input** | [**AuthTokenInput**](AuthTokenInput.md)| API key to create | @@ -87,6 +87,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | created | - | @@ -95,7 +96,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **create_project_api_key** > AuthToken create_project_api_key(id, auth_token_input, include=include) @@ -106,9 +106,8 @@ Creates an API key for a project. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.auth_token import AuthToken from equinix_metal.models.auth_token_input import AuthTokenInput @@ -153,6 +152,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Project UUID | @@ -173,6 +173,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | created | - | @@ -181,7 +182,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **delete_api_key** > delete_api_key(id) @@ -192,9 +192,8 @@ Deletes the API key. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -233,6 +232,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| API Key UUID | @@ -251,6 +251,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **204** | no content | - | @@ -258,7 +259,6 @@ void (empty response body) **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **delete_user_api_key** > delete_user_api_key(id) @@ -269,9 +269,8 @@ Deletes the current user API key. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -310,6 +309,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| API Key UUID | @@ -328,6 +328,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **204** | no content | - | @@ -335,7 +336,6 @@ void (empty response body) **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_api_keys** > AuthTokenList find_api_keys(search=search, include=include) @@ -346,9 +346,8 @@ Returns all API keys for the current user. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.auth_token_list import AuthTokenList from equinix_metal.rest import ApiException @@ -391,6 +390,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **search** | **str**| Search by description | [optional] @@ -410,6 +410,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -417,7 +418,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_project_api_keys** > AuthTokenList find_project_api_keys(id, include=include) @@ -428,9 +428,8 @@ Returns all API keys for a specific project. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.auth_token_list import AuthTokenList from equinix_metal.rest import ApiException @@ -473,6 +472,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Project UUID | @@ -492,6 +492,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -499,4 +500,3 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/BGPApi.md b/equinix_metal/docs/BGPApi.md index 01f3f9ab..dbdbda7d 100644 --- a/equinix_metal/docs/BGPApi.md +++ b/equinix_metal/docs/BGPApi.md @@ -23,9 +23,8 @@ Deletes the BGP session. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -64,6 +63,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| BGP session UUID | @@ -82,6 +82,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **204** | no content | - | @@ -90,7 +91,6 @@ void (empty response body) **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_bgp_config_by_project** > BgpConfig find_bgp_config_by_project(id, include=include) @@ -101,9 +101,8 @@ Returns a bgp config ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.bgp_config import BgpConfig from equinix_metal.rest import ApiException @@ -146,6 +145,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Project UUID | @@ -165,6 +165,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok When BGP configuration is not enabled empty structure is returned. When BGP configuration is disabled after being enabled BGP configuration data is returned with status disabled. | - | @@ -173,7 +174,6 @@ Name | Type | Description | Notes **404** | not found The project was not found. | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_bgp_session_by_id** > BgpSession find_bgp_session_by_id(id, include=include) @@ -184,9 +184,8 @@ Returns a BGP session ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.bgp_session import BgpSession from equinix_metal.rest import ApiException @@ -229,6 +228,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| BGP session UUID | @@ -248,6 +248,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -256,7 +257,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_global_bgp_ranges** > GlobalBgpRangeList find_global_bgp_ranges(id) @@ -267,9 +267,8 @@ Returns all global bgp ranges for a project ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.global_bgp_range_list import GlobalBgpRangeList from equinix_metal.rest import ApiException @@ -311,6 +310,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Project UUID | @@ -329,6 +329,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -337,7 +338,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_project_bgp_sessions** > BgpSessionList find_project_bgp_sessions(id) @@ -348,9 +348,8 @@ Provides a listing of available BGP sessions for the project. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.bgp_session_list import BgpSessionList from equinix_metal.rest import ApiException @@ -392,6 +391,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Project UUID | @@ -410,6 +410,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -417,7 +418,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **request_bgp_config** > request_bgp_config(id, bgp_config_request_input, include=include) @@ -428,9 +428,8 @@ Requests to enable bgp configuration for a project. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.bgp_config_request_input import BgpConfigRequestInput from equinix_metal.rest import ApiException @@ -472,6 +471,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Project UUID | @@ -492,6 +492,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **204** | no content | - | @@ -501,7 +502,6 @@ void (empty response body) **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **update_bgp_session** > update_bgp_session(id, body) @@ -512,9 +512,8 @@ Updates the BGP session by either enabling or disabling the default route functi ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -554,6 +553,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| BGP session UUID | @@ -573,6 +573,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -582,4 +583,3 @@ void (empty response body) **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/BGPSessionInput.md b/equinix_metal/docs/BGPSessionInput.md index 8b977d39..3ce82e9b 100644 --- a/equinix_metal/docs/BGPSessionInput.md +++ b/equinix_metal/docs/BGPSessionInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **address_family** | **str** | Address family for BGP session. | [optional] @@ -18,7 +19,7 @@ json = "{}" # create an instance of BGPSessionInput from a JSON string bgp_session_input_instance = BGPSessionInput.from_json(json) # print the JSON string representation of the object -print BGPSessionInput.to_json() +print(BGPSessionInput.to_json()) # convert the object into a dict bgp_session_input_dict = bgp_session_input_instance.to_dict() diff --git a/equinix_metal/docs/Batch.md b/equinix_metal/docs/Batch.md index 53bda501..f607fe5a 100644 --- a/equinix_metal/docs/Batch.md +++ b/equinix_metal/docs/Batch.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **created_at** | **datetime** | | [optional] @@ -24,7 +25,7 @@ json = "{}" # create an instance of Batch from a JSON string batch_instance = Batch.from_json(json) # print the JSON string representation of the object -print Batch.to_json() +print(Batch.to_json()) # convert the object into a dict batch_dict = batch_instance.to_dict() diff --git a/equinix_metal/docs/BatchesApi.md b/equinix_metal/docs/BatchesApi.md index 5c30dbba..06c621dc 100644 --- a/equinix_metal/docs/BatchesApi.md +++ b/equinix_metal/docs/BatchesApi.md @@ -20,9 +20,8 @@ Creates new devices in batch and provisions them in our datacenter. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.batches_list import BatchesList from equinix_metal.models.instances_batch_create_input import InstancesBatchCreateInput @@ -66,6 +65,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Project UUID | @@ -85,6 +85,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | created | - | @@ -94,7 +95,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **delete_batch** > delete_batch(id, remove_associated_instances=remove_associated_instances) @@ -105,9 +105,8 @@ Deletes the Batch. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -147,6 +146,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Batch UUID | @@ -166,6 +166,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **204** | no content | - | @@ -173,7 +174,6 @@ void (empty response body) **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_batch_by_id** > Batch find_batch_by_id(id, include=include) @@ -184,9 +184,8 @@ Returns a Batch ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.batch import Batch from equinix_metal.rest import ApiException @@ -229,6 +228,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Batch UUID | @@ -248,6 +248,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -255,7 +256,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_batches_by_project** > BatchesList find_batches_by_project(id, include=include) @@ -266,9 +266,8 @@ Returns all batches for the given project ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.batches_list import BatchesList from equinix_metal.rest import ApiException @@ -311,6 +310,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Project UUID | @@ -330,6 +330,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -338,4 +339,3 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/BatchesList.md b/equinix_metal/docs/BatchesList.md index 1ece9cc9..a29c5717 100644 --- a/equinix_metal/docs/BatchesList.md +++ b/equinix_metal/docs/BatchesList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **batches** | [**List[Batch]**](Batch.md) | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of BatchesList from a JSON string batches_list_instance = BatchesList.from_json(json) # print the JSON string representation of the object -print BatchesList.to_json() +print(BatchesList.to_json()) # convert the object into a dict batches_list_dict = batches_list_instance.to_dict() diff --git a/equinix_metal/docs/BgpConfig.md b/equinix_metal/docs/BgpConfig.md index 2c23a135..84719ddc 100644 --- a/equinix_metal/docs/BgpConfig.md +++ b/equinix_metal/docs/BgpConfig.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **asn** | **int** | Autonomous System Number. ASN is required with Global BGP. With Local BGP the private ASN, 65000, is assigned. | [optional] @@ -28,7 +29,7 @@ json = "{}" # create an instance of BgpConfig from a JSON string bgp_config_instance = BgpConfig.from_json(json) # print the JSON string representation of the object -print BgpConfig.to_json() +print(BgpConfig.to_json()) # convert the object into a dict bgp_config_dict = bgp_config_instance.to_dict() diff --git a/equinix_metal/docs/BgpConfigRequestInput.md b/equinix_metal/docs/BgpConfigRequestInput.md index 16301236..d87996cf 100644 --- a/equinix_metal/docs/BgpConfigRequestInput.md +++ b/equinix_metal/docs/BgpConfigRequestInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **asn** | **int** | Autonomous System Number for local BGP deployment. | @@ -20,7 +21,7 @@ json = "{}" # create an instance of BgpConfigRequestInput from a JSON string bgp_config_request_input_instance = BgpConfigRequestInput.from_json(json) # print the JSON string representation of the object -print BgpConfigRequestInput.to_json() +print(BgpConfigRequestInput.to_json()) # convert the object into a dict bgp_config_request_input_dict = bgp_config_request_input_instance.to_dict() diff --git a/equinix_metal/docs/BgpDynamicNeighbor.md b/equinix_metal/docs/BgpDynamicNeighbor.md index 1c418919..41f03e50 100644 --- a/equinix_metal/docs/BgpDynamicNeighbor.md +++ b/equinix_metal/docs/BgpDynamicNeighbor.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **bgp_neighbor_asn** | **int** | The ASN of the dynamic BGP neighbor | [optional] @@ -25,7 +26,7 @@ json = "{}" # create an instance of BgpDynamicNeighbor from a JSON string bgp_dynamic_neighbor_instance = BgpDynamicNeighbor.from_json(json) # print the JSON string representation of the object -print BgpDynamicNeighbor.to_json() +print(BgpDynamicNeighbor.to_json()) # convert the object into a dict bgp_dynamic_neighbor_dict = bgp_dynamic_neighbor_instance.to_dict() diff --git a/equinix_metal/docs/BgpDynamicNeighborCreateInput.md b/equinix_metal/docs/BgpDynamicNeighborCreateInput.md index d451c3d0..5d332177 100644 --- a/equinix_metal/docs/BgpDynamicNeighborCreateInput.md +++ b/equinix_metal/docs/BgpDynamicNeighborCreateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **bgp_neighbor_asn** | **int** | The ASN of the dynamic BGP neighbor | @@ -19,7 +20,7 @@ json = "{}" # create an instance of BgpDynamicNeighborCreateInput from a JSON string bgp_dynamic_neighbor_create_input_instance = BgpDynamicNeighborCreateInput.from_json(json) # print the JSON string representation of the object -print BgpDynamicNeighborCreateInput.to_json() +print(BgpDynamicNeighborCreateInput.to_json()) # convert the object into a dict bgp_dynamic_neighbor_create_input_dict = bgp_dynamic_neighbor_create_input_instance.to_dict() diff --git a/equinix_metal/docs/BgpDynamicNeighborList.md b/equinix_metal/docs/BgpDynamicNeighborList.md index 382531a5..b03bc486 100644 --- a/equinix_metal/docs/BgpDynamicNeighborList.md +++ b/equinix_metal/docs/BgpDynamicNeighborList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **bgp_dynamic_neighbors** | [**List[BgpDynamicNeighbor]**](BgpDynamicNeighbor.md) | | [optional] @@ -18,7 +19,7 @@ json = "{}" # create an instance of BgpDynamicNeighborList from a JSON string bgp_dynamic_neighbor_list_instance = BgpDynamicNeighborList.from_json(json) # print the JSON string representation of the object -print BgpDynamicNeighborList.to_json() +print(BgpDynamicNeighborList.to_json()) # convert the object into a dict bgp_dynamic_neighbor_list_dict = bgp_dynamic_neighbor_list_instance.to_dict() diff --git a/equinix_metal/docs/BgpNeighborData.md b/equinix_metal/docs/BgpNeighborData.md index 8e33166c..2a966f5e 100644 --- a/equinix_metal/docs/BgpNeighborData.md +++ b/equinix_metal/docs/BgpNeighborData.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **address_family** | **int** | Address Family for IP Address. Accepted values are 4 or 6 | [optional] @@ -26,7 +27,7 @@ json = "{}" # create an instance of BgpNeighborData from a JSON string bgp_neighbor_data_instance = BgpNeighborData.from_json(json) # print the JSON string representation of the object -print BgpNeighborData.to_json() +print(BgpNeighborData.to_json()) # convert the object into a dict bgp_neighbor_data_dict = bgp_neighbor_data_instance.to_dict() diff --git a/equinix_metal/docs/BgpRoute.md b/equinix_metal/docs/BgpRoute.md index e08ad749..dc51e78c 100644 --- a/equinix_metal/docs/BgpRoute.md +++ b/equinix_metal/docs/BgpRoute.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **exact** | **bool** | | [optional] @@ -18,7 +19,7 @@ json = "{}" # create an instance of BgpRoute from a JSON string bgp_route_instance = BgpRoute.from_json(json) # print the JSON string representation of the object -print BgpRoute.to_json() +print(BgpRoute.to_json()) # convert the object into a dict bgp_route_dict = bgp_route_instance.to_dict() diff --git a/equinix_metal/docs/BgpSession.md b/equinix_metal/docs/BgpSession.md index 0cd57b64..93678b83 100644 --- a/equinix_metal/docs/BgpSession.md +++ b/equinix_metal/docs/BgpSession.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **address_family** | **str** | | @@ -24,7 +25,7 @@ json = "{}" # create an instance of BgpSession from a JSON string bgp_session_instance = BgpSession.from_json(json) # print the JSON string representation of the object -print BgpSession.to_json() +print(BgpSession.to_json()) # convert the object into a dict bgp_session_dict = bgp_session_instance.to_dict() diff --git a/equinix_metal/docs/BgpSessionList.md b/equinix_metal/docs/BgpSessionList.md index 4f835ab4..5726783d 100644 --- a/equinix_metal/docs/BgpSessionList.md +++ b/equinix_metal/docs/BgpSessionList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **bgp_sessions** | [**List[BgpSession]**](BgpSession.md) | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of BgpSessionList from a JSON string bgp_session_list_instance = BgpSessionList.from_json(json) # print the JSON string representation of the object -print BgpSessionList.to_json() +print(BgpSessionList.to_json()) # convert the object into a dict bgp_session_list_dict = bgp_session_list_instance.to_dict() diff --git a/equinix_metal/docs/BgpSessionNeighbors.md b/equinix_metal/docs/BgpSessionNeighbors.md index b3ed7a1a..5a380c98 100644 --- a/equinix_metal/docs/BgpSessionNeighbors.md +++ b/equinix_metal/docs/BgpSessionNeighbors.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **bgp_neighbors** | [**List[BgpNeighborData]**](BgpNeighborData.md) | A list of BGP session neighbor data | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of BgpSessionNeighbors from a JSON string bgp_session_neighbors_instance = BgpSessionNeighbors.from_json(json) # print the JSON string representation of the object -print BgpSessionNeighbors.to_json() +print(BgpSessionNeighbors.to_json()) # convert the object into a dict bgp_session_neighbors_dict = bgp_session_neighbors_instance.to_dict() diff --git a/equinix_metal/docs/BondPortData.md b/equinix_metal/docs/BondPortData.md index 4730f9d8..d1b107eb 100644 --- a/equinix_metal/docs/BondPortData.md +++ b/equinix_metal/docs/BondPortData.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -18,7 +19,7 @@ json = "{}" # create an instance of BondPortData from a JSON string bond_port_data_instance = BondPortData.from_json(json) # print the JSON string representation of the object -print BondPortData.to_json() +print(BondPortData.to_json()) # convert the object into a dict bond_port_data_dict = bond_port_data_instance.to_dict() diff --git a/equinix_metal/docs/CapacityApi.md b/equinix_metal/docs/CapacityApi.md index 137a5615..47b1bc45 100644 --- a/equinix_metal/docs/CapacityApi.md +++ b/equinix_metal/docs/CapacityApi.md @@ -22,9 +22,8 @@ Validates if a deploy can be fulfilled. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.capacity_check_per_facility_list import CapacityCheckPerFacilityList from equinix_metal.models.capacity_input import CapacityInput @@ -67,6 +66,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **capacity_input** | [**CapacityInput**](CapacityInput.md)| Facility to check capacity in | @@ -85,6 +85,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -92,7 +93,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **check_capacity_for_metro** > CapacityCheckPerMetroList check_capacity_for_metro(capacity_input) @@ -103,9 +103,8 @@ Validates if a deploy can be fulfilled in a metro. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.capacity_check_per_metro_list import CapacityCheckPerMetroList from equinix_metal.models.capacity_input import CapacityInput @@ -148,6 +147,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **capacity_input** | [**CapacityInput**](CapacityInput.md)| Metro to check capacity in | @@ -166,6 +166,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -173,7 +174,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_capacity_for_facility** > CapacityList find_capacity_for_facility() @@ -184,9 +184,8 @@ Returns a list of facilities and plans with their current capacity. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.capacity_list import CapacityList from equinix_metal.rest import ApiException @@ -226,6 +225,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + This endpoint does not need any parameter. ### Return type @@ -242,13 +242,13 @@ This endpoint does not need any parameter. - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | **401** | unauthorized | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_capacity_for_metro** > CapacityList find_capacity_for_metro() @@ -259,9 +259,8 @@ Returns a list of metros and plans with their current capacity. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.capacity_list import CapacityList from equinix_metal.rest import ApiException @@ -301,6 +300,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + This endpoint does not need any parameter. ### Return type @@ -317,13 +317,13 @@ This endpoint does not need any parameter. - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | **401** | unauthorized | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_organization_capacity_per_facility** > CapacityList find_organization_capacity_per_facility(id) @@ -334,9 +334,8 @@ Returns a list of facilities and plans with their current capacity. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.capacity_list import CapacityList from equinix_metal.rest import ApiException @@ -378,6 +377,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Organization UUID | @@ -396,6 +396,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -403,7 +404,6 @@ Name | Type | Description | Notes **403** | forbidden | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_organization_capacity_per_metro** > CapacityList find_organization_capacity_per_metro(id) @@ -414,9 +414,8 @@ Returns a list of metros and plans with their current capacity. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.capacity_list import CapacityList from equinix_metal.rest import ApiException @@ -458,6 +457,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Organization UUID | @@ -476,6 +476,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -483,4 +484,3 @@ Name | Type | Description | Notes **403** | forbidden | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/CapacityCheckPerFacilityInfo.md b/equinix_metal/docs/CapacityCheckPerFacilityInfo.md index 21f73830..175b3731 100644 --- a/equinix_metal/docs/CapacityCheckPerFacilityInfo.md +++ b/equinix_metal/docs/CapacityCheckPerFacilityInfo.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **available** | **bool** | | [optional] @@ -20,7 +21,7 @@ json = "{}" # create an instance of CapacityCheckPerFacilityInfo from a JSON string capacity_check_per_facility_info_instance = CapacityCheckPerFacilityInfo.from_json(json) # print the JSON string representation of the object -print CapacityCheckPerFacilityInfo.to_json() +print(CapacityCheckPerFacilityInfo.to_json()) # convert the object into a dict capacity_check_per_facility_info_dict = capacity_check_per_facility_info_instance.to_dict() diff --git a/equinix_metal/docs/CapacityCheckPerFacilityList.md b/equinix_metal/docs/CapacityCheckPerFacilityList.md index 7cb4e74e..9d0e95d0 100644 --- a/equinix_metal/docs/CapacityCheckPerFacilityList.md +++ b/equinix_metal/docs/CapacityCheckPerFacilityList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of CapacityCheckPerFacilityList from a JSON string capacity_check_per_facility_list_instance = CapacityCheckPerFacilityList.from_json(json) # print the JSON string representation of the object -print CapacityCheckPerFacilityList.to_json() +print(CapacityCheckPerFacilityList.to_json()) # convert the object into a dict capacity_check_per_facility_list_dict = capacity_check_per_facility_list_instance.to_dict() diff --git a/equinix_metal/docs/CapacityCheckPerMetroInfo.md b/equinix_metal/docs/CapacityCheckPerMetroInfo.md index b3975307..48124267 100644 --- a/equinix_metal/docs/CapacityCheckPerMetroInfo.md +++ b/equinix_metal/docs/CapacityCheckPerMetroInfo.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **available** | **bool** | Returns true if there is enough capacity in the metro to fulfill the quantity set. Returns false if there is not enough. | [optional] @@ -20,7 +21,7 @@ json = "{}" # create an instance of CapacityCheckPerMetroInfo from a JSON string capacity_check_per_metro_info_instance = CapacityCheckPerMetroInfo.from_json(json) # print the JSON string representation of the object -print CapacityCheckPerMetroInfo.to_json() +print(CapacityCheckPerMetroInfo.to_json()) # convert the object into a dict capacity_check_per_metro_info_dict = capacity_check_per_metro_info_instance.to_dict() diff --git a/equinix_metal/docs/CapacityCheckPerMetroList.md b/equinix_metal/docs/CapacityCheckPerMetroList.md index 077d12ae..0bcf89e5 100644 --- a/equinix_metal/docs/CapacityCheckPerMetroList.md +++ b/equinix_metal/docs/CapacityCheckPerMetroList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of CapacityCheckPerMetroList from a JSON string capacity_check_per_metro_list_instance = CapacityCheckPerMetroList.from_json(json) # print the JSON string representation of the object -print CapacityCheckPerMetroList.to_json() +print(CapacityCheckPerMetroList.to_json()) # convert the object into a dict capacity_check_per_metro_list_dict = capacity_check_per_metro_list_instance.to_dict() diff --git a/equinix_metal/docs/CapacityInput.md b/equinix_metal/docs/CapacityInput.md index 7715cc6a..6a282eac 100644 --- a/equinix_metal/docs/CapacityInput.md +++ b/equinix_metal/docs/CapacityInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of CapacityInput from a JSON string capacity_input_instance = CapacityInput.from_json(json) # print the JSON string representation of the object -print CapacityInput.to_json() +print(CapacityInput.to_json()) # convert the object into a dict capacity_input_dict = capacity_input_instance.to_dict() diff --git a/equinix_metal/docs/CapacityLevelPerBaremetal.md b/equinix_metal/docs/CapacityLevelPerBaremetal.md index 1db67345..ccc59780 100644 --- a/equinix_metal/docs/CapacityLevelPerBaremetal.md +++ b/equinix_metal/docs/CapacityLevelPerBaremetal.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of CapacityLevelPerBaremetal from a JSON string capacity_level_per_baremetal_instance = CapacityLevelPerBaremetal.from_json(json) # print the JSON string representation of the object -print CapacityLevelPerBaremetal.to_json() +print(CapacityLevelPerBaremetal.to_json()) # convert the object into a dict capacity_level_per_baremetal_dict = capacity_level_per_baremetal_instance.to_dict() diff --git a/equinix_metal/docs/CapacityList.md b/equinix_metal/docs/CapacityList.md index c6d14cc8..3886b492 100644 --- a/equinix_metal/docs/CapacityList.md +++ b/equinix_metal/docs/CapacityList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **capacity** | **Dict[str, Dict[str, CapacityLevelPerBaremetal]]** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of CapacityList from a JSON string capacity_list_instance = CapacityList.from_json(json) # print the JSON string representation of the object -print CapacityList.to_json() +print(CapacityList.to_json()) # convert the object into a dict capacity_list_dict = capacity_list_instance.to_dict() diff --git a/equinix_metal/docs/Component.md b/equinix_metal/docs/Component.md index 2d615cd8..a5cbb38a 100644 --- a/equinix_metal/docs/Component.md +++ b/equinix_metal/docs/Component.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **checksum** | **str** | File checksum | [optional] [readonly] @@ -27,7 +28,7 @@ json = "{}" # create an instance of Component from a JSON string component_instance = Component.from_json(json) # print the JSON string representation of the object -print Component.to_json() +print(Component.to_json()) # convert the object into a dict component_dict = component_instance.to_dict() diff --git a/equinix_metal/docs/ConsoleLogDetailsApi.md b/equinix_metal/docs/ConsoleLogDetailsApi.md index b1c2f285..872b352f 100644 --- a/equinix_metal/docs/ConsoleLogDetailsApi.md +++ b/equinix_metal/docs/ConsoleLogDetailsApi.md @@ -17,9 +17,8 @@ Capture a screenshot from the device, if supported, via the BMC. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -59,6 +58,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Device UUID | @@ -77,6 +77,7 @@ Name | Type | Description | Notes - **Accept**: application/jpeg, application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | An image file | - | @@ -85,4 +86,3 @@ Name | Type | Description | Notes **501** | not implemented for device | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/Coordinates.md b/equinix_metal/docs/Coordinates.md index 2e5110cf..87b1de61 100644 --- a/equinix_metal/docs/Coordinates.md +++ b/equinix_metal/docs/Coordinates.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -18,7 +19,7 @@ json = "{}" # create an instance of Coordinates from a JSON string coordinates_instance = Coordinates.from_json(json) # print the JSON string representation of the object -print Coordinates.to_json() +print(Coordinates.to_json()) # convert the object into a dict coordinates_dict = coordinates_instance.to_dict() diff --git a/equinix_metal/docs/CreateDeviceRequest.md b/equinix_metal/docs/CreateDeviceRequest.md index 2898be94..c2aa712f 100644 --- a/equinix_metal/docs/CreateDeviceRequest.md +++ b/equinix_metal/docs/CreateDeviceRequest.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -13,7 +14,7 @@ Name | Type | Description | Notes **features** | **List[str]** | The features attribute allows you to optionally specify what features your server should have. In the API shorthand syntax, all features listed are `required`: ``` { \"features\": [\"tpm\"] } ``` Alternatively, if you do not require a certain feature, but would prefer to be assigned a server with that feature if there are any available, you may specify that feature with a `preferred` value. The request will not fail if we have no servers with that feature in our inventory. The API offers an alternative syntax for mixing preferred and required features: ``` { \"features\": { \"tpm\": \"required\", \"raid\": \"preferred\" } } ``` The request will only fail if there are no available servers matching the required `tpm` criteria. | [optional] **hardware_reservation_id** | **str** | The Hardware Reservation UUID to provision. Alternatively, `next-available` can be specified to select from any of the available hardware reservations. An error will be returned if the requested reservation option is not available. See [Reserved Hardware](https://metal.equinix.com/developers/docs/deploy/reserved/) for more details. | [optional] **hostname** | **str** | The hostname to use within the operating system. The same hostname may be used on multiple devices within a project. | [optional] -**ip_addresses** | [**List[IPAddress]**](IPAddress.md) | The `ip_addresses attribute will allow you to specify the addresses you want created with your device. The default value configures public IPv4, public IPv6, and private IPv4. Private IPv4 address is required. When specifying `ip_addresses`, one of the array items must enable private IPv4. Some operating systems require public IPv4 address. In those cases you will receive an error message if public IPv4 is not enabled. For example, to only configure your server with a private IPv4 address, you can send `{ \"ip_addresses\": [{ \"address_family\": 4, \"public\": false }] }`. It is possible to request a subnet size larger than a `/30` by assigning addresses using the UUID(s) of ip_reservations in your project. For example, `{ \"ip_addresses\": [..., {\"address_family\": 4, \"public\": true, \"ip_reservations\": [\"uuid1\", \"uuid2\"]}] }` To access a server without public IPs, you can use our Out-of-Band console access (SOS) or proxy through another server in the project with public IPs enabled. | [optional] [default to [{"address_family":4,"public":true},{"address_family":4,"public":false},{"address_family":6,"public":true}]] +**ip_addresses** | [**List[IPAddress]**](IPAddress.md) | The `ip_addresses attribute will allow you to specify the addresses you want created with your device. The default value configures public IPv4, public IPv6, and private IPv4. Private IPv4 address is required. When specifying `ip_addresses`, one of the array items must enable private IPv4. Some operating systems require public IPv4 address. In those cases you will receive an error message if public IPv4 is not enabled. For example, to only configure your server with a private IPv4 address, you can send `{ \"ip_addresses\": [{ \"address_family\": 4, \"public\": false }] }`. It is possible to request a subnet size larger than a `/30` by assigning addresses using the UUID(s) of ip_reservations in your project. For example, `{ \"ip_addresses\": [..., {\"address_family\": 4, \"public\": true, \"ip_reservations\": [\"uuid1\", \"uuid2\"]}] }` To access a server without public IPs, you can use our Out-of-Band console access (SOS) or proxy through another server in the project with public IPs enabled. | [optional] [default to [{address_family=4, public=true}, {address_family=4, public=false}, {address_family=6, public=true}]] **ipxe_script_url** | **str** | When set, the device will chainload an iPXE Script at boot fetched from the supplied URL. See [Custom iPXE](https://metal.equinix.com/developers/docs/operating-systems/custom-ipxe/) for more details. | [optional] **locked** | **bool** | Whether the device should be locked, preventing accidental deletion. | [optional] [default to False] **network_frozen** | **bool** | If true, this instance can not be converted to a different network type. | [optional] @@ -43,7 +44,7 @@ json = "{}" # create an instance of CreateDeviceRequest from a JSON string create_device_request_instance = CreateDeviceRequest.from_json(json) # print the JSON string representation of the object -print CreateDeviceRequest.to_json() +print(CreateDeviceRequest.to_json()) # convert the object into a dict create_device_request_dict = create_device_request_instance.to_dict() diff --git a/equinix_metal/docs/CreateEmailInput.md b/equinix_metal/docs/CreateEmailInput.md index 721e55c4..a0c4b3c0 100644 --- a/equinix_metal/docs/CreateEmailInput.md +++ b/equinix_metal/docs/CreateEmailInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **address** | **str** | | @@ -17,7 +18,7 @@ json = "{}" # create an instance of CreateEmailInput from a JSON string create_email_input_instance = CreateEmailInput.from_json(json) # print the JSON string representation of the object -print CreateEmailInput.to_json() +print(CreateEmailInput.to_json()) # convert the object into a dict create_email_input_dict = create_email_input_instance.to_dict() diff --git a/equinix_metal/docs/CreateMetalGatewayRequest.md b/equinix_metal/docs/CreateMetalGatewayRequest.md index 9f384ff9..954ab19f 100644 --- a/equinix_metal/docs/CreateMetalGatewayRequest.md +++ b/equinix_metal/docs/CreateMetalGatewayRequest.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -19,7 +20,7 @@ json = "{}" # create an instance of CreateMetalGatewayRequest from a JSON string create_metal_gateway_request_instance = CreateMetalGatewayRequest.from_json(json) # print the JSON string representation of the object -print CreateMetalGatewayRequest.to_json() +print(CreateMetalGatewayRequest.to_json()) # convert the object into a dict create_metal_gateway_request_dict = create_metal_gateway_request_instance.to_dict() diff --git a/equinix_metal/docs/CreateOrganizationInterconnectionRequest.md b/equinix_metal/docs/CreateOrganizationInterconnectionRequest.md index b43572fd..abd0c22a 100644 --- a/equinix_metal/docs/CreateOrganizationInterconnectionRequest.md +++ b/equinix_metal/docs/CreateOrganizationInterconnectionRequest.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **billing_account_name** | **str** | The billing account name of the Equinix Fabric account. | [optional] @@ -32,7 +33,7 @@ json = "{}" # create an instance of CreateOrganizationInterconnectionRequest from a JSON string create_organization_interconnection_request_instance = CreateOrganizationInterconnectionRequest.from_json(json) # print the JSON string representation of the object -print CreateOrganizationInterconnectionRequest.to_json() +print(CreateOrganizationInterconnectionRequest.to_json()) # convert the object into a dict create_organization_interconnection_request_dict = create_organization_interconnection_request_instance.to_dict() diff --git a/equinix_metal/docs/CreateSelfServiceReservationRequest.md b/equinix_metal/docs/CreateSelfServiceReservationRequest.md index 9af081a8..3c6908ff 100644 --- a/equinix_metal/docs/CreateSelfServiceReservationRequest.md +++ b/equinix_metal/docs/CreateSelfServiceReservationRequest.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -20,7 +21,7 @@ json = "{}" # create an instance of CreateSelfServiceReservationRequest from a JSON string create_self_service_reservation_request_instance = CreateSelfServiceReservationRequest.from_json(json) # print the JSON string representation of the object -print CreateSelfServiceReservationRequest.to_json() +print(CreateSelfServiceReservationRequest.to_json()) # convert the object into a dict create_self_service_reservation_request_dict = create_self_service_reservation_request_instance.to_dict() diff --git a/equinix_metal/docs/CreateSelfServiceReservationRequestPeriod.md b/equinix_metal/docs/CreateSelfServiceReservationRequestPeriod.md index a01668ca..f3ac9585 100644 --- a/equinix_metal/docs/CreateSelfServiceReservationRequestPeriod.md +++ b/equinix_metal/docs/CreateSelfServiceReservationRequestPeriod.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **count** | **int** | | [optional] @@ -18,7 +19,7 @@ json = "{}" # create an instance of CreateSelfServiceReservationRequestPeriod from a JSON string create_self_service_reservation_request_period_instance = CreateSelfServiceReservationRequestPeriod.from_json(json) # print the JSON string representation of the object -print CreateSelfServiceReservationRequestPeriod.to_json() +print(CreateSelfServiceReservationRequestPeriod.to_json()) # convert the object into a dict create_self_service_reservation_request_period_dict = create_self_service_reservation_request_period_instance.to_dict() diff --git a/equinix_metal/docs/DedicatedPortCreateInput.md b/equinix_metal/docs/DedicatedPortCreateInput.md index 92ddf5ce..7fb8e850 100644 --- a/equinix_metal/docs/DedicatedPortCreateInput.md +++ b/equinix_metal/docs/DedicatedPortCreateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **billing_account_name** | **str** | The billing account name of the Equinix Fabric account. | [optional] @@ -28,7 +29,7 @@ json = "{}" # create an instance of DedicatedPortCreateInput from a JSON string dedicated_port_create_input_instance = DedicatedPortCreateInput.from_json(json) # print the JSON string representation of the object -print DedicatedPortCreateInput.to_json() +print(DedicatedPortCreateInput.to_json()) # convert the object into a dict dedicated_port_create_input_dict = dedicated_port_create_input_instance.to_dict() diff --git a/equinix_metal/docs/Device.md b/equinix_metal/docs/Device.md index 2d50ceab..817c32e8 100644 --- a/equinix_metal/docs/Device.md +++ b/equinix_metal/docs/Device.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **actions** | [**List[DeviceActionsInner]**](DeviceActionsInner.md) | Actions supported by the device instance. | [optional] @@ -58,7 +59,7 @@ json = "{}" # create an instance of Device from a JSON string device_instance = Device.from_json(json) # print the JSON string representation of the object -print Device.to_json() +print(Device.to_json()) # convert the object into a dict device_dict = device_instance.to_dict() diff --git a/equinix_metal/docs/DeviceActionInput.md b/equinix_metal/docs/DeviceActionInput.md index 41615744..7f691ad2 100644 --- a/equinix_metal/docs/DeviceActionInput.md +++ b/equinix_metal/docs/DeviceActionInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **deprovision_fast** | **bool** | When type is `reinstall`, enabling fast deprovisioning will bypass full disk wiping. | [optional] @@ -22,7 +23,7 @@ json = "{}" # create an instance of DeviceActionInput from a JSON string device_action_input_instance = DeviceActionInput.from_json(json) # print the JSON string representation of the object -print DeviceActionInput.to_json() +print(DeviceActionInput.to_json()) # convert the object into a dict device_action_input_dict = device_action_input_instance.to_dict() diff --git a/equinix_metal/docs/DeviceActionsInner.md b/equinix_metal/docs/DeviceActionsInner.md index fbb7786b..ab1f90da 100644 --- a/equinix_metal/docs/DeviceActionsInner.md +++ b/equinix_metal/docs/DeviceActionsInner.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -18,7 +19,7 @@ json = "{}" # create an instance of DeviceActionsInner from a JSON string device_actions_inner_instance = DeviceActionsInner.from_json(json) # print the JSON string representation of the object -print DeviceActionsInner.to_json() +print(DeviceActionsInner.to_json()) # convert the object into a dict device_actions_inner_dict = device_actions_inner_instance.to_dict() diff --git a/equinix_metal/docs/DeviceCreateInFacilityInput.md b/equinix_metal/docs/DeviceCreateInFacilityInput.md index 15f567e3..8d9479d1 100644 --- a/equinix_metal/docs/DeviceCreateInFacilityInput.md +++ b/equinix_metal/docs/DeviceCreateInFacilityInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **facility** | [**FacilityInputFacility**](FacilityInputFacility.md) | | @@ -13,7 +14,7 @@ Name | Type | Description | Notes **features** | **List[str]** | The features attribute allows you to optionally specify what features your server should have. In the API shorthand syntax, all features listed are `required`: ``` { \"features\": [\"tpm\"] } ``` Alternatively, if you do not require a certain feature, but would prefer to be assigned a server with that feature if there are any available, you may specify that feature with a `preferred` value. The request will not fail if we have no servers with that feature in our inventory. The API offers an alternative syntax for mixing preferred and required features: ``` { \"features\": { \"tpm\": \"required\", \"raid\": \"preferred\" } } ``` The request will only fail if there are no available servers matching the required `tpm` criteria. | [optional] **hardware_reservation_id** | **str** | The Hardware Reservation UUID to provision. Alternatively, `next-available` can be specified to select from any of the available hardware reservations. An error will be returned if the requested reservation option is not available. See [Reserved Hardware](https://metal.equinix.com/developers/docs/deploy/reserved/) for more details. | [optional] **hostname** | **str** | The hostname to use within the operating system. The same hostname may be used on multiple devices within a project. | [optional] -**ip_addresses** | [**List[IPAddress]**](IPAddress.md) | The `ip_addresses attribute will allow you to specify the addresses you want created with your device. The default value configures public IPv4, public IPv6, and private IPv4. Private IPv4 address is required. When specifying `ip_addresses`, one of the array items must enable private IPv4. Some operating systems require public IPv4 address. In those cases you will receive an error message if public IPv4 is not enabled. For example, to only configure your server with a private IPv4 address, you can send `{ \"ip_addresses\": [{ \"address_family\": 4, \"public\": false }] }`. It is possible to request a subnet size larger than a `/30` by assigning addresses using the UUID(s) of ip_reservations in your project. For example, `{ \"ip_addresses\": [..., {\"address_family\": 4, \"public\": true, \"ip_reservations\": [\"uuid1\", \"uuid2\"]}] }` To access a server without public IPs, you can use our Out-of-Band console access (SOS) or proxy through another server in the project with public IPs enabled. | [optional] [default to [{"address_family":4,"public":true},{"address_family":4,"public":false},{"address_family":6,"public":true}]] +**ip_addresses** | [**List[IPAddress]**](IPAddress.md) | The `ip_addresses attribute will allow you to specify the addresses you want created with your device. The default value configures public IPv4, public IPv6, and private IPv4. Private IPv4 address is required. When specifying `ip_addresses`, one of the array items must enable private IPv4. Some operating systems require public IPv4 address. In those cases you will receive an error message if public IPv4 is not enabled. For example, to only configure your server with a private IPv4 address, you can send `{ \"ip_addresses\": [{ \"address_family\": 4, \"public\": false }] }`. It is possible to request a subnet size larger than a `/30` by assigning addresses using the UUID(s) of ip_reservations in your project. For example, `{ \"ip_addresses\": [..., {\"address_family\": 4, \"public\": true, \"ip_reservations\": [\"uuid1\", \"uuid2\"]}] }` To access a server without public IPs, you can use our Out-of-Band console access (SOS) or proxy through another server in the project with public IPs enabled. | [optional] [default to [{address_family=4, public=true}, {address_family=4, public=false}, {address_family=6, public=true}]] **ipxe_script_url** | **str** | When set, the device will chainload an iPXE Script at boot fetched from the supplied URL. See [Custom iPXE](https://metal.equinix.com/developers/docs/operating-systems/custom-ipxe/) for more details. | [optional] **locked** | **bool** | Whether the device should be locked, preventing accidental deletion. | [optional] [default to False] **network_frozen** | **bool** | If true, this instance can not be converted to a different network type. | [optional] @@ -42,7 +43,7 @@ json = "{}" # create an instance of DeviceCreateInFacilityInput from a JSON string device_create_in_facility_input_instance = DeviceCreateInFacilityInput.from_json(json) # print the JSON string representation of the object -print DeviceCreateInFacilityInput.to_json() +print(DeviceCreateInFacilityInput.to_json()) # convert the object into a dict device_create_in_facility_input_dict = device_create_in_facility_input_instance.to_dict() diff --git a/equinix_metal/docs/DeviceCreateInMetroInput.md b/equinix_metal/docs/DeviceCreateInMetroInput.md index 85f0500f..787d52a3 100644 --- a/equinix_metal/docs/DeviceCreateInMetroInput.md +++ b/equinix_metal/docs/DeviceCreateInMetroInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -13,7 +14,7 @@ Name | Type | Description | Notes **features** | **List[str]** | The features attribute allows you to optionally specify what features your server should have. In the API shorthand syntax, all features listed are `required`: ``` { \"features\": [\"tpm\"] } ``` Alternatively, if you do not require a certain feature, but would prefer to be assigned a server with that feature if there are any available, you may specify that feature with a `preferred` value. The request will not fail if we have no servers with that feature in our inventory. The API offers an alternative syntax for mixing preferred and required features: ``` { \"features\": { \"tpm\": \"required\", \"raid\": \"preferred\" } } ``` The request will only fail if there are no available servers matching the required `tpm` criteria. | [optional] **hardware_reservation_id** | **str** | The Hardware Reservation UUID to provision. Alternatively, `next-available` can be specified to select from any of the available hardware reservations. An error will be returned if the requested reservation option is not available. See [Reserved Hardware](https://metal.equinix.com/developers/docs/deploy/reserved/) for more details. | [optional] **hostname** | **str** | The hostname to use within the operating system. The same hostname may be used on multiple devices within a project. | [optional] -**ip_addresses** | [**List[IPAddress]**](IPAddress.md) | The `ip_addresses attribute will allow you to specify the addresses you want created with your device. The default value configures public IPv4, public IPv6, and private IPv4. Private IPv4 address is required. When specifying `ip_addresses`, one of the array items must enable private IPv4. Some operating systems require public IPv4 address. In those cases you will receive an error message if public IPv4 is not enabled. For example, to only configure your server with a private IPv4 address, you can send `{ \"ip_addresses\": [{ \"address_family\": 4, \"public\": false }] }`. It is possible to request a subnet size larger than a `/30` by assigning addresses using the UUID(s) of ip_reservations in your project. For example, `{ \"ip_addresses\": [..., {\"address_family\": 4, \"public\": true, \"ip_reservations\": [\"uuid1\", \"uuid2\"]}] }` To access a server without public IPs, you can use our Out-of-Band console access (SOS) or proxy through another server in the project with public IPs enabled. | [optional] [default to [{"address_family":4,"public":true},{"address_family":4,"public":false},{"address_family":6,"public":true}]] +**ip_addresses** | [**List[IPAddress]**](IPAddress.md) | The `ip_addresses attribute will allow you to specify the addresses you want created with your device. The default value configures public IPv4, public IPv6, and private IPv4. Private IPv4 address is required. When specifying `ip_addresses`, one of the array items must enable private IPv4. Some operating systems require public IPv4 address. In those cases you will receive an error message if public IPv4 is not enabled. For example, to only configure your server with a private IPv4 address, you can send `{ \"ip_addresses\": [{ \"address_family\": 4, \"public\": false }] }`. It is possible to request a subnet size larger than a `/30` by assigning addresses using the UUID(s) of ip_reservations in your project. For example, `{ \"ip_addresses\": [..., {\"address_family\": 4, \"public\": true, \"ip_reservations\": [\"uuid1\", \"uuid2\"]}] }` To access a server without public IPs, you can use our Out-of-Band console access (SOS) or proxy through another server in the project with public IPs enabled. | [optional] [default to [{address_family=4, public=true}, {address_family=4, public=false}, {address_family=6, public=true}]] **ipxe_script_url** | **str** | When set, the device will chainload an iPXE Script at boot fetched from the supplied URL. See [Custom iPXE](https://metal.equinix.com/developers/docs/operating-systems/custom-ipxe/) for more details. | [optional] **locked** | **bool** | Whether the device should be locked, preventing accidental deletion. | [optional] [default to False] **network_frozen** | **bool** | If true, this instance can not be converted to a different network type. | [optional] @@ -42,7 +43,7 @@ json = "{}" # create an instance of DeviceCreateInMetroInput from a JSON string device_create_in_metro_input_instance = DeviceCreateInMetroInput.from_json(json) # print the JSON string representation of the object -print DeviceCreateInMetroInput.to_json() +print(DeviceCreateInMetroInput.to_json()) # convert the object into a dict device_create_in_metro_input_dict = device_create_in_metro_input_instance.to_dict() diff --git a/equinix_metal/docs/DeviceCreateInput.md b/equinix_metal/docs/DeviceCreateInput.md index 3fc27999..6236c026 100644 --- a/equinix_metal/docs/DeviceCreateInput.md +++ b/equinix_metal/docs/DeviceCreateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **always_pxe** | **bool** | When true, devices with a `custom_ipxe` OS will always boot to iPXE. The default setting of false ensures that iPXE will be used on only the first boot. | [optional] @@ -41,7 +42,7 @@ json = "{}" # create an instance of DeviceCreateInput from a JSON string device_create_input_instance = DeviceCreateInput.from_json(json) # print the JSON string representation of the object -print DeviceCreateInput.to_json() +print(DeviceCreateInput.to_json()) # convert the object into a dict device_create_input_dict = device_create_input_instance.to_dict() diff --git a/equinix_metal/docs/DeviceCreatedBy.md b/equinix_metal/docs/DeviceCreatedBy.md index a6308e2d..518c961c 100644 --- a/equinix_metal/docs/DeviceCreatedBy.md +++ b/equinix_metal/docs/DeviceCreatedBy.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **avatar_thumb_url** | **str** | Avatar thumbnail URL of the User | [optional] @@ -25,7 +26,7 @@ json = "{}" # create an instance of DeviceCreatedBy from a JSON string device_created_by_instance = DeviceCreatedBy.from_json(json) # print the JSON string representation of the object -print DeviceCreatedBy.to_json() +print(DeviceCreatedBy.to_json()) # convert the object into a dict device_created_by_dict = device_created_by_instance.to_dict() diff --git a/equinix_metal/docs/DeviceHealthRollup.md b/equinix_metal/docs/DeviceHealthRollup.md index 1916e2c2..b2cb6f2f 100644 --- a/equinix_metal/docs/DeviceHealthRollup.md +++ b/equinix_metal/docs/DeviceHealthRollup.md @@ -3,6 +3,7 @@ Represents a Device Health Status ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **health_rollup** | **str** | Health Status | [optional] [readonly] @@ -19,7 +20,7 @@ json = "{}" # create an instance of DeviceHealthRollup from a JSON string device_health_rollup_instance = DeviceHealthRollup.from_json(json) # print the JSON string representation of the object -print DeviceHealthRollup.to_json() +print(DeviceHealthRollup.to_json()) # convert the object into a dict device_health_rollup_dict = device_health_rollup_instance.to_dict() diff --git a/equinix_metal/docs/DeviceList.md b/equinix_metal/docs/DeviceList.md index 300c0691..5a6e528d 100644 --- a/equinix_metal/docs/DeviceList.md +++ b/equinix_metal/docs/DeviceList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **devices** | [**List[Device]**](Device.md) | | [optional] @@ -18,7 +19,7 @@ json = "{}" # create an instance of DeviceList from a JSON string device_list_instance = DeviceList.from_json(json) # print the JSON string representation of the object -print DeviceList.to_json() +print(DeviceList.to_json()) # convert the object into a dict device_list_dict = device_list_instance.to_dict() diff --git a/equinix_metal/docs/DeviceMetro.md b/equinix_metal/docs/DeviceMetro.md index 51920206..358b1782 100644 --- a/equinix_metal/docs/DeviceMetro.md +++ b/equinix_metal/docs/DeviceMetro.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **code** | **str** | | [optional] @@ -20,7 +21,7 @@ json = "{}" # create an instance of DeviceMetro from a JSON string device_metro_instance = DeviceMetro.from_json(json) # print the JSON string representation of the object -print DeviceMetro.to_json() +print(DeviceMetro.to_json()) # convert the object into a dict device_metro_dict = device_metro_instance.to_dict() diff --git a/equinix_metal/docs/DeviceProjectLite.md b/equinix_metal/docs/DeviceProjectLite.md index 154667da..9411a103 100644 --- a/equinix_metal/docs/DeviceProjectLite.md +++ b/equinix_metal/docs/DeviceProjectLite.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | @@ -16,7 +17,7 @@ json = "{}" # create an instance of DeviceProjectLite from a JSON string device_project_lite_instance = DeviceProjectLite.from_json(json) # print the JSON string representation of the object -print DeviceProjectLite.to_json() +print(DeviceProjectLite.to_json()) # convert the object into a dict device_project_lite_dict = device_project_lite_instance.to_dict() diff --git a/equinix_metal/docs/DeviceUpdateInput.md b/equinix_metal/docs/DeviceUpdateInput.md index f2cd28f2..43742998 100644 --- a/equinix_metal/docs/DeviceUpdateInput.md +++ b/equinix_metal/docs/DeviceUpdateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **always_pxe** | **bool** | | [optional] @@ -28,7 +29,7 @@ json = "{}" # create an instance of DeviceUpdateInput from a JSON string device_update_input_instance = DeviceUpdateInput.from_json(json) # print the JSON string representation of the object -print DeviceUpdateInput.to_json() +print(DeviceUpdateInput.to_json()) # convert the object into a dict device_update_input_dict = device_update_input_instance.to_dict() diff --git a/equinix_metal/docs/DeviceUsage.md b/equinix_metal/docs/DeviceUsage.md index 35f280b0..ac84cfde 100644 --- a/equinix_metal/docs/DeviceUsage.md +++ b/equinix_metal/docs/DeviceUsage.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -19,7 +20,7 @@ json = "{}" # create an instance of DeviceUsage from a JSON string device_usage_instance = DeviceUsage.from_json(json) # print the JSON string representation of the object -print DeviceUsage.to_json() +print(DeviceUsage.to_json()) # convert the object into a dict device_usage_dict = device_usage_instance.to_dict() diff --git a/equinix_metal/docs/DeviceUsageList.md b/equinix_metal/docs/DeviceUsageList.md index 41040108..171c1795 100644 --- a/equinix_metal/docs/DeviceUsageList.md +++ b/equinix_metal/docs/DeviceUsageList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of DeviceUsageList from a JSON string device_usage_list_instance = DeviceUsageList.from_json(json) # print the JSON string representation of the object -print DeviceUsageList.to_json() +print(DeviceUsageList.to_json()) # convert the object into a dict device_usage_list_dict = device_usage_list_instance.to_dict() diff --git a/equinix_metal/docs/DevicesApi.md b/equinix_metal/docs/DevicesApi.md index e7dd4157..8efd2eea 100644 --- a/equinix_metal/docs/DevicesApi.md +++ b/equinix_metal/docs/DevicesApi.md @@ -38,9 +38,8 @@ Creates a BGP session. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.bgp_session_input import BGPSessionInput from equinix_metal.models.bgp_session import BgpSession @@ -85,6 +84,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Device UUID | @@ -105,6 +105,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | created | - | @@ -113,7 +114,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **create_device** > Device create_device(id, create_device_request, include=include, exclude=exclude) @@ -124,9 +124,8 @@ Creates a new device and provisions it in the specified location. Device type-s ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.create_device_request import CreateDeviceRequest from equinix_metal.models.device import Device @@ -172,6 +171,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Project UUID | @@ -193,6 +193,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | created | - | @@ -202,7 +203,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **create_ip_assignment** > IPAssignment create_ip_assignment(id, ip_assignment_input, include=include, exclude=exclude) @@ -213,9 +213,8 @@ Creates an ip assignment for a device. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.ip_assignment import IPAssignment from equinix_metal.models.ip_assignment_input import IPAssignmentInput @@ -261,6 +260,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Device UUID | @@ -282,6 +282,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | created | - | @@ -290,7 +291,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **delete_device** > delete_device(id, force_delete=force_delete) @@ -301,9 +301,8 @@ Deletes a device and deprovisions it in our datacenter. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -343,6 +342,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Device UUID | @@ -362,6 +362,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **204** | no content | - | @@ -371,7 +372,6 @@ void (empty response body) **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_bgp_sessions** > BgpSessionList find_bgp_sessions(id, include=include) @@ -382,9 +382,8 @@ Provides a listing of available BGP sessions for the device. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.bgp_session_list import BgpSessionList from equinix_metal.rest import ApiException @@ -427,6 +426,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Device UUID | @@ -446,6 +446,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -453,7 +454,6 @@ Name | Type | Description | Notes **403** | forbidden | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_device_by_id** > Device find_device_by_id(id, include=include, exclude=exclude) @@ -464,9 +464,8 @@ Type-specific options (such as facility for baremetal devices) will be included ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.device import Device from equinix_metal.rest import ApiException @@ -510,6 +509,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Device UUID | @@ -530,6 +530,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -538,7 +539,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_device_customdata** > find_device_customdata(id) @@ -549,9 +549,8 @@ Provides the custom metadata stored for this instance in json format ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -590,6 +589,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Instance UUID | @@ -608,6 +608,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -616,7 +617,6 @@ void (empty response body) **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_device_metadata_by_id** > Metadata find_device_metadata_by_id(id) @@ -627,9 +627,8 @@ Retrieve device metadata ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.metadata import Metadata from equinix_metal.rest import ApiException @@ -671,6 +670,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Device UUID | @@ -689,6 +689,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -697,7 +698,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_device_userdata_by_id** > Userdata find_device_userdata_by_id(id) @@ -708,9 +708,8 @@ Retrieve device userdata ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.userdata import Userdata from equinix_metal.rest import ApiException @@ -752,6 +751,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Device UUID | @@ -770,6 +770,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -778,7 +779,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_instance_bandwidth** > find_instance_bandwidth(id, var_from, until) @@ -789,9 +789,8 @@ Retrieve an instance bandwidth for a given period of time. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -832,6 +831,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Device UUID | @@ -852,6 +852,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -859,7 +860,6 @@ void (empty response body) **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_ip_assignment_customdata** > find_ip_assignment_customdata(instance_id, id) @@ -870,9 +870,8 @@ Provides the custom metadata stored for this IP Assignment in json format ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -912,6 +911,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **instance_id** | **str**| Instance UUID | @@ -931,6 +931,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -939,7 +940,6 @@ void (empty response body) **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_ip_assignments** > IPAssignmentList find_ip_assignments(id, include=include, exclude=exclude) @@ -950,9 +950,8 @@ Returns all ip assignments for a device. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.ip_assignment_list import IPAssignmentList from equinix_metal.rest import ApiException @@ -996,6 +995,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Device UUID | @@ -1016,6 +1016,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -1023,7 +1024,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_organization_devices** > DeviceList find_organization_devices(id, search=search, categories=categories, facility=facility, hostname=hostname, reserved=reserved, tag=tag, type=type, has_termination_time=has_termination_time, mac_address=mac_address, include=include, exclude=exclude, page=page, per_page=per_page) @@ -1034,9 +1034,8 @@ Provides a collection of devices for a given organization. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.device_list import DeviceList from equinix_metal.rest import ApiException @@ -1091,6 +1090,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Organization UUID | @@ -1122,6 +1122,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -1130,12 +1131,9 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_organization_devices_all_pages** > DeviceList find_organization_devices_all_pages(id, search=search, categories=categories, facility=facility, hostname=hostname, reserved=reserved, tag=tag, type=type, has_termination_time=has_termination_time, mac_address=mac_address, include=include, exclude=exclude, per_page=per_page) - Just like [**find_organization_devices**](DevicesApi.md#find_organization_devices) but fetches resources from all pages. This method doesn't take `page` parameter. Other parameters, return type and other characteristics are the same as in [**find_organization_devices**](DevicesApi.md#find_organization_devices). - # **find_project_devices** > DeviceList find_project_devices(id, search=search, categories=categories, facility=facility, metro=metro, hostname=hostname, reserved=reserved, tag=tag, type=type, has_termination_time=has_termination_time, mac_address=mac_address, include=include, exclude=exclude, page=page, per_page=per_page) @@ -1146,9 +1144,8 @@ Provides a collection of devices for a given project. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.device_list import DeviceList from equinix_metal.rest import ApiException @@ -1204,6 +1201,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Project UUID | @@ -1236,6 +1234,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -1244,12 +1243,9 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_project_devices_all_pages** > DeviceList find_project_devices_all_pages(id, search=search, categories=categories, facility=facility, metro=metro, hostname=hostname, reserved=reserved, tag=tag, type=type, has_termination_time=has_termination_time, mac_address=mac_address, include=include, exclude=exclude, per_page=per_page) - Just like [**find_project_devices**](DevicesApi.md#find_project_devices) but fetches resources from all pages. This method doesn't take `page` parameter. Other parameters, return type and other characteristics are the same as in [**find_project_devices**](DevicesApi.md#find_project_devices). - # **find_traffic** > find_traffic(id, direction, interval=interval, bucket=bucket, timeframe=timeframe) @@ -1260,9 +1256,8 @@ Returns traffic for a specific device. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.find_traffic_timeframe_parameter import FindTrafficTimeframeParameter from equinix_metal.rest import ApiException @@ -1306,6 +1301,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Device UUID | @@ -1328,6 +1324,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -1336,7 +1333,6 @@ void (empty response body) **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **get_bgp_neighbor_data** > BgpSessionNeighbors get_bgp_neighbor_data(id, include=include) @@ -1347,9 +1343,8 @@ Provides a summary of the BGP neighbor data associated to the BGP sessions for t ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.bgp_session_neighbors import BgpSessionNeighbors from equinix_metal.rest import ApiException @@ -1392,6 +1387,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Device UUID | @@ -1411,6 +1407,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -1419,7 +1416,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **get_device_firmware_sets** > FirmwareSetResponse get_device_firmware_sets(id) @@ -1430,9 +1426,8 @@ Returns the firmware set associated with the device. If a custom firmware set is ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.firmware_set_response import FirmwareSetResponse from equinix_metal.rest import ApiException @@ -1474,6 +1469,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Device UUID | @@ -1492,6 +1488,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | Successful operation | - | @@ -1500,7 +1497,6 @@ Name | Type | Description | Notes **500** | Internal Server Error | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **get_device_health_rollup** > DeviceHealthRollup get_device_health_rollup(id) @@ -1511,9 +1507,8 @@ Returns the health rollup status of the device. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.device_health_rollup import DeviceHealthRollup from equinix_metal.rest import ApiException @@ -1555,6 +1550,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Device UUID | @@ -1573,6 +1569,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | Successful operation | - | @@ -1581,7 +1578,6 @@ Name | Type | Description | Notes **500** | Internal Server Error | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **perform_action** > perform_action(id, device_action_input) @@ -1592,9 +1588,8 @@ Performs an action for the given device. Possible actions include: power_on, po ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.device_action_input import DeviceActionInput from equinix_metal.rest import ApiException @@ -1635,6 +1630,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Device UUID | @@ -1654,6 +1650,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **202** | accepted | - | @@ -1662,7 +1659,6 @@ void (empty response body) **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **update_device** > Device update_device(id, device_update_input, include=include, exclude=exclude) @@ -1673,9 +1669,8 @@ Updates the device. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.device import Device from equinix_metal.models.device_update_input import DeviceUpdateInput @@ -1721,6 +1716,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Device UUID | @@ -1742,6 +1738,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -1751,4 +1748,3 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/Disk.md b/equinix_metal/docs/Disk.md index e25dc91a..7f7664b9 100644 --- a/equinix_metal/docs/Disk.md +++ b/equinix_metal/docs/Disk.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **device** | **str** | | [optional] @@ -19,7 +20,7 @@ json = "{}" # create an instance of Disk from a JSON string disk_instance = Disk.from_json(json) # print the JSON string representation of the object -print Disk.to_json() +print(Disk.to_json()) # convert the object into a dict disk_dict = disk_instance.to_dict() diff --git a/equinix_metal/docs/Email.md b/equinix_metal/docs/Email.md index 5d938c2e..83587176 100644 --- a/equinix_metal/docs/Email.md +++ b/equinix_metal/docs/Email.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **address** | **str** | | [optional] @@ -20,7 +21,7 @@ json = "{}" # create an instance of Email from a JSON string email_instance = Email.from_json(json) # print the JSON string representation of the object -print Email.to_json() +print(Email.to_json()) # convert the object into a dict email_dict = email_instance.to_dict() diff --git a/equinix_metal/docs/EmailInput.md b/equinix_metal/docs/EmailInput.md index 7e9ebc20..d6ad4389 100644 --- a/equinix_metal/docs/EmailInput.md +++ b/equinix_metal/docs/EmailInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **address** | **str** | | @@ -18,7 +19,7 @@ json = "{}" # create an instance of EmailInput from a JSON string email_input_instance = EmailInput.from_json(json) # print the JSON string representation of the object -print EmailInput.to_json() +print(EmailInput.to_json()) # convert the object into a dict email_input_dict = email_input_instance.to_dict() diff --git a/equinix_metal/docs/EmailsApi.md b/equinix_metal/docs/EmailsApi.md index c6ce9481..f0c61ec5 100644 --- a/equinix_metal/docs/EmailsApi.md +++ b/equinix_metal/docs/EmailsApi.md @@ -20,9 +20,8 @@ Add a new email address to the current user. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.create_email_input import CreateEmailInput from equinix_metal.models.email import Email @@ -65,6 +64,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **create_email_input** | [**CreateEmailInput**](CreateEmailInput.md)| Email to create | @@ -83,6 +83,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | created | - | @@ -90,7 +91,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **delete_email** > delete_email(id) @@ -101,9 +101,8 @@ Deletes the email. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -142,6 +141,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Email UUID | @@ -160,6 +160,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **204** | no content | - | @@ -168,7 +169,6 @@ void (empty response body) **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_email_by_id** > Email find_email_by_id(id) @@ -179,9 +179,8 @@ Provides one of the user’s emails. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.email import Email from equinix_metal.rest import ApiException @@ -223,6 +222,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Email UUID | @@ -241,6 +241,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -249,7 +250,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **update_email** > Email update_email(id, update_email_input) @@ -260,9 +260,8 @@ Updates the email. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.email import Email from equinix_metal.models.update_email_input import UpdateEmailInput @@ -306,6 +305,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Email UUID | @@ -325,6 +325,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -334,4 +335,3 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/Entitlement.md b/equinix_metal/docs/Entitlement.md index 421a4506..12646557 100644 --- a/equinix_metal/docs/Entitlement.md +++ b/equinix_metal/docs/Entitlement.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **description** | **str** | | [optional] @@ -27,7 +28,7 @@ json = "{}" # create an instance of Entitlement from a JSON string entitlement_instance = Entitlement.from_json(json) # print the JSON string representation of the object -print Entitlement.to_json() +print(Entitlement.to_json()) # convert the object into a dict entitlement_dict = entitlement_instance.to_dict() diff --git a/equinix_metal/docs/Error.md b/equinix_metal/docs/Error.md index 787e339a..9337441c 100644 --- a/equinix_metal/docs/Error.md +++ b/equinix_metal/docs/Error.md @@ -3,6 +3,7 @@ Error responses are included with 4xx and 5xx HTTP responses from the API service. Either \"error\" or \"errors\" will be set. ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **error** | **str** | A description of the error that caused the request to fail. | [optional] @@ -19,7 +20,7 @@ json = "{}" # create an instance of Error from a JSON string error_instance = Error.from_json(json) # print the JSON string representation of the object -print Error.to_json() +print(Error.to_json()) # convert the object into a dict error_dict = error_instance.to_dict() diff --git a/equinix_metal/docs/Event.md b/equinix_metal/docs/Event.md index b588a096..1e713c20 100644 --- a/equinix_metal/docs/Event.md +++ b/equinix_metal/docs/Event.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **body** | **str** | | [optional] @@ -25,7 +26,7 @@ json = "{}" # create an instance of Event from a JSON string event_instance = Event.from_json(json) # print the JSON string representation of the object -print Event.to_json() +print(Event.to_json()) # convert the object into a dict event_dict = event_instance.to_dict() diff --git a/equinix_metal/docs/EventList.md b/equinix_metal/docs/EventList.md index c8b19129..01be8e12 100644 --- a/equinix_metal/docs/EventList.md +++ b/equinix_metal/docs/EventList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **events** | [**List[Event]**](Event.md) | | [optional] @@ -18,7 +19,7 @@ json = "{}" # create an instance of EventList from a JSON string event_list_instance = EventList.from_json(json) # print the JSON string representation of the object -print EventList.to_json() +print(EventList.to_json()) # convert the object into a dict event_list_dict = event_list_instance.to_dict() diff --git a/equinix_metal/docs/EventsApi.md b/equinix_metal/docs/EventsApi.md index f51d0a34..02bbc2ea 100644 --- a/equinix_metal/docs/EventsApi.md +++ b/equinix_metal/docs/EventsApi.md @@ -30,9 +30,8 @@ Returns a list of events pertaining to a specific device ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.event_list import EventList from equinix_metal.rest import ApiException @@ -78,6 +77,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Device UUID | @@ -100,6 +100,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -108,12 +109,9 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_device_events_all_pages** > EventList find_device_events_all_pages(id, include=include, exclude=exclude, per_page=per_page) - Just like [**find_device_events**](EventsApi.md#find_device_events) but fetches resources from all pages. This method doesn't take `page` parameter. Other parameters, return type and other characteristics are the same as in [**find_device_events**](EventsApi.md#find_device_events). - # **find_event_by_id** > Event find_event_by_id(id, include=include, exclude=exclude) @@ -124,9 +122,8 @@ Returns a single event if the user has access ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.event import Event from equinix_metal.rest import ApiException @@ -170,6 +167,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Event UUID | @@ -190,6 +188,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -198,7 +197,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_events** > EventList find_events(include=include, exclude=exclude, page=page, per_page=per_page) @@ -209,9 +207,8 @@ Returns a list of the current user’s events ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.event_list import EventList from equinix_metal.rest import ApiException @@ -256,6 +253,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **include** | [**List[str]**](str.md)| Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. | [optional] @@ -277,18 +275,16 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | **401** | unauthorized | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_events_all_pages** > EventList find_events_all_pages(include=include, exclude=exclude, per_page=per_page) - Just like [**find_events**](EventsApi.md#find_events) but fetches resources from all pages. This method doesn't take `page` parameter. Other parameters, return type and other characteristics are the same as in [**find_events**](EventsApi.md#find_events). - # **find_interconnection_events** > EventList find_interconnection_events(connection_id, include=include, exclude=exclude, page=page, per_page=per_page) @@ -299,9 +295,8 @@ Returns a list of the interconnection events ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.event_list import EventList from equinix_metal.rest import ApiException @@ -347,6 +342,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **connection_id** | **str**| Interconnection UUID | @@ -369,6 +365,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -377,12 +374,9 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_interconnection_events_all_pages** > EventList find_interconnection_events_all_pages(connection_id, include=include, exclude=exclude, per_page=per_page) - Just like [**find_interconnection_events**](EventsApi.md#find_interconnection_events) but fetches resources from all pages. This method doesn't take `page` parameter. Other parameters, return type and other characteristics are the same as in [**find_interconnection_events**](EventsApi.md#find_interconnection_events). - # **find_interconnection_port_events** > Event find_interconnection_port_events(connection_id, id, include=include, exclude=exclude, page=page, per_page=per_page) @@ -393,9 +387,8 @@ Returns a list of the interconnection port events ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.event import Event from equinix_metal.rest import ApiException @@ -442,6 +435,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **connection_id** | **str**| Interconnection UUID | @@ -465,6 +459,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -473,7 +468,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_organization_events** > EventList find_organization_events(id, include=include, exclude=exclude, page=page, per_page=per_page) @@ -484,9 +478,8 @@ Returns a list of events for a single organization ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.event_list import EventList from equinix_metal.rest import ApiException @@ -532,6 +525,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Organization UUID | @@ -554,6 +548,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -562,12 +557,9 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_organization_events_all_pages** > EventList find_organization_events_all_pages(id, include=include, exclude=exclude, per_page=per_page) - Just like [**find_organization_events**](EventsApi.md#find_organization_events) but fetches resources from all pages. This method doesn't take `page` parameter. Other parameters, return type and other characteristics are the same as in [**find_organization_events**](EventsApi.md#find_organization_events). - # **find_project_events** > EventList find_project_events(id, include=include, exclude=exclude, page=page, per_page=per_page) @@ -578,9 +570,8 @@ Returns a list of events for a single project ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.event_list import EventList from equinix_metal.rest import ApiException @@ -626,6 +617,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Project UUID | @@ -648,6 +640,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -656,12 +649,9 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_project_events_all_pages** > EventList find_project_events_all_pages(id, include=include, exclude=exclude, per_page=per_page) - Just like [**find_project_events**](EventsApi.md#find_project_events) but fetches resources from all pages. This method doesn't take `page` parameter. Other parameters, return type and other characteristics are the same as in [**find_project_events**](EventsApi.md#find_project_events). - # **find_virtual_circuit_events** > Event find_virtual_circuit_events(id, include=include, exclude=exclude, page=page, per_page=per_page) @@ -672,9 +662,8 @@ Returns a list of the virtual circuit events ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.event import Event from equinix_metal.rest import ApiException @@ -720,6 +709,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Virtual Circuit UUID | @@ -742,6 +732,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -750,7 +741,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_vrf_route_events** > Event find_vrf_route_events(id, include=include, exclude=exclude, page=page, per_page=per_page) @@ -761,9 +751,8 @@ Returns a list of the VRF route events ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.event import Event from equinix_metal.rest import ApiException @@ -809,6 +798,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| VRF Route UUID | @@ -831,6 +821,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -839,4 +830,3 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/FabricServiceToken.md b/equinix_metal/docs/FabricServiceToken.md index d89cf3ed..b80218be 100644 --- a/equinix_metal/docs/FabricServiceToken.md +++ b/equinix_metal/docs/FabricServiceToken.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **expires_at** | **datetime** | The expiration date and time of the Fabric service token. Once a service token is expired, it is no longer redeemable. | [optional] @@ -22,7 +23,7 @@ json = "{}" # create an instance of FabricServiceToken from a JSON string fabric_service_token_instance = FabricServiceToken.from_json(json) # print the JSON string representation of the object -print FabricServiceToken.to_json() +print(FabricServiceToken.to_json()) # convert the object into a dict fabric_service_token_dict = fabric_service_token_instance.to_dict() diff --git a/equinix_metal/docs/FacilitiesApi.md b/equinix_metal/docs/FacilitiesApi.md index cf3b439f..6e5ce231 100644 --- a/equinix_metal/docs/FacilitiesApi.md +++ b/equinix_metal/docs/FacilitiesApi.md @@ -19,9 +19,8 @@ Provides a listing of available datacenters where you can provision Packet devic ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.facility_list import FacilityList from equinix_metal.rest import ApiException @@ -64,6 +63,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **include** | [**List[str]**](str.md)| Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. | [optional] @@ -83,13 +83,13 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | **401** | unauthorized | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_facilities_by_organization** > FacilityList find_facilities_by_organization(id, include=include, exclude=exclude) @@ -100,9 +100,8 @@ Returns a listing of available datacenters for the given organization ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.facility_list import FacilityList from equinix_metal.rest import ApiException @@ -146,6 +145,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Organization UUID | @@ -166,6 +166,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -174,7 +175,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_facilities_by_project** > FacilityList find_facilities_by_project(id, include=include, exclude=exclude) @@ -185,9 +185,8 @@ Returns a listing of available datacenters for the given project ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.facility_list import FacilityList from equinix_metal.rest import ApiException @@ -231,6 +230,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Project UUID | @@ -251,6 +251,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -259,4 +260,3 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/Facility.md b/equinix_metal/docs/Facility.md index ee88f5a3..9d8299b5 100644 --- a/equinix_metal/docs/Facility.md +++ b/equinix_metal/docs/Facility.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **address** | [**Address**](Address.md) | | [optional] @@ -23,7 +24,7 @@ json = "{}" # create an instance of Facility from a JSON string facility_instance = Facility.from_json(json) # print the JSON string representation of the object -print Facility.to_json() +print(Facility.to_json()) # convert the object into a dict facility_dict = facility_instance.to_dict() diff --git a/equinix_metal/docs/FacilityInput.md b/equinix_metal/docs/FacilityInput.md index 05e389f5..56e49e65 100644 --- a/equinix_metal/docs/FacilityInput.md +++ b/equinix_metal/docs/FacilityInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **facility** | [**FacilityInputFacility**](FacilityInputFacility.md) | | @@ -17,7 +18,7 @@ json = "{}" # create an instance of FacilityInput from a JSON string facility_input_instance = FacilityInput.from_json(json) # print the JSON string representation of the object -print FacilityInput.to_json() +print(FacilityInput.to_json()) # convert the object into a dict facility_input_dict = facility_input_instance.to_dict() diff --git a/equinix_metal/docs/FacilityInputFacility.md b/equinix_metal/docs/FacilityInputFacility.md index 9a6b14b1..1f545827 100644 --- a/equinix_metal/docs/FacilityInputFacility.md +++ b/equinix_metal/docs/FacilityInputFacility.md @@ -3,6 +3,7 @@ The datacenter where the device should be created. Either metro or facility must be provided. The API will accept either a single facility `{ \"facility\": \"f1\" }`, or it can be instructed to create the device in the best available datacenter `{ \"facility\": \"any\" }`. Additionally it is possible to set a prioritized location selection. For example `{ \"facility\": [\"f3\", \"f2\", \"any\"] }` can be used to prioritize `f3` and then `f2` before accepting `any` facility. If none of the facilities provided have availability for the requested device the request will fail. ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- @@ -16,7 +17,7 @@ json = "{}" # create an instance of FacilityInputFacility from a JSON string facility_input_facility_instance = FacilityInputFacility.from_json(json) # print the JSON string representation of the object -print FacilityInputFacility.to_json() +print(FacilityInputFacility.to_json()) # convert the object into a dict facility_input_facility_dict = facility_input_facility_instance.to_dict() diff --git a/equinix_metal/docs/FacilityList.md b/equinix_metal/docs/FacilityList.md index 3d40305c..e31ea472 100644 --- a/equinix_metal/docs/FacilityList.md +++ b/equinix_metal/docs/FacilityList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **facilities** | [**List[Facility]**](Facility.md) | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of FacilityList from a JSON string facility_list_instance = FacilityList.from_json(json) # print the JSON string representation of the object -print FacilityList.to_json() +print(FacilityList.to_json()) # convert the object into a dict facility_list_dict = facility_list_instance.to_dict() diff --git a/equinix_metal/docs/Filesystem.md b/equinix_metal/docs/Filesystem.md index ffde3bdf..30ae7e12 100644 --- a/equinix_metal/docs/Filesystem.md +++ b/equinix_metal/docs/Filesystem.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of Filesystem from a JSON string filesystem_instance = Filesystem.from_json(json) # print the JSON string representation of the object -print Filesystem.to_json() +print(Filesystem.to_json()) # convert the object into a dict filesystem_dict = filesystem_instance.to_dict() diff --git a/equinix_metal/docs/FindIPAddressById200Response.md b/equinix_metal/docs/FindIPAddressById200Response.md index 5e9dcb3b..b53f70d2 100644 --- a/equinix_metal/docs/FindIPAddressById200Response.md +++ b/equinix_metal/docs/FindIPAddressById200Response.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **address** | **str** | | [optional] @@ -49,7 +50,7 @@ json = "{}" # create an instance of FindIPAddressById200Response from a JSON string find_ip_address_by_id200_response_instance = FindIPAddressById200Response.from_json(json) # print the JSON string representation of the object -print FindIPAddressById200Response.to_json() +print(FindIPAddressById200Response.to_json()) # convert the object into a dict find_ip_address_by_id200_response_dict = find_ip_address_by_id200_response_instance.to_dict() diff --git a/equinix_metal/docs/FindMetalGatewayById200Response.md b/equinix_metal/docs/FindMetalGatewayById200Response.md index e40e5b5e..79b228b8 100644 --- a/equinix_metal/docs/FindMetalGatewayById200Response.md +++ b/equinix_metal/docs/FindMetalGatewayById200Response.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **created_at** | **datetime** | | [optional] @@ -25,7 +26,7 @@ json = "{}" # create an instance of FindMetalGatewayById200Response from a JSON string find_metal_gateway_by_id200_response_instance = FindMetalGatewayById200Response.from_json(json) # print the JSON string representation of the object -print FindMetalGatewayById200Response.to_json() +print(FindMetalGatewayById200Response.to_json()) # convert the object into a dict find_metal_gateway_by_id200_response_dict = find_metal_gateway_by_id200_response_instance.to_dict() diff --git a/equinix_metal/docs/FindTrafficTimeframeParameter.md b/equinix_metal/docs/FindTrafficTimeframeParameter.md index d8fc744e..91d6623c 100644 --- a/equinix_metal/docs/FindTrafficTimeframeParameter.md +++ b/equinix_metal/docs/FindTrafficTimeframeParameter.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **ended_at** | **datetime** | | @@ -18,7 +19,7 @@ json = "{}" # create an instance of FindTrafficTimeframeParameter from a JSON string find_traffic_timeframe_parameter_instance = FindTrafficTimeframeParameter.from_json(json) # print the JSON string representation of the object -print FindTrafficTimeframeParameter.to_json() +print(FindTrafficTimeframeParameter.to_json()) # convert the object into a dict find_traffic_timeframe_parameter_dict = find_traffic_timeframe_parameter_instance.to_dict() diff --git a/equinix_metal/docs/FirmwareSet.md b/equinix_metal/docs/FirmwareSet.md index 3cdcfe0f..086a32b5 100644 --- a/equinix_metal/docs/FirmwareSet.md +++ b/equinix_metal/docs/FirmwareSet.md @@ -3,6 +3,7 @@ Represents a Firmware Set ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **attributes** | [**List[Attribute]**](Attribute.md) | Represents a list of attributes | [optional] @@ -23,7 +24,7 @@ json = "{}" # create an instance of FirmwareSet from a JSON string firmware_set_instance = FirmwareSet.from_json(json) # print the JSON string representation of the object -print FirmwareSet.to_json() +print(FirmwareSet.to_json()) # convert the object into a dict firmware_set_dict = firmware_set_instance.to_dict() diff --git a/equinix_metal/docs/FirmwareSetListResponse.md b/equinix_metal/docs/FirmwareSetListResponse.md index 8e1c8ceb..78110d18 100644 --- a/equinix_metal/docs/FirmwareSetListResponse.md +++ b/equinix_metal/docs/FirmwareSetListResponse.md @@ -3,6 +3,7 @@ Represents collection of Firmware Sets ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -23,7 +24,7 @@ json = "{}" # create an instance of FirmwareSetListResponse from a JSON string firmware_set_list_response_instance = FirmwareSetListResponse.from_json(json) # print the JSON string representation of the object -print FirmwareSetListResponse.to_json() +print(FirmwareSetListResponse.to_json()) # convert the object into a dict firmware_set_list_response_dict = firmware_set_list_response_instance.to_dict() diff --git a/equinix_metal/docs/FirmwareSetResponse.md b/equinix_metal/docs/FirmwareSetResponse.md index 9a9ed08a..1118a635 100644 --- a/equinix_metal/docs/FirmwareSetResponse.md +++ b/equinix_metal/docs/FirmwareSetResponse.md @@ -3,6 +3,7 @@ Represents single Firmware set response ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -18,7 +19,7 @@ json = "{}" # create an instance of FirmwareSetResponse from a JSON string firmware_set_response_instance = FirmwareSetResponse.from_json(json) # print the JSON string representation of the object -print FirmwareSetResponse.to_json() +print(FirmwareSetResponse.to_json()) # convert the object into a dict firmware_set_response_dict = firmware_set_response_instance.to_dict() diff --git a/equinix_metal/docs/FirmwareSetsApi.md b/equinix_metal/docs/FirmwareSetsApi.md index cb522820..dd6a3050 100644 --- a/equinix_metal/docs/FirmwareSetsApi.md +++ b/equinix_metal/docs/FirmwareSetsApi.md @@ -18,9 +18,8 @@ Returns all firmware sets associated with the organization. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.firmware_set_list_response import FirmwareSetListResponse from equinix_metal.rest import ApiException @@ -64,6 +63,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Organization UUID | @@ -84,6 +84,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | Successful operation | - | @@ -92,7 +93,6 @@ Name | Type | Description | Notes **500** | Internal Server Error | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **get_project_firmware_sets** > FirmwareSetListResponse get_project_firmware_sets(id, page=page, per_page=per_page) @@ -103,9 +103,8 @@ Returns all firmware sets associated with the project or organization. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.firmware_set_list_response import FirmwareSetListResponse from equinix_metal.rest import ApiException @@ -149,6 +148,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Project UUID | @@ -169,6 +169,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | Successful operation | - | @@ -177,4 +178,3 @@ Name | Type | Description | Notes **500** | Internal Server Error | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/GlobalBgpRange.md b/equinix_metal/docs/GlobalBgpRange.md index 80e0dfab..48deec99 100644 --- a/equinix_metal/docs/GlobalBgpRange.md +++ b/equinix_metal/docs/GlobalBgpRange.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **address_family** | **int** | | [optional] @@ -20,7 +21,7 @@ json = "{}" # create an instance of GlobalBgpRange from a JSON string global_bgp_range_instance = GlobalBgpRange.from_json(json) # print the JSON string representation of the object -print GlobalBgpRange.to_json() +print(GlobalBgpRange.to_json()) # convert the object into a dict global_bgp_range_dict = global_bgp_range_instance.to_dict() diff --git a/equinix_metal/docs/GlobalBgpRangeList.md b/equinix_metal/docs/GlobalBgpRangeList.md index 39bf6700..f9c2c8f4 100644 --- a/equinix_metal/docs/GlobalBgpRangeList.md +++ b/equinix_metal/docs/GlobalBgpRangeList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **global_bgp_ranges** | [**List[GlobalBgpRange]**](GlobalBgpRange.md) | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of GlobalBgpRangeList from a JSON string global_bgp_range_list_instance = GlobalBgpRangeList.from_json(json) # print the JSON string representation of the object -print GlobalBgpRangeList.to_json() +print(GlobalBgpRangeList.to_json()) # convert the object into a dict global_bgp_range_list_dict = global_bgp_range_list_instance.to_dict() diff --git a/equinix_metal/docs/HardwareReservation.md b/equinix_metal/docs/HardwareReservation.md index d8b11682..9b57aea0 100644 --- a/equinix_metal/docs/HardwareReservation.md +++ b/equinix_metal/docs/HardwareReservation.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **created_at** | **datetime** | | [optional] @@ -29,7 +30,7 @@ json = "{}" # create an instance of HardwareReservation from a JSON string hardware_reservation_instance = HardwareReservation.from_json(json) # print the JSON string representation of the object -print HardwareReservation.to_json() +print(HardwareReservation.to_json()) # convert the object into a dict hardware_reservation_dict = hardware_reservation_instance.to_dict() diff --git a/equinix_metal/docs/HardwareReservationList.md b/equinix_metal/docs/HardwareReservationList.md index 71268786..1a80d3aa 100644 --- a/equinix_metal/docs/HardwareReservationList.md +++ b/equinix_metal/docs/HardwareReservationList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **hardware_reservations** | [**List[HardwareReservation]**](HardwareReservation.md) | | [optional] @@ -18,7 +19,7 @@ json = "{}" # create an instance of HardwareReservationList from a JSON string hardware_reservation_list_instance = HardwareReservationList.from_json(json) # print the JSON string representation of the object -print HardwareReservationList.to_json() +print(HardwareReservationList.to_json()) # convert the object into a dict hardware_reservation_list_dict = hardware_reservation_list_instance.to_dict() diff --git a/equinix_metal/docs/HardwareReservationsApi.md b/equinix_metal/docs/HardwareReservationsApi.md index d5b0b04e..0f5da2a6 100644 --- a/equinix_metal/docs/HardwareReservationsApi.md +++ b/equinix_metal/docs/HardwareReservationsApi.md @@ -21,9 +21,8 @@ Activate a spare hardware reservation ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.activate_hardware_reservation_request import ActivateHardwareReservationRequest from equinix_metal.models.hardware_reservation import HardwareReservation @@ -69,6 +68,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Hardware Reservation UUID | @@ -90,6 +90,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | ok | - | @@ -98,7 +99,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_hardware_reservation_by_id** > HardwareReservation find_hardware_reservation_by_id(id, include=include, exclude=exclude) @@ -109,9 +109,8 @@ Returns a single hardware reservation ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.hardware_reservation import HardwareReservation from equinix_metal.rest import ApiException @@ -155,6 +154,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| HardwareReservation UUID | @@ -175,6 +175,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -183,7 +184,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_project_hardware_reservations** > HardwareReservationList find_project_hardware_reservations(id, query=query, state=state, provisionable=provisionable, include=include, exclude=exclude, page=page, per_page=per_page) @@ -194,9 +194,8 @@ Provides a collection of hardware reservations for a given project. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.hardware_reservation_list import HardwareReservationList from equinix_metal.rest import ApiException @@ -245,6 +244,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Project UUID | @@ -270,6 +270,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -278,12 +279,9 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_project_hardware_reservations_all_pages** > HardwareReservationList find_project_hardware_reservations_all_pages(id, query=query, state=state, provisionable=provisionable, include=include, exclude=exclude, per_page=per_page) - Just like [**find_project_hardware_reservations**](HardwareReservationsApi.md#find_project_hardware_reservations) but fetches resources from all pages. This method doesn't take `page` parameter. Other parameters, return type and other characteristics are the same as in [**find_project_hardware_reservations**](HardwareReservationsApi.md#find_project_hardware_reservations). - # **move_hardware_reservation** > HardwareReservation move_hardware_reservation(id, move_hardware_reservation_request, include=include, exclude=exclude) @@ -294,9 +292,8 @@ Move a hardware reservation to another project ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.hardware_reservation import HardwareReservation from equinix_metal.models.move_hardware_reservation_request import MoveHardwareReservationRequest @@ -342,6 +339,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Hardware Reservation UUID | @@ -363,6 +361,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | ok | - | @@ -371,4 +370,3 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/Href.md b/equinix_metal/docs/Href.md index f06be6b8..8e15bb1f 100644 --- a/equinix_metal/docs/Href.md +++ b/equinix_metal/docs/Href.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | @@ -16,7 +17,7 @@ json = "{}" # create an instance of Href from a JSON string href_instance = Href.from_json(json) # print the JSON string representation of the object -print Href.to_json() +print(Href.to_json()) # convert the object into a dict href_dict = href_instance.to_dict() diff --git a/equinix_metal/docs/IPAddress.md b/equinix_metal/docs/IPAddress.md index 5a309c74..3801dbda 100644 --- a/equinix_metal/docs/IPAddress.md +++ b/equinix_metal/docs/IPAddress.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **address_family** | **int** | Address Family for IP Address | [optional] @@ -20,7 +21,7 @@ json = "{}" # create an instance of IPAddress from a JSON string ip_address_instance = IPAddress.from_json(json) # print the JSON string representation of the object -print IPAddress.to_json() +print(IPAddress.to_json()) # convert the object into a dict ip_address_dict = ip_address_instance.to_dict() diff --git a/equinix_metal/docs/IPAddressesApi.md b/equinix_metal/docs/IPAddressesApi.md index b7d29a4b..df6dd5ff 100644 --- a/equinix_metal/docs/IPAddressesApi.md +++ b/equinix_metal/docs/IPAddressesApi.md @@ -23,9 +23,8 @@ This call can be used to un-assign an IP assignment or delete an IP reservation. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -64,6 +63,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| IP Address UUID | @@ -82,6 +82,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **204** | no content | - | @@ -90,7 +91,6 @@ void (empty response body) **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_ip_address_by_id** > FindIPAddressById200Response find_ip_address_by_id(id, include=include, exclude=exclude) @@ -101,9 +101,8 @@ Returns a single ip address if the user has access. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.find_ip_address_by_id200_response import FindIPAddressById200Response from equinix_metal.rest import ApiException @@ -147,6 +146,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| IP Address UUID | @@ -167,6 +167,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -175,7 +176,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_ip_address_customdata** > find_ip_address_customdata(id) @@ -186,9 +186,8 @@ Provides the custom metadata stored for this IP Reservation or IP Assignment in ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -227,6 +226,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Ip Reservation UUID | @@ -245,6 +245,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -253,7 +254,6 @@ void (empty response body) **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_ip_availabilities** > IPAvailabilitiesList find_ip_availabilities(id, cidr) @@ -264,9 +264,8 @@ Provides a list of IP resevations for a single project. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.ip_availabilities_list import IPAvailabilitiesList from equinix_metal.rest import ApiException @@ -309,6 +308,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| IP Reservation UUID | @@ -328,6 +328,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -336,7 +337,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_ip_reservations** > IPReservationList find_ip_reservations(id, types=types, include=include, exclude=exclude, per_page=per_page) @@ -347,9 +347,8 @@ Provides a paginated list of IP reservations for a single project. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.ip_reservation_list import IPReservationList from equinix_metal.rest import ApiException @@ -395,6 +394,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Project UUID | @@ -417,6 +417,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -425,7 +426,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **request_ip_reservation** > RequestIPReservation201Response request_ip_reservation(id, request_ip_reservation_request, include=include, exclude=exclude) @@ -436,9 +436,8 @@ Request more IP space for a project in order to have additional IP addresses to ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.request_ip_reservation201_response import RequestIPReservation201Response from equinix_metal.models.request_ip_reservation_request import RequestIPReservationRequest @@ -484,6 +483,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Project UUID | @@ -505,6 +505,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | created | - | @@ -514,7 +515,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **update_ip_address** > FindIPAddressById200Response update_ip_address(id, include=include, exclude=exclude, ip_assignment_update_input=ip_assignment_update_input) @@ -525,9 +525,8 @@ Update details about an ip address ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.find_ip_address_by_id200_response import FindIPAddressById200Response from equinix_metal.models.ip_assignment_update_input import IPAssignmentUpdateInput @@ -573,6 +572,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| IP Address UUID | @@ -594,6 +594,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -602,4 +603,3 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/IPAssignment.md b/equinix_metal/docs/IPAssignment.md index 73d57117..098df999 100644 --- a/equinix_metal/docs/IPAssignment.md +++ b/equinix_metal/docs/IPAssignment.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **address** | **str** | | [optional] @@ -34,7 +35,7 @@ json = "{}" # create an instance of IPAssignment from a JSON string ip_assignment_instance = IPAssignment.from_json(json) # print the JSON string representation of the object -print IPAssignment.to_json() +print(IPAssignment.to_json()) # convert the object into a dict ip_assignment_dict = ip_assignment_instance.to_dict() diff --git a/equinix_metal/docs/IPAssignmentInput.md b/equinix_metal/docs/IPAssignmentInput.md index 66921cb4..a7cd24f6 100644 --- a/equinix_metal/docs/IPAssignmentInput.md +++ b/equinix_metal/docs/IPAssignmentInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **address** | **str** | | @@ -18,7 +19,7 @@ json = "{}" # create an instance of IPAssignmentInput from a JSON string ip_assignment_input_instance = IPAssignmentInput.from_json(json) # print the JSON string representation of the object -print IPAssignmentInput.to_json() +print(IPAssignmentInput.to_json()) # convert the object into a dict ip_assignment_input_dict = ip_assignment_input_instance.to_dict() diff --git a/equinix_metal/docs/IPAssignmentList.md b/equinix_metal/docs/IPAssignmentList.md index 8e377256..25c87d46 100644 --- a/equinix_metal/docs/IPAssignmentList.md +++ b/equinix_metal/docs/IPAssignmentList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of IPAssignmentList from a JSON string ip_assignment_list_instance = IPAssignmentList.from_json(json) # print the JSON string representation of the object -print IPAssignmentList.to_json() +print(IPAssignmentList.to_json()) # convert the object into a dict ip_assignment_list_dict = ip_assignment_list_instance.to_dict() diff --git a/equinix_metal/docs/IPAssignmentMetro.md b/equinix_metal/docs/IPAssignmentMetro.md index 4d970e36..27858843 100644 --- a/equinix_metal/docs/IPAssignmentMetro.md +++ b/equinix_metal/docs/IPAssignmentMetro.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **code** | **str** | | [optional] @@ -20,7 +21,7 @@ json = "{}" # create an instance of IPAssignmentMetro from a JSON string ip_assignment_metro_instance = IPAssignmentMetro.from_json(json) # print the JSON string representation of the object -print IPAssignmentMetro.to_json() +print(IPAssignmentMetro.to_json()) # convert the object into a dict ip_assignment_metro_dict = ip_assignment_metro_instance.to_dict() diff --git a/equinix_metal/docs/IPAssignmentUpdateInput.md b/equinix_metal/docs/IPAssignmentUpdateInput.md index f7ae190a..50f6156f 100644 --- a/equinix_metal/docs/IPAssignmentUpdateInput.md +++ b/equinix_metal/docs/IPAssignmentUpdateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **customdata** | **object** | | [optional] @@ -19,7 +20,7 @@ json = "{}" # create an instance of IPAssignmentUpdateInput from a JSON string ip_assignment_update_input_instance = IPAssignmentUpdateInput.from_json(json) # print the JSON string representation of the object -print IPAssignmentUpdateInput.to_json() +print(IPAssignmentUpdateInput.to_json()) # convert the object into a dict ip_assignment_update_input_dict = ip_assignment_update_input_instance.to_dict() diff --git a/equinix_metal/docs/IPAvailabilitiesList.md b/equinix_metal/docs/IPAvailabilitiesList.md index 52588e5e..d4580c12 100644 --- a/equinix_metal/docs/IPAvailabilitiesList.md +++ b/equinix_metal/docs/IPAvailabilitiesList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **available** | **List[str]** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of IPAvailabilitiesList from a JSON string ip_availabilities_list_instance = IPAvailabilitiesList.from_json(json) # print the JSON string representation of the object -print IPAvailabilitiesList.to_json() +print(IPAvailabilitiesList.to_json()) # convert the object into a dict ip_availabilities_list_dict = ip_availabilities_list_instance.to_dict() diff --git a/equinix_metal/docs/IPReservation.md b/equinix_metal/docs/IPReservation.md index 1a2cd261..f3ae3d85 100644 --- a/equinix_metal/docs/IPReservation.md +++ b/equinix_metal/docs/IPReservation.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **addon** | **bool** | | [optional] @@ -44,7 +45,7 @@ json = "{}" # create an instance of IPReservation from a JSON string ip_reservation_instance = IPReservation.from_json(json) # print the JSON string representation of the object -print IPReservation.to_json() +print(IPReservation.to_json()) # convert the object into a dict ip_reservation_dict = ip_reservation_instance.to_dict() diff --git a/equinix_metal/docs/IPReservationFacility.md b/equinix_metal/docs/IPReservationFacility.md index 7d3d938f..135a018f 100644 --- a/equinix_metal/docs/IPReservationFacility.md +++ b/equinix_metal/docs/IPReservationFacility.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **address** | [**Address**](Address.md) | | [optional] @@ -23,7 +24,7 @@ json = "{}" # create an instance of IPReservationFacility from a JSON string ip_reservation_facility_instance = IPReservationFacility.from_json(json) # print the JSON string representation of the object -print IPReservationFacility.to_json() +print(IPReservationFacility.to_json()) # convert the object into a dict ip_reservation_facility_dict = ip_reservation_facility_instance.to_dict() diff --git a/equinix_metal/docs/IPReservationList.md b/equinix_metal/docs/IPReservationList.md index 46adcfd9..3579e289 100644 --- a/equinix_metal/docs/IPReservationList.md +++ b/equinix_metal/docs/IPReservationList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -18,7 +19,7 @@ json = "{}" # create an instance of IPReservationList from a JSON string ip_reservation_list_instance = IPReservationList.from_json(json) # print the JSON string representation of the object -print IPReservationList.to_json() +print(IPReservationList.to_json()) # convert the object into a dict ip_reservation_list_dict = ip_reservation_list_instance.to_dict() diff --git a/equinix_metal/docs/IPReservationListIpAddressesInner.md b/equinix_metal/docs/IPReservationListIpAddressesInner.md index 0b7be896..54e2176f 100644 --- a/equinix_metal/docs/IPReservationListIpAddressesInner.md +++ b/equinix_metal/docs/IPReservationListIpAddressesInner.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **addon** | **bool** | | [optional] @@ -46,7 +47,7 @@ json = "{}" # create an instance of IPReservationListIpAddressesInner from a JSON string ip_reservation_list_ip_addresses_inner_instance = IPReservationListIpAddressesInner.from_json(json) # print the JSON string representation of the object -print IPReservationListIpAddressesInner.to_json() +print(IPReservationListIpAddressesInner.to_json()) # convert the object into a dict ip_reservation_list_ip_addresses_inner_dict = ip_reservation_list_ip_addresses_inner_instance.to_dict() diff --git a/equinix_metal/docs/IPReservationMetro.md b/equinix_metal/docs/IPReservationMetro.md index 28498ab0..ee3565b7 100644 --- a/equinix_metal/docs/IPReservationMetro.md +++ b/equinix_metal/docs/IPReservationMetro.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **code** | **str** | | [optional] @@ -20,7 +21,7 @@ json = "{}" # create an instance of IPReservationMetro from a JSON string ip_reservation_metro_instance = IPReservationMetro.from_json(json) # print the JSON string representation of the object -print IPReservationMetro.to_json() +print(IPReservationMetro.to_json()) # convert the object into a dict ip_reservation_metro_dict = ip_reservation_metro_instance.to_dict() diff --git a/equinix_metal/docs/IPReservationRequestInput.md b/equinix_metal/docs/IPReservationRequestInput.md index 9334ae18..3e781d9c 100644 --- a/equinix_metal/docs/IPReservationRequestInput.md +++ b/equinix_metal/docs/IPReservationRequestInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **comments** | **str** | | [optional] @@ -25,7 +26,7 @@ json = "{}" # create an instance of IPReservationRequestInput from a JSON string ip_reservation_request_input_instance = IPReservationRequestInput.from_json(json) # print the JSON string representation of the object -print IPReservationRequestInput.to_json() +print(IPReservationRequestInput.to_json()) # convert the object into a dict ip_reservation_request_input_dict = ip_reservation_request_input_instance.to_dict() diff --git a/equinix_metal/docs/IncidentsApi.md b/equinix_metal/docs/IncidentsApi.md index ac468494..d12f4854 100644 --- a/equinix_metal/docs/IncidentsApi.md +++ b/equinix_metal/docs/IncidentsApi.md @@ -17,9 +17,8 @@ Retrieve the number of incidents. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -59,6 +58,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **include** | [**List[str]**](str.md)| Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. | [optional] @@ -78,10 +78,10 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | **401** | unauthorized | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/InstancesBatchCreateInput.md b/equinix_metal/docs/InstancesBatchCreateInput.md index 9c40f24a..83aaa006 100644 --- a/equinix_metal/docs/InstancesBatchCreateInput.md +++ b/equinix_metal/docs/InstancesBatchCreateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **batches** | [**List[InstancesBatchCreateInputBatchesInner]**](InstancesBatchCreateInputBatchesInner.md) | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of InstancesBatchCreateInput from a JSON string instances_batch_create_input_instance = InstancesBatchCreateInput.from_json(json) # print the JSON string representation of the object -print InstancesBatchCreateInput.to_json() +print(InstancesBatchCreateInput.to_json()) # convert the object into a dict instances_batch_create_input_dict = instances_batch_create_input_instance.to_dict() diff --git a/equinix_metal/docs/InstancesBatchCreateInputBatchesInner.md b/equinix_metal/docs/InstancesBatchCreateInputBatchesInner.md index 9203bd1a..2a9288e1 100644 --- a/equinix_metal/docs/InstancesBatchCreateInputBatchesInner.md +++ b/equinix_metal/docs/InstancesBatchCreateInputBatchesInner.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **hostnames** | **List[str]** | | [optional] @@ -45,7 +46,7 @@ json = "{}" # create an instance of InstancesBatchCreateInputBatchesInner from a JSON string instances_batch_create_input_batches_inner_instance = InstancesBatchCreateInputBatchesInner.from_json(json) # print the JSON string representation of the object -print InstancesBatchCreateInputBatchesInner.to_json() +print(InstancesBatchCreateInputBatchesInner.to_json()) # convert the object into a dict instances_batch_create_input_batches_inner_dict = instances_batch_create_input_batches_inner_instance.to_dict() diff --git a/equinix_metal/docs/Interconnection.md b/equinix_metal/docs/Interconnection.md index a3e1ed06..d3b950ce 100644 --- a/equinix_metal/docs/Interconnection.md +++ b/equinix_metal/docs/Interconnection.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **authorization_code** | **str** | For Fabric VCs (Metal Billed), this allows Fabric to connect the Metal network to any connection Fabric facilitates. Fabric uses this token to be able to give more detailed information about the Metal end of the network, when viewing resources from within Fabric. | [optional] @@ -11,7 +12,7 @@ Name | Type | Description | Notes **facility** | [**Href**](Href.md) | | [optional] **href** | **str** | | [optional] **id** | **str** | | [optional] -**metro** | [**Metro**](Metro.md) | | [optional] +**metro** | [**Metro**](Metro.md) | The location of where the shared or Dedicated Port is located. For interconnections with Dedicated Ports, this will be the location of the Dedicated Ports. For Fabric VCs (Metal Billed), this is where interconnection will be originating from, as we pre-authorize the use of one of our shared ports as the origin of the interconnection using A-Side service tokens. We only allow local connections for Fabric VCs (Metal Billed), so the destination location must be the same as the origin. For Fabric VCs (Fabric Billed), this will be the destination of the interconnection. We allow remote connections for Fabric VCs (Fabric Billed), so the origin of the interconnection can be a different metro set here. | [optional] **mode** | **str** | The mode of the interconnection (only relevant to Dedicated Ports). Shared connections won't have this field. Can be either 'standard' or 'tunnel'. The default mode of an interconnection on a Dedicated Port is 'standard'. The mode can only be changed when there are no associated virtual circuits on the interconnection. In tunnel mode, an 802.1q tunnel is added to a port to send/receive double tagged packets from server instances. | [optional] **name** | **str** | | [optional] **organization** | [**Href**](Href.md) | | [optional] @@ -36,7 +37,7 @@ json = "{}" # create an instance of Interconnection from a JSON string interconnection_instance = Interconnection.from_json(json) # print the JSON string representation of the object -print Interconnection.to_json() +print(Interconnection.to_json()) # convert the object into a dict interconnection_dict = interconnection_instance.to_dict() diff --git a/equinix_metal/docs/InterconnectionList.md b/equinix_metal/docs/InterconnectionList.md index 1edcff57..81c09b64 100644 --- a/equinix_metal/docs/InterconnectionList.md +++ b/equinix_metal/docs/InterconnectionList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -18,7 +19,7 @@ json = "{}" # create an instance of InterconnectionList from a JSON string interconnection_list_instance = InterconnectionList.from_json(json) # print the JSON string representation of the object -print InterconnectionList.to_json() +print(InterconnectionList.to_json()) # convert the object into a dict interconnection_list_dict = interconnection_list_instance.to_dict() diff --git a/equinix_metal/docs/InterconnectionMetroList.md b/equinix_metal/docs/InterconnectionMetroList.md index 0f51e9ca..b57b63ee 100644 --- a/equinix_metal/docs/InterconnectionMetroList.md +++ b/equinix_metal/docs/InterconnectionMetroList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -18,7 +19,7 @@ json = "{}" # create an instance of InterconnectionMetroList from a JSON string interconnection_metro_list_instance = InterconnectionMetroList.from_json(json) # print the JSON string representation of the object -print InterconnectionMetroList.to_json() +print(InterconnectionMetroList.to_json()) # convert the object into a dict interconnection_metro_list_dict = interconnection_metro_list_instance.to_dict() diff --git a/equinix_metal/docs/InterconnectionMetroListMetrosInner.md b/equinix_metal/docs/InterconnectionMetroListMetrosInner.md index 8afe1161..4de3c5c8 100644 --- a/equinix_metal/docs/InterconnectionMetroListMetrosInner.md +++ b/equinix_metal/docs/InterconnectionMetroListMetrosInner.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **code** | **str** | | [optional] @@ -21,7 +22,7 @@ json = "{}" # create an instance of InterconnectionMetroListMetrosInner from a JSON string interconnection_metro_list_metros_inner_instance = InterconnectionMetroListMetrosInner.from_json(json) # print the JSON string representation of the object -print InterconnectionMetroListMetrosInner.to_json() +print(InterconnectionMetroListMetrosInner.to_json()) # convert the object into a dict interconnection_metro_list_metros_inner_dict = interconnection_metro_list_metros_inner_instance.to_dict() diff --git a/equinix_metal/docs/InterconnectionMetroListMetrosInnerAllOfProvidersInner.md b/equinix_metal/docs/InterconnectionMetroListMetrosInnerAllOfProvidersInner.md index ba2f843d..9a6bf78a 100644 --- a/equinix_metal/docs/InterconnectionMetroListMetrosInnerAllOfProvidersInner.md +++ b/equinix_metal/docs/InterconnectionMetroListMetrosInnerAllOfProvidersInner.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -19,7 +20,7 @@ json = "{}" # create an instance of InterconnectionMetroListMetrosInnerAllOfProvidersInner from a JSON string interconnection_metro_list_metros_inner_all_of_providers_inner_instance = InterconnectionMetroListMetrosInnerAllOfProvidersInner.from_json(json) # print the JSON string representation of the object -print InterconnectionMetroListMetrosInnerAllOfProvidersInner.to_json() +print(InterconnectionMetroListMetrosInnerAllOfProvidersInner.to_json()) # convert the object into a dict interconnection_metro_list_metros_inner_all_of_providers_inner_dict = interconnection_metro_list_metros_inner_all_of_providers_inner_instance.to_dict() diff --git a/equinix_metal/docs/InterconnectionPort.md b/equinix_metal/docs/InterconnectionPort.md index 86de4769..994f04aa 100644 --- a/equinix_metal/docs/InterconnectionPort.md +++ b/equinix_metal/docs/InterconnectionPort.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -25,7 +26,7 @@ json = "{}" # create an instance of InterconnectionPort from a JSON string interconnection_port_instance = InterconnectionPort.from_json(json) # print the JSON string representation of the object -print InterconnectionPort.to_json() +print(InterconnectionPort.to_json()) # convert the object into a dict interconnection_port_dict = interconnection_port_instance.to_dict() diff --git a/equinix_metal/docs/InterconnectionPortList.md b/equinix_metal/docs/InterconnectionPortList.md index 2fcd3a94..15d90961 100644 --- a/equinix_metal/docs/InterconnectionPortList.md +++ b/equinix_metal/docs/InterconnectionPortList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of InterconnectionPortList from a JSON string interconnection_port_list_instance = InterconnectionPortList.from_json(json) # print the JSON string representation of the object -print InterconnectionPortList.to_json() +print(InterconnectionPortList.to_json()) # convert the object into a dict interconnection_port_list_dict = interconnection_port_list_instance.to_dict() diff --git a/equinix_metal/docs/InterconnectionPricingList.md b/equinix_metal/docs/InterconnectionPricingList.md index 5876dc97..8fe053ec 100644 --- a/equinix_metal/docs/InterconnectionPricingList.md +++ b/equinix_metal/docs/InterconnectionPricingList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of InterconnectionPricingList from a JSON string interconnection_pricing_list_instance = InterconnectionPricingList.from_json(json) # print the JSON string representation of the object -print InterconnectionPricingList.to_json() +print(InterconnectionPricingList.to_json()) # convert the object into a dict interconnection_pricing_list_dict = interconnection_pricing_list_instance.to_dict() diff --git a/equinix_metal/docs/InterconnectionPricingListProviderPricingInner.md b/equinix_metal/docs/InterconnectionPricingListProviderPricingInner.md index 7f546050..86428f95 100644 --- a/equinix_metal/docs/InterconnectionPricingListProviderPricingInner.md +++ b/equinix_metal/docs/InterconnectionPricingListProviderPricingInner.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -18,7 +19,7 @@ json = "{}" # create an instance of InterconnectionPricingListProviderPricingInner from a JSON string interconnection_pricing_list_provider_pricing_inner_instance = InterconnectionPricingListProviderPricingInner.from_json(json) # print the JSON string representation of the object -print InterconnectionPricingListProviderPricingInner.to_json() +print(InterconnectionPricingListProviderPricingInner.to_json()) # convert the object into a dict interconnection_pricing_list_provider_pricing_inner_dict = interconnection_pricing_list_provider_pricing_inner_instance.to_dict() diff --git a/equinix_metal/docs/InterconnectionPricingListProviderPricingInnerTiersInner.md b/equinix_metal/docs/InterconnectionPricingListProviderPricingInnerTiersInner.md index 5ebc9098..595743b3 100644 --- a/equinix_metal/docs/InterconnectionPricingListProviderPricingInnerTiersInner.md +++ b/equinix_metal/docs/InterconnectionPricingListProviderPricingInnerTiersInner.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **bandwidth** | **int** | Bandwidth tier in Mbps | [optional] @@ -19,7 +20,7 @@ json = "{}" # create an instance of InterconnectionPricingListProviderPricingInnerTiersInner from a JSON string interconnection_pricing_list_provider_pricing_inner_tiers_inner_instance = InterconnectionPricingListProviderPricingInnerTiersInner.from_json(json) # print the JSON string representation of the object -print InterconnectionPricingListProviderPricingInnerTiersInner.to_json() +print(InterconnectionPricingListProviderPricingInnerTiersInner.to_json()) # convert the object into a dict interconnection_pricing_list_provider_pricing_inner_tiers_inner_dict = interconnection_pricing_list_provider_pricing_inner_tiers_inner_instance.to_dict() diff --git a/equinix_metal/docs/InterconnectionUpdateInput.md b/equinix_metal/docs/InterconnectionUpdateInput.md index 66aba220..6de42efc 100644 --- a/equinix_metal/docs/InterconnectionUpdateInput.md +++ b/equinix_metal/docs/InterconnectionUpdateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **contact_email** | **str** | | [optional] @@ -21,7 +22,7 @@ json = "{}" # create an instance of InterconnectionUpdateInput from a JSON string interconnection_update_input_instance = InterconnectionUpdateInput.from_json(json) # print the JSON string representation of the object -print InterconnectionUpdateInput.to_json() +print(InterconnectionUpdateInput.to_json()) # convert the object into a dict interconnection_update_input_dict = interconnection_update_input_instance.to_dict() diff --git a/equinix_metal/docs/InterconnectionsApi.md b/equinix_metal/docs/InterconnectionsApi.md index de5f1366..eb894277 100644 --- a/equinix_metal/docs/InterconnectionsApi.md +++ b/equinix_metal/docs/InterconnectionsApi.md @@ -34,9 +34,8 @@ Create a new Virtual Circuit on a Dedicated Port. To create a regular Virtual Ci ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.virtual_circuit import VirtualCircuit from equinix_metal.models.virtual_circuit_create_input import VirtualCircuitCreateInput @@ -81,6 +80,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **connection_id** | **str**| UUID of the interconnection | @@ -101,6 +101,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | ok | - | @@ -108,7 +109,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **create_organization_interconnection** > Interconnection create_organization_interconnection(organization_id, create_organization_interconnection_request, include=include, exclude=exclude) @@ -119,9 +119,8 @@ Creates a new interconnection request. A Project ID must be specified in the req ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.create_organization_interconnection_request import CreateOrganizationInterconnectionRequest from equinix_metal.models.interconnection import Interconnection @@ -167,6 +166,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **organization_id** | **str**| UUID of the organization | @@ -188,6 +188,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | created | - | @@ -196,7 +197,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **create_project_interconnection** > Interconnection create_project_interconnection(project_id, create_organization_interconnection_request, include=include, exclude=exclude) @@ -207,9 +207,8 @@ Creates a new interconnection request ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.create_organization_interconnection_request import CreateOrganizationInterconnectionRequest from equinix_metal.models.interconnection import Interconnection @@ -255,6 +254,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **project_id** | **str**| UUID of the project | @@ -276,6 +276,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | created | - | @@ -283,7 +284,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **delete_interconnection** > Interconnection delete_interconnection(connection_id, include=include, exclude=exclude) @@ -294,9 +294,8 @@ Delete a interconnection, its associated ports and virtual circuits. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.interconnection import Interconnection from equinix_metal.rest import ApiException @@ -340,6 +339,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **connection_id** | **str**| Interconnection UUID | @@ -360,6 +360,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **202** | accepted | - | @@ -367,7 +368,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **delete_virtual_circuit** > VirtualCircuit delete_virtual_circuit(id, include=include, exclude=exclude) @@ -378,9 +378,8 @@ Delete a virtual circuit from a Dedicated Port. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.virtual_circuit import VirtualCircuit from equinix_metal.rest import ApiException @@ -424,6 +423,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Virtual Circuit UUID | @@ -444,6 +444,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **202** | accepted | - | @@ -451,7 +452,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **get_interconnection** > Interconnection get_interconnection(connection_id, include=include, exclude=exclude) @@ -462,9 +462,8 @@ Get the details of a interconnection ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.interconnection import Interconnection from equinix_metal.rest import ApiException @@ -508,6 +507,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **connection_id** | **str**| Interconnection UUID | @@ -528,6 +528,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -535,7 +536,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **get_interconnection_metros** > InterconnectionMetroList get_interconnection_metros() @@ -546,9 +546,8 @@ Displays which providers you can connect to directly from Equinix Metal Metros. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.interconnection_metro_list import InterconnectionMetroList from equinix_metal.rest import ApiException @@ -588,6 +587,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + This endpoint does not need any parameter. ### Return type @@ -604,6 +604,7 @@ This endpoint does not need any parameter. - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -611,7 +612,6 @@ This endpoint does not need any parameter. **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **get_interconnection_port** > InterconnectionPort get_interconnection_port(connection_id, id, include=include, exclude=exclude) @@ -622,9 +622,8 @@ Get the details of an interconnection port. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.interconnection_port import InterconnectionPort from equinix_metal.rest import ApiException @@ -669,6 +668,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **connection_id** | **str**| UUID of the interconnection | @@ -690,6 +690,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -697,7 +698,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **get_interconnection_pricing** > InterconnectionPricingList get_interconnection_pricing() @@ -708,9 +708,8 @@ Displays pricing information for connecting to networks outside of Equinix. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.interconnection_pricing_list import InterconnectionPricingList from equinix_metal.rest import ApiException @@ -750,6 +749,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + This endpoint does not need any parameter. ### Return type @@ -766,6 +766,7 @@ This endpoint does not need any parameter. - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -773,7 +774,6 @@ This endpoint does not need any parameter. **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **get_virtual_circuit** > VirtualCircuit get_virtual_circuit(id, include=include, exclude=exclude) @@ -784,9 +784,8 @@ Get the details of a virtual circuit ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.virtual_circuit import VirtualCircuit from equinix_metal.rest import ApiException @@ -830,6 +829,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Virtual Circuit UUID | @@ -850,6 +850,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -857,7 +858,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **list_interconnection_port_virtual_circuits** > VirtualCircuitList list_interconnection_port_virtual_circuits(connection_id, port_id, include=include, exclude=exclude) @@ -868,9 +868,8 @@ List the virtual circuit record(s) associatiated with a particular interconnecti ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.virtual_circuit_list import VirtualCircuitList from equinix_metal.rest import ApiException @@ -915,6 +914,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **connection_id** | **str**| UUID of the interconnection | @@ -936,6 +936,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -943,7 +944,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **list_interconnection_ports** > InterconnectionPortList list_interconnection_ports(connection_id) @@ -954,9 +954,8 @@ List the ports associated to an interconnection. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.interconnection_port_list import InterconnectionPortList from equinix_metal.rest import ApiException @@ -998,6 +997,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **connection_id** | **str**| UUID of the interconnection | @@ -1016,6 +1016,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -1023,7 +1024,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **list_interconnection_virtual_circuits** > VirtualCircuitList list_interconnection_virtual_circuits(connection_id) @@ -1034,9 +1034,8 @@ List the virtual circuit record(s) associated with a particular interconnection ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.virtual_circuit_list import VirtualCircuitList from equinix_metal.rest import ApiException @@ -1078,6 +1077,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **connection_id** | **str**| UUID of the interconnection | @@ -1096,6 +1096,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -1103,7 +1104,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **organization_list_interconnections** > InterconnectionList organization_list_interconnections(organization_id, include=include, exclude=exclude) @@ -1114,9 +1114,8 @@ List the connections belonging to the organization ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.interconnection_list import InterconnectionList from equinix_metal.rest import ApiException @@ -1160,6 +1159,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **organization_id** | **str**| UUID of the organization | @@ -1180,6 +1180,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -1187,7 +1188,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **project_list_interconnections** > InterconnectionList project_list_interconnections(project_id, include=include, exclude=exclude, page=page, per_page=per_page) @@ -1198,9 +1198,8 @@ List the connections belonging to the project ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.interconnection_list import InterconnectionList from equinix_metal.rest import ApiException @@ -1246,6 +1245,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **project_id** | **str**| UUID of the project | @@ -1268,6 +1268,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -1275,12 +1276,9 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **project_list_interconnections_all_pages** > InterconnectionList project_list_interconnections_all_pages(project_id, include=include, exclude=exclude, per_page=per_page) - Just like [**project_list_interconnections**](InterconnectionsApi.md#project_list_interconnections) but fetches resources from all pages. This method doesn't take `page` parameter. Other parameters, return type and other characteristics are the same as in [**project_list_interconnections**](InterconnectionsApi.md#project_list_interconnections). - # **update_interconnection** > Interconnection update_interconnection(connection_id, interconnection_update_input, include=include, exclude=exclude) @@ -1291,9 +1289,8 @@ Update the details of a interconnection ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.interconnection import Interconnection from equinix_metal.models.interconnection_update_input import InterconnectionUpdateInput @@ -1339,6 +1336,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **connection_id** | **str**| Interconnection UUID | @@ -1360,6 +1358,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -1367,7 +1366,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **update_virtual_circuit** > VirtualCircuit update_virtual_circuit(id, virtual_circuit_update_input, include=include, exclude=exclude) @@ -1378,9 +1376,8 @@ Update the details of a virtual circuit. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.virtual_circuit import VirtualCircuit from equinix_metal.models.virtual_circuit_update_input import VirtualCircuitUpdateInput @@ -1426,6 +1423,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Virtual Circuit UUID | @@ -1447,6 +1445,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -1455,4 +1454,3 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/Invitation.md b/equinix_metal/docs/Invitation.md index 0b1ae674..c3f0fea4 100644 --- a/equinix_metal/docs/Invitation.md +++ b/equinix_metal/docs/Invitation.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **created_at** | **datetime** | | [optional] @@ -26,7 +27,7 @@ json = "{}" # create an instance of Invitation from a JSON string invitation_instance = Invitation.from_json(json) # print the JSON string representation of the object -print Invitation.to_json() +print(Invitation.to_json()) # convert the object into a dict invitation_dict = invitation_instance.to_dict() diff --git a/equinix_metal/docs/InvitationInput.md b/equinix_metal/docs/InvitationInput.md index c9893bb6..834941ed 100644 --- a/equinix_metal/docs/InvitationInput.md +++ b/equinix_metal/docs/InvitationInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -21,7 +22,7 @@ json = "{}" # create an instance of InvitationInput from a JSON string invitation_input_instance = InvitationInput.from_json(json) # print the JSON string representation of the object -print InvitationInput.to_json() +print(InvitationInput.to_json()) # convert the object into a dict invitation_input_dict = invitation_input_instance.to_dict() diff --git a/equinix_metal/docs/InvitationList.md b/equinix_metal/docs/InvitationList.md index 7c6634fc..12511cc9 100644 --- a/equinix_metal/docs/InvitationList.md +++ b/equinix_metal/docs/InvitationList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of InvitationList from a JSON string invitation_list_instance = InvitationList.from_json(json) # print the JSON string representation of the object -print InvitationList.to_json() +print(InvitationList.to_json()) # convert the object into a dict invitation_list_dict = invitation_list_instance.to_dict() diff --git a/equinix_metal/docs/InvitationsApi.md b/equinix_metal/docs/InvitationsApi.md index 6c4e8c27..58c8b02f 100644 --- a/equinix_metal/docs/InvitationsApi.md +++ b/equinix_metal/docs/InvitationsApi.md @@ -19,9 +19,8 @@ Accept an invitation. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.membership import Membership from equinix_metal.rest import ApiException @@ -64,6 +63,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Invitation UUID | @@ -83,6 +83,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -91,7 +92,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **decline_invitation** > decline_invitation(id) @@ -102,9 +102,8 @@ Decline an invitation. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -143,6 +142,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Invitation UUID | @@ -161,6 +161,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **204** | no content | - | @@ -169,7 +170,6 @@ void (empty response body) **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_invitation_by_id** > Invitation find_invitation_by_id(id, include=include) @@ -180,9 +180,8 @@ Returns a single invitation. (It include the `invitable` to maintain backward co ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.invitation import Invitation from equinix_metal.rest import ApiException @@ -225,6 +224,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Invitation UUID | @@ -244,6 +244,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -252,4 +253,3 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/Invoice.md b/equinix_metal/docs/Invoice.md index 1c25b774..f772d86a 100644 --- a/equinix_metal/docs/Invoice.md +++ b/equinix_metal/docs/Invoice.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **amount** | **float** | | [optional] @@ -30,7 +31,7 @@ json = "{}" # create an instance of Invoice from a JSON string invoice_instance = Invoice.from_json(json) # print the JSON string representation of the object -print Invoice.to_json() +print(Invoice.to_json()) # convert the object into a dict invoice_dict = invoice_instance.to_dict() diff --git a/equinix_metal/docs/InvoiceList.md b/equinix_metal/docs/InvoiceList.md index 19aaff74..e051a285 100644 --- a/equinix_metal/docs/InvoiceList.md +++ b/equinix_metal/docs/InvoiceList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of InvoiceList from a JSON string invoice_list_instance = InvoiceList.from_json(json) # print the JSON string representation of the object -print InvoiceList.to_json() +print(InvoiceList.to_json()) # convert the object into a dict invoice_list_dict = invoice_list_instance.to_dict() diff --git a/equinix_metal/docs/InvoicesApi.md b/equinix_metal/docs/InvoicesApi.md index c3b9ed12..7195d880 100644 --- a/equinix_metal/docs/InvoicesApi.md +++ b/equinix_metal/docs/InvoicesApi.md @@ -18,9 +18,8 @@ Returns all invoices for an organization ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.invoice_list import InvoiceList from equinix_metal.rest import ApiException @@ -65,6 +64,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Organization UUID | @@ -86,6 +86,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -93,7 +94,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **get_invoice_by_id** > Invoice get_invoice_by_id(id) @@ -104,9 +104,8 @@ Returns the invoice identified by the provided id ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.invoice import Invoice from equinix_metal.rest import ApiException @@ -148,6 +147,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Invoice UUID | @@ -166,6 +166,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -173,4 +174,3 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/License.md b/equinix_metal/docs/License.md index ccd75be6..bbf1fed0 100644 --- a/equinix_metal/docs/License.md +++ b/equinix_metal/docs/License.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **description** | **str** | | [optional] @@ -22,7 +23,7 @@ json = "{}" # create an instance of License from a JSON string license_instance = License.from_json(json) # print the JSON string representation of the object -print License.to_json() +print(License.to_json()) # convert the object into a dict license_dict = license_instance.to_dict() diff --git a/equinix_metal/docs/LicenseCreateInput.md b/equinix_metal/docs/LicenseCreateInput.md index 41afd3af..b24790c5 100644 --- a/equinix_metal/docs/LicenseCreateInput.md +++ b/equinix_metal/docs/LicenseCreateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **description** | **str** | | [optional] @@ -19,7 +20,7 @@ json = "{}" # create an instance of LicenseCreateInput from a JSON string license_create_input_instance = LicenseCreateInput.from_json(json) # print the JSON string representation of the object -print LicenseCreateInput.to_json() +print(LicenseCreateInput.to_json()) # convert the object into a dict license_create_input_dict = license_create_input_instance.to_dict() diff --git a/equinix_metal/docs/LicenseList.md b/equinix_metal/docs/LicenseList.md index a90c8269..c09ed7e3 100644 --- a/equinix_metal/docs/LicenseList.md +++ b/equinix_metal/docs/LicenseList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of LicenseList from a JSON string license_list_instance = LicenseList.from_json(json) # print the JSON string representation of the object -print LicenseList.to_json() +print(LicenseList.to_json()) # convert the object into a dict license_list_dict = license_list_instance.to_dict() diff --git a/equinix_metal/docs/LicenseUpdateInput.md b/equinix_metal/docs/LicenseUpdateInput.md index 9676efea..532664d5 100644 --- a/equinix_metal/docs/LicenseUpdateInput.md +++ b/equinix_metal/docs/LicenseUpdateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **description** | **str** | | [optional] @@ -18,7 +19,7 @@ json = "{}" # create an instance of LicenseUpdateInput from a JSON string license_update_input_instance = LicenseUpdateInput.from_json(json) # print the JSON string representation of the object -print LicenseUpdateInput.to_json() +print(LicenseUpdateInput.to_json()) # convert the object into a dict license_update_input_dict = license_update_input_instance.to_dict() diff --git a/equinix_metal/docs/LicensesApi.md b/equinix_metal/docs/LicensesApi.md index 305c20f6..714e9110 100644 --- a/equinix_metal/docs/LicensesApi.md +++ b/equinix_metal/docs/LicensesApi.md @@ -21,9 +21,8 @@ Creates a new license for the given project ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.license import License from equinix_metal.models.license_create_input import LicenseCreateInput @@ -69,6 +68,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Project UUID | @@ -90,6 +90,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | created | - | @@ -99,7 +100,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **delete_license** > delete_license(id) @@ -110,9 +110,8 @@ Deletes a license. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -151,6 +150,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| License UUID | @@ -169,6 +169,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **204** | no content | - | @@ -177,7 +178,6 @@ void (empty response body) **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_license_by_id** > License find_license_by_id(id, include=include, exclude=exclude) @@ -188,9 +188,8 @@ Returns a license ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.license import License from equinix_metal.rest import ApiException @@ -234,6 +233,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| License UUID | @@ -254,6 +254,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -262,7 +263,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_project_licenses** > LicenseList find_project_licenses(id, include=include, exclude=exclude, page=page, per_page=per_page) @@ -273,9 +273,8 @@ Provides a collection of licenses for a given project. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.license_list import LicenseList from equinix_metal.rest import ApiException @@ -321,6 +320,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Project UUID | @@ -343,6 +343,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -351,7 +352,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **update_license** > License update_license(id, license_update_input, include=include, exclude=exclude) @@ -362,9 +362,8 @@ Updates the license. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.license import License from equinix_metal.models.license_update_input import LicenseUpdateInput @@ -410,6 +409,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| License UUID | @@ -431,6 +431,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -440,4 +441,3 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/LineItem.md b/equinix_metal/docs/LineItem.md index b8bafd1e..5a53fc4a 100644 --- a/equinix_metal/docs/LineItem.md +++ b/equinix_metal/docs/LineItem.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **amount** | **float** | | [optional] @@ -23,7 +24,7 @@ json = "{}" # create an instance of LineItem from a JSON string line_item_instance = LineItem.from_json(json) # print the JSON string representation of the object -print LineItem.to_json() +print(LineItem.to_json()) # convert the object into a dict line_item_dict = line_item_instance.to_dict() diff --git a/equinix_metal/docs/Membership.md b/equinix_metal/docs/Membership.md index b4d9b887..49e01292 100644 --- a/equinix_metal/docs/Membership.md +++ b/equinix_metal/docs/Membership.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **created_at** | **datetime** | | [optional] @@ -22,7 +23,7 @@ json = "{}" # create an instance of Membership from a JSON string membership_instance = Membership.from_json(json) # print the JSON string representation of the object -print Membership.to_json() +print(Membership.to_json()) # convert the object into a dict membership_dict = membership_instance.to_dict() diff --git a/equinix_metal/docs/MembershipInput.md b/equinix_metal/docs/MembershipInput.md index a921c3bd..36c1b55e 100644 --- a/equinix_metal/docs/MembershipInput.md +++ b/equinix_metal/docs/MembershipInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of MembershipInput from a JSON string membership_input_instance = MembershipInput.from_json(json) # print the JSON string representation of the object -print MembershipInput.to_json() +print(MembershipInput.to_json()) # convert the object into a dict membership_input_dict = membership_input_instance.to_dict() diff --git a/equinix_metal/docs/MembershipList.md b/equinix_metal/docs/MembershipList.md index 7de41f68..7f49d96e 100644 --- a/equinix_metal/docs/MembershipList.md +++ b/equinix_metal/docs/MembershipList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of MembershipList from a JSON string membership_list_instance = MembershipList.from_json(json) # print the JSON string representation of the object -print MembershipList.to_json() +print(MembershipList.to_json()) # convert the object into a dict membership_list_dict = membership_list_instance.to_dict() diff --git a/equinix_metal/docs/MembershipsApi.md b/equinix_metal/docs/MembershipsApi.md index 7dfbb06b..3319e538 100644 --- a/equinix_metal/docs/MembershipsApi.md +++ b/equinix_metal/docs/MembershipsApi.md @@ -19,9 +19,8 @@ Deletes the membership. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -60,6 +59,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Membership UUID | @@ -78,6 +78,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **204** | no content | - | @@ -86,7 +87,6 @@ void (empty response body) **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_membership_by_id** > Membership find_membership_by_id(id, include=include) @@ -97,9 +97,8 @@ Returns a single membership. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.membership import Membership from equinix_metal.rest import ApiException @@ -142,6 +141,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Membership UUID | @@ -161,6 +161,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -169,7 +170,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **update_membership** > Membership update_membership(id, membership_input, include=include) @@ -180,9 +180,8 @@ Updates the membership. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.membership import Membership from equinix_metal.models.membership_input import MembershipInput @@ -227,6 +226,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Membership UUID | @@ -247,6 +247,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -256,4 +257,3 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/Meta.md b/equinix_metal/docs/Meta.md index f03ead3f..823f158d 100644 --- a/equinix_metal/docs/Meta.md +++ b/equinix_metal/docs/Meta.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **current_page** | **int** | | [optional] @@ -24,7 +25,7 @@ json = "{}" # create an instance of Meta from a JSON string meta_instance = Meta.from_json(json) # print the JSON string representation of the object -print Meta.to_json() +print(Meta.to_json()) # convert the object into a dict meta_dict = meta_instance.to_dict() diff --git a/equinix_metal/docs/Metadata.md b/equinix_metal/docs/Metadata.md index cd3935a1..703b6ce2 100644 --- a/equinix_metal/docs/Metadata.md +++ b/equinix_metal/docs/Metadata.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **var_class** | **str** | | [optional] @@ -34,7 +35,7 @@ json = "{}" # create an instance of Metadata from a JSON string metadata_instance = Metadata.from_json(json) # print the JSON string representation of the object -print Metadata.to_json() +print(Metadata.to_json()) # convert the object into a dict metadata_dict = metadata_instance.to_dict() diff --git a/equinix_metal/docs/MetadataNetwork.md b/equinix_metal/docs/MetadataNetwork.md index 0b3fbd02..fda3a746 100644 --- a/equinix_metal/docs/MetadataNetwork.md +++ b/equinix_metal/docs/MetadataNetwork.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **addresses** | **List[str]** | | [optional] @@ -19,7 +20,7 @@ json = "{}" # create an instance of MetadataNetwork from a JSON string metadata_network_instance = MetadataNetwork.from_json(json) # print the JSON string representation of the object -print MetadataNetwork.to_json() +print(MetadataNetwork.to_json()) # convert the object into a dict metadata_network_dict = metadata_network_instance.to_dict() diff --git a/equinix_metal/docs/MetadataNetworkNetwork.md b/equinix_metal/docs/MetadataNetworkNetwork.md index 29a7e8d3..51c138b5 100644 --- a/equinix_metal/docs/MetadataNetworkNetwork.md +++ b/equinix_metal/docs/MetadataNetworkNetwork.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **bonding** | [**MetadataNetworkNetworkBonding**](MetadataNetworkNetworkBonding.md) | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of MetadataNetworkNetwork from a JSON string metadata_network_network_instance = MetadataNetworkNetwork.from_json(json) # print the JSON string representation of the object -print MetadataNetworkNetwork.to_json() +print(MetadataNetworkNetwork.to_json()) # convert the object into a dict metadata_network_network_dict = metadata_network_network_instance.to_dict() diff --git a/equinix_metal/docs/MetadataNetworkNetworkBonding.md b/equinix_metal/docs/MetadataNetworkNetworkBonding.md index 391db73a..31bd86b7 100644 --- a/equinix_metal/docs/MetadataNetworkNetworkBonding.md +++ b/equinix_metal/docs/MetadataNetworkNetworkBonding.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -19,7 +20,7 @@ json = "{}" # create an instance of MetadataNetworkNetworkBonding from a JSON string metadata_network_network_bonding_instance = MetadataNetworkNetworkBonding.from_json(json) # print the JSON string representation of the object -print MetadataNetworkNetworkBonding.to_json() +print(MetadataNetworkNetworkBonding.to_json()) # convert the object into a dict metadata_network_network_bonding_dict = metadata_network_network_bonding_instance.to_dict() diff --git a/equinix_metal/docs/MetalGateway.md b/equinix_metal/docs/MetalGateway.md index f3d68a6e..bc54bc32 100644 --- a/equinix_metal/docs/MetalGateway.md +++ b/equinix_metal/docs/MetalGateway.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **created_at** | **datetime** | | [optional] @@ -24,7 +25,7 @@ json = "{}" # create an instance of MetalGateway from a JSON string metal_gateway_instance = MetalGateway.from_json(json) # print the JSON string representation of the object -print MetalGateway.to_json() +print(MetalGateway.to_json()) # convert the object into a dict metal_gateway_dict = metal_gateway_instance.to_dict() diff --git a/equinix_metal/docs/MetalGatewayCreateInput.md b/equinix_metal/docs/MetalGatewayCreateInput.md index bcf180d4..1d5343e2 100644 --- a/equinix_metal/docs/MetalGatewayCreateInput.md +++ b/equinix_metal/docs/MetalGatewayCreateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -19,7 +20,7 @@ json = "{}" # create an instance of MetalGatewayCreateInput from a JSON string metal_gateway_create_input_instance = MetalGatewayCreateInput.from_json(json) # print the JSON string representation of the object -print MetalGatewayCreateInput.to_json() +print(MetalGatewayCreateInput.to_json()) # convert the object into a dict metal_gateway_create_input_dict = metal_gateway_create_input_instance.to_dict() diff --git a/equinix_metal/docs/MetalGatewayElasticIpCreateInput.md b/equinix_metal/docs/MetalGatewayElasticIpCreateInput.md index 61192478..4608a498 100644 --- a/equinix_metal/docs/MetalGatewayElasticIpCreateInput.md +++ b/equinix_metal/docs/MetalGatewayElasticIpCreateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **address** | **str** | An IP address (or IP Address range) contained within one of the project's IP Reservations | @@ -20,7 +21,7 @@ json = "{}" # create an instance of MetalGatewayElasticIpCreateInput from a JSON string metal_gateway_elastic_ip_create_input_instance = MetalGatewayElasticIpCreateInput.from_json(json) # print the JSON string representation of the object -print MetalGatewayElasticIpCreateInput.to_json() +print(MetalGatewayElasticIpCreateInput.to_json()) # convert the object into a dict metal_gateway_elastic_ip_create_input_dict = metal_gateway_elastic_ip_create_input_instance.to_dict() diff --git a/equinix_metal/docs/MetalGatewayList.md b/equinix_metal/docs/MetalGatewayList.md index 76cd4dde..5124d59e 100644 --- a/equinix_metal/docs/MetalGatewayList.md +++ b/equinix_metal/docs/MetalGatewayList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -18,7 +19,7 @@ json = "{}" # create an instance of MetalGatewayList from a JSON string metal_gateway_list_instance = MetalGatewayList.from_json(json) # print the JSON string representation of the object -print MetalGatewayList.to_json() +print(MetalGatewayList.to_json()) # convert the object into a dict metal_gateway_list_dict = metal_gateway_list_instance.to_dict() diff --git a/equinix_metal/docs/MetalGatewayListMetalGatewaysInner.md b/equinix_metal/docs/MetalGatewayListMetalGatewaysInner.md index c7d3edbf..b279681b 100644 --- a/equinix_metal/docs/MetalGatewayListMetalGatewaysInner.md +++ b/equinix_metal/docs/MetalGatewayListMetalGatewaysInner.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **created_at** | **datetime** | | [optional] @@ -25,7 +26,7 @@ json = "{}" # create an instance of MetalGatewayListMetalGatewaysInner from a JSON string metal_gateway_list_metal_gateways_inner_instance = MetalGatewayListMetalGatewaysInner.from_json(json) # print the JSON string representation of the object -print MetalGatewayListMetalGatewaysInner.to_json() +print(MetalGatewayListMetalGatewaysInner.to_json()) # convert the object into a dict metal_gateway_list_metal_gateways_inner_dict = metal_gateway_list_metal_gateways_inner_instance.to_dict() diff --git a/equinix_metal/docs/MetalGatewayLite.md b/equinix_metal/docs/MetalGatewayLite.md index 09293622..e8402ba9 100644 --- a/equinix_metal/docs/MetalGatewayLite.md +++ b/equinix_metal/docs/MetalGatewayLite.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **created_at** | **datetime** | | [optional] @@ -22,7 +23,7 @@ json = "{}" # create an instance of MetalGatewayLite from a JSON string metal_gateway_lite_instance = MetalGatewayLite.from_json(json) # print the JSON string representation of the object -print MetalGatewayLite.to_json() +print(MetalGatewayLite.to_json()) # convert the object into a dict metal_gateway_lite_dict = metal_gateway_lite_instance.to_dict() diff --git a/equinix_metal/docs/MetalGatewaysApi.md b/equinix_metal/docs/MetalGatewaysApi.md index 30b6c32f..335ed867 100644 --- a/equinix_metal/docs/MetalGatewaysApi.md +++ b/equinix_metal/docs/MetalGatewaysApi.md @@ -23,9 +23,8 @@ Create a metal gateway in a project ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.create_metal_gateway_request import CreateMetalGatewayRequest from equinix_metal.models.find_metal_gateway_by_id200_response import FindMetalGatewayById200Response @@ -73,6 +72,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **project_id** | **str**| Project UUID | @@ -96,6 +96,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | created | - | @@ -104,7 +105,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **create_metal_gateway_elastic_ip** > IPAssignment create_metal_gateway_elastic_ip(id, metal_gateway_elastic_ip_create_input, include=include, exclude=exclude) @@ -115,9 +115,8 @@ Create a new Elastic IP on this Metal Gateway. Assign an IPv4 range as an elast ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.ip_assignment import IPAssignment from equinix_metal.models.metal_gateway_elastic_ip_create_input import MetalGatewayElasticIpCreateInput @@ -163,6 +162,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Metal Gateway UUID | @@ -184,6 +184,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | Created | - | @@ -193,7 +194,6 @@ Name | Type | Description | Notes **422** | Unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **delete_metal_gateway** > FindMetalGatewayById200Response delete_metal_gateway(id, include=include, exclude=exclude) @@ -204,9 +204,8 @@ Deletes a metal gateway and any elastic IP assignments associated with this meta ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.find_metal_gateway_by_id200_response import FindMetalGatewayById200Response from equinix_metal.rest import ApiException @@ -250,6 +249,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Metal Gateway UUID | @@ -270,6 +270,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **202** | accepted | - | @@ -277,7 +278,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_metal_gateway_by_id** > FindMetalGatewayById200Response find_metal_gateway_by_id(id, include=include, exclude=exclude) @@ -288,9 +288,8 @@ Returns a specific metal gateway ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.find_metal_gateway_by_id200_response import FindMetalGatewayById200Response from equinix_metal.rest import ApiException @@ -334,6 +333,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Metal Gateway UUID | @@ -354,6 +354,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -361,7 +362,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_metal_gateways_by_project** > MetalGatewayList find_metal_gateways_by_project(project_id, include=include, exclude=exclude, page=page, per_page=per_page) @@ -372,9 +372,8 @@ Return all metal gateways for a project ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.metal_gateway_list import MetalGatewayList from equinix_metal.rest import ApiException @@ -420,6 +419,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **project_id** | **str**| Project UUID | @@ -442,6 +442,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -449,12 +450,9 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_metal_gateways_by_project_all_pages** > MetalGatewayList find_metal_gateways_by_project_all_pages(project_id, include=include, exclude=exclude, per_page=per_page) - Just like [**find_metal_gateways_by_project**](MetalGatewaysApi.md#find_metal_gateways_by_project) but fetches resources from all pages. This method doesn't take `page` parameter. Other parameters, return type and other characteristics are the same as in [**find_metal_gateways_by_project**](MetalGatewaysApi.md#find_metal_gateways_by_project). - # **get_metal_gateway_elastic_ips** > IPAssignmentList get_metal_gateway_elastic_ips(id, include=include, exclude=exclude) @@ -465,9 +463,8 @@ Returns the list of Elastic IPs assigned to this Metal Gateway ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.ip_assignment_list import IPAssignmentList from equinix_metal.rest import ApiException @@ -511,6 +508,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Metal Gateway UUID | @@ -531,6 +529,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | OK | - | @@ -538,4 +537,3 @@ Name | Type | Description | Notes **404** | Not Found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/Metro.md b/equinix_metal/docs/Metro.md index e20db62e..63351ca0 100644 --- a/equinix_metal/docs/Metro.md +++ b/equinix_metal/docs/Metro.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **code** | **str** | | [optional] @@ -20,7 +21,7 @@ json = "{}" # create an instance of Metro from a JSON string metro_instance = Metro.from_json(json) # print the JSON string representation of the object -print Metro.to_json() +print(Metro.to_json()) # convert the object into a dict metro_dict = metro_instance.to_dict() diff --git a/equinix_metal/docs/MetroInput.md b/equinix_metal/docs/MetroInput.md index 8c9e41f8..93d6b3a5 100644 --- a/equinix_metal/docs/MetroInput.md +++ b/equinix_metal/docs/MetroInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of MetroInput from a JSON string metro_input_instance = MetroInput.from_json(json) # print the JSON string representation of the object -print MetroInput.to_json() +print(MetroInput.to_json()) # convert the object into a dict metro_input_dict = metro_input_instance.to_dict() diff --git a/equinix_metal/docs/MetroList.md b/equinix_metal/docs/MetroList.md index 9835c78b..93a64d15 100644 --- a/equinix_metal/docs/MetroList.md +++ b/equinix_metal/docs/MetroList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of MetroList from a JSON string metro_list_instance = MetroList.from_json(json) # print the JSON string representation of the object -print MetroList.to_json() +print(MetroList.to_json()) # convert the object into a dict metro_list_dict = metro_list_instance.to_dict() diff --git a/equinix_metal/docs/MetrosApi.md b/equinix_metal/docs/MetrosApi.md index dceb1317..305e064a 100644 --- a/equinix_metal/docs/MetrosApi.md +++ b/equinix_metal/docs/MetrosApi.md @@ -18,9 +18,8 @@ Provides a listing of available metros ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.metro_list import MetroList from equinix_metal.rest import ApiException @@ -60,6 +59,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + This endpoint does not need any parameter. ### Return type @@ -76,13 +76,13 @@ This endpoint does not need any parameter. - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | **401** | unauthorized | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **get_metro** > Metro get_metro(id) @@ -93,9 +93,8 @@ Show the details for a metro, including name, code, and country. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.metro import Metro from equinix_metal.rest import ApiException @@ -137,6 +136,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Metro UUID | @@ -155,10 +155,10 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/Mount.md b/equinix_metal/docs/Mount.md index 7f06a4c8..eb019567 100644 --- a/equinix_metal/docs/Mount.md +++ b/equinix_metal/docs/Mount.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **device** | **str** | | [optional] @@ -20,7 +21,7 @@ json = "{}" # create an instance of Mount from a JSON string mount_instance = Mount.from_json(json) # print the JSON string representation of the object -print Mount.to_json() +print(Mount.to_json()) # convert the object into a dict mount_dict = mount_instance.to_dict() diff --git a/equinix_metal/docs/MoveHardwareReservationRequest.md b/equinix_metal/docs/MoveHardwareReservationRequest.md index 61f7a8f1..d6fcd9d4 100644 --- a/equinix_metal/docs/MoveHardwareReservationRequest.md +++ b/equinix_metal/docs/MoveHardwareReservationRequest.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of MoveHardwareReservationRequest from a JSON string move_hardware_reservation_request_instance = MoveHardwareReservationRequest.from_json(json) # print the JSON string representation of the object -print MoveHardwareReservationRequest.to_json() +print(MoveHardwareReservationRequest.to_json()) # convert the object into a dict move_hardware_reservation_request_dict = move_hardware_reservation_request_instance.to_dict() diff --git a/equinix_metal/docs/NewPassword.md b/equinix_metal/docs/NewPassword.md index ff5c4db0..7e23da6d 100644 --- a/equinix_metal/docs/NewPassword.md +++ b/equinix_metal/docs/NewPassword.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of NewPassword from a JSON string new_password_instance = NewPassword.from_json(json) # print the JSON string representation of the object -print NewPassword.to_json() +print(NewPassword.to_json()) # convert the object into a dict new_password_dict = new_password_instance.to_dict() diff --git a/equinix_metal/docs/OTPsApi.md b/equinix_metal/docs/OTPsApi.md index d73b0bb2..b1ced9b8 100644 --- a/equinix_metal/docs/OTPsApi.md +++ b/equinix_metal/docs/OTPsApi.md @@ -20,9 +20,8 @@ It verifies the user once a valid OTP is provided. It gives back a session token ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -61,6 +60,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **otp** | **str**| OTP | @@ -79,6 +79,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **204** | no content | - | @@ -86,7 +87,6 @@ void (empty response body) **401** | unauthorized | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_recovery_codes** > RecoveryCodeList find_recovery_codes() @@ -97,9 +97,8 @@ Returns my recovery codes. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.recovery_code_list import RecoveryCodeList from equinix_metal.rest import ApiException @@ -139,6 +138,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + This endpoint does not need any parameter. ### Return type @@ -155,6 +155,7 @@ This endpoint does not need any parameter. - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -163,7 +164,6 @@ This endpoint does not need any parameter. **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **receive_codes** > receive_codes() @@ -174,9 +174,8 @@ Sends an OTP to the user's mobile phone. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -213,6 +212,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + This endpoint does not need any parameter. ### Return type @@ -229,6 +229,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **204** | no content | - | @@ -238,7 +239,6 @@ void (empty response body) **500** | internal server error | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **regenerate_codes** > RecoveryCodeList regenerate_codes() @@ -249,9 +249,8 @@ Generate a new set of recovery codes. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.recovery_code_list import RecoveryCodeList from equinix_metal.rest import ApiException @@ -291,6 +290,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + This endpoint does not need any parameter. ### Return type @@ -307,6 +307,7 @@ This endpoint does not need any parameter. - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -315,4 +316,3 @@ This endpoint does not need any parameter. **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/OperatingSystem.md b/equinix_metal/docs/OperatingSystem.md index 31485bdc..36c29ec8 100644 --- a/equinix_metal/docs/OperatingSystem.md +++ b/equinix_metal/docs/OperatingSystem.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **default_operating_system** | **bool** | Default operating system for the distro. | [optional] [readonly] @@ -27,7 +28,7 @@ json = "{}" # create an instance of OperatingSystem from a JSON string operating_system_instance = OperatingSystem.from_json(json) # print the JSON string representation of the object -print OperatingSystem.to_json() +print(OperatingSystem.to_json()) # convert the object into a dict operating_system_dict = operating_system_instance.to_dict() diff --git a/equinix_metal/docs/OperatingSystemList.md b/equinix_metal/docs/OperatingSystemList.md index 1789f09d..c0c8df83 100644 --- a/equinix_metal/docs/OperatingSystemList.md +++ b/equinix_metal/docs/OperatingSystemList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of OperatingSystemList from a JSON string operating_system_list_instance = OperatingSystemList.from_json(json) # print the JSON string representation of the object -print OperatingSystemList.to_json() +print(OperatingSystemList.to_json()) # convert the object into a dict operating_system_list_dict = operating_system_list_instance.to_dict() diff --git a/equinix_metal/docs/OperatingSystemsApi.md b/equinix_metal/docs/OperatingSystemsApi.md index 008ec9ac..4d987cc7 100644 --- a/equinix_metal/docs/OperatingSystemsApi.md +++ b/equinix_metal/docs/OperatingSystemsApi.md @@ -18,9 +18,8 @@ Provides a listing of available operating system versions. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.operating_system_list import OperatingSystemList from equinix_metal.rest import ApiException @@ -60,6 +59,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + This endpoint does not need any parameter. ### Return type @@ -76,13 +76,13 @@ This endpoint does not need any parameter. - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | **401** | unauthorized | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_operating_systems** > OperatingSystemList find_operating_systems() @@ -93,9 +93,8 @@ Provides a listing of available operating systems to provision your new device w ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.operating_system_list import OperatingSystemList from equinix_metal.rest import ApiException @@ -135,6 +134,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + This endpoint does not need any parameter. ### Return type @@ -151,10 +151,10 @@ This endpoint does not need any parameter. - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | **401** | unauthorized | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/Organization.md b/equinix_metal/docs/Organization.md index a27bf6f3..8a27d314 100644 --- a/equinix_metal/docs/Organization.md +++ b/equinix_metal/docs/Organization.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **address** | [**Address**](Address.md) | | [optional] @@ -33,7 +34,7 @@ json = "{}" # create an instance of Organization from a JSON string organization_instance = Organization.from_json(json) # print the JSON string representation of the object -print Organization.to_json() +print(Organization.to_json()) # convert the object into a dict organization_dict = organization_instance.to_dict() diff --git a/equinix_metal/docs/OrganizationInput.md b/equinix_metal/docs/OrganizationInput.md index cb856e23..06212336 100644 --- a/equinix_metal/docs/OrganizationInput.md +++ b/equinix_metal/docs/OrganizationInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **address** | [**Address**](Address.md) | | [optional] @@ -25,7 +26,7 @@ json = "{}" # create an instance of OrganizationInput from a JSON string organization_input_instance = OrganizationInput.from_json(json) # print the JSON string representation of the object -print OrganizationInput.to_json() +print(OrganizationInput.to_json()) # convert the object into a dict organization_input_dict = organization_input_instance.to_dict() diff --git a/equinix_metal/docs/OrganizationList.md b/equinix_metal/docs/OrganizationList.md index 3968a0cd..0dc28946 100644 --- a/equinix_metal/docs/OrganizationList.md +++ b/equinix_metal/docs/OrganizationList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -18,7 +19,7 @@ json = "{}" # create an instance of OrganizationList from a JSON string organization_list_instance = OrganizationList.from_json(json) # print the JSON string representation of the object -print OrganizationList.to_json() +print(OrganizationList.to_json()) # convert the object into a dict organization_list_dict = organization_list_instance.to_dict() diff --git a/equinix_metal/docs/OrganizationsApi.md b/equinix_metal/docs/OrganizationsApi.md index ad91e0c2..f18d7633 100644 --- a/equinix_metal/docs/OrganizationsApi.md +++ b/equinix_metal/docs/OrganizationsApi.md @@ -33,9 +33,8 @@ Creates an organization. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.organization import Organization from equinix_metal.models.organization_input import OrganizationInput @@ -80,6 +79,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **organization_input** | [**OrganizationInput**](OrganizationInput.md)| Organization to create | @@ -100,6 +100,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | created | - | @@ -108,7 +109,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **create_organization_invitation** > Invitation create_organization_invitation(id, invitation_input, include=include) @@ -119,9 +119,8 @@ In order to add a user to an organization, they must first be invited. To invite ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.invitation import Invitation from equinix_metal.models.invitation_input import InvitationInput @@ -166,6 +165,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Organization UUID | @@ -186,6 +186,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | created | - | @@ -195,7 +196,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **create_organization_project** > Project create_organization_project(id, project_create_input, include=include, exclude=exclude) @@ -206,9 +206,8 @@ Creates a new project for the organization ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.project import Project from equinix_metal.models.project_create_input import ProjectCreateInput @@ -254,6 +253,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Organization UUID | @@ -275,6 +275,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | created | - | @@ -282,7 +283,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **create_payment_method** > PaymentMethod create_payment_method(id, payment_method_create_input, include=include) @@ -293,9 +293,8 @@ Creates a payment method. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.payment_method import PaymentMethod from equinix_metal.models.payment_method_create_input import PaymentMethodCreateInput @@ -340,6 +339,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Organization UUID | @@ -360,6 +360,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | created | - | @@ -368,7 +369,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **delete_organization** > delete_organization(id) @@ -379,9 +379,8 @@ Deletes the organization. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -420,6 +419,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Organization UUID | @@ -438,6 +438,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **204** | no content | - | @@ -445,7 +446,6 @@ void (empty response body) **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_operating_systems_by_organization** > OperatingSystemList find_operating_systems_by_organization(id, include=include) @@ -456,9 +456,8 @@ Returns a listing of available operating systems for the given organization ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.operating_system_list import OperatingSystemList from equinix_metal.rest import ApiException @@ -501,6 +500,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Organization UUID | @@ -520,6 +520,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -528,7 +529,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_organization_by_id** > Organization find_organization_by_id(id, include=include, exclude=exclude) @@ -539,9 +539,8 @@ Returns a single organization's details, if the user is authorized to view it. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.organization import Organization from equinix_metal.rest import ApiException @@ -585,6 +584,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Organization UUID | @@ -605,6 +605,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -613,7 +614,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_organization_customdata** > find_organization_customdata(id) @@ -624,9 +624,8 @@ Provides the custom metadata stored for this organization in json format ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -665,6 +664,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Organization UUID | @@ -683,6 +683,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -691,7 +692,6 @@ void (empty response body) **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_organization_invitations** > InvitationList find_organization_invitations(id, include=include, page=page, per_page=per_page) @@ -702,9 +702,8 @@ Returns all invitations in an organization. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.invitation_list import InvitationList from equinix_metal.rest import ApiException @@ -749,6 +748,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Organization UUID | @@ -770,6 +770,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -778,7 +779,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_organization_payment_methods** > PaymentMethodList find_organization_payment_methods(id, include=include, page=page, per_page=per_page) @@ -789,9 +789,8 @@ Returns all payment methods of an organization. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.payment_method_list import PaymentMethodList from equinix_metal.rest import ApiException @@ -836,6 +835,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Organization UUID | @@ -857,6 +857,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -864,7 +865,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_organization_projects** > ProjectList find_organization_projects(id, name=name, include=include, exclude=exclude, page=page, per_page=per_page) @@ -875,9 +875,8 @@ Returns a collection of projects that belong to the organization. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.project_list import ProjectList from equinix_metal.rest import ApiException @@ -924,6 +923,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Organization UUID | @@ -947,18 +947,16 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | **401** | unauthorized | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_organization_projects_all_pages** > ProjectList find_organization_projects_all_pages(id, name=name, include=include, exclude=exclude, per_page=per_page) - Just like [**find_organization_projects**](OrganizationsApi.md#find_organization_projects) but fetches resources from all pages. This method doesn't take `page` parameter. Other parameters, return type and other characteristics are the same as in [**find_organization_projects**](OrganizationsApi.md#find_organization_projects). - # **find_organization_transfers** > TransferRequestList find_organization_transfers(id, include=include) @@ -969,9 +967,8 @@ Provides a collection of project transfer requests from or to the organization. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.transfer_request_list import TransferRequestList from equinix_metal.rest import ApiException @@ -1014,6 +1011,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Organization UUID | @@ -1033,6 +1031,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -1040,7 +1039,6 @@ Name | Type | Description | Notes **403** | forbidden | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_organizations** > OrganizationList find_organizations(personal=personal, without_projects=without_projects, include=include, exclude=exclude, page=page, per_page=per_page) @@ -1051,9 +1049,8 @@ Returns a list of organizations that are accessible to the current user. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.organization_list import OrganizationList from equinix_metal.rest import ApiException @@ -1100,6 +1097,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **personal** | **str**| Include, exclude or show only personal organizations. | [optional] @@ -1123,18 +1121,16 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | **401** | unauthorized | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_organizations_all_pages** > OrganizationList find_organizations_all_pages(personal=personal, without_projects=without_projects, include=include, exclude=exclude, per_page=per_page) - Just like [**find_organizations**](OrganizationsApi.md#find_organizations) but fetches resources from all pages. This method doesn't take `page` parameter. Other parameters, return type and other characteristics are the same as in [**find_organizations**](OrganizationsApi.md#find_organizations). - # **find_plans_by_organization** > PlanList find_plans_by_organization(id, include=include, exclude=exclude) @@ -1145,9 +1141,8 @@ Returns a listing of available plans for the given organization ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.plan_list import PlanList from equinix_metal.rest import ApiException @@ -1191,6 +1186,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Organization UUID | @@ -1211,6 +1207,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -1219,7 +1216,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **update_organization** > Organization update_organization(id, organization_input, include=include, exclude=exclude) @@ -1230,9 +1226,8 @@ Updates the organization. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.organization import Organization from equinix_metal.models.organization_input import OrganizationInput @@ -1278,6 +1273,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Organization UUID | @@ -1299,6 +1295,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -1308,4 +1305,3 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/ParentBlock.md b/equinix_metal/docs/ParentBlock.md index 439aaa69..bb0a246e 100644 --- a/equinix_metal/docs/ParentBlock.md +++ b/equinix_metal/docs/ParentBlock.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **cidr** | **int** | | [optional] @@ -19,7 +20,7 @@ json = "{}" # create an instance of ParentBlock from a JSON string parent_block_instance = ParentBlock.from_json(json) # print the JSON string representation of the object -print ParentBlock.to_json() +print(ParentBlock.to_json()) # convert the object into a dict parent_block_dict = parent_block_instance.to_dict() diff --git a/equinix_metal/docs/Partition.md b/equinix_metal/docs/Partition.md index f1c6797f..d0770b67 100644 --- a/equinix_metal/docs/Partition.md +++ b/equinix_metal/docs/Partition.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -19,7 +20,7 @@ json = "{}" # create an instance of Partition from a JSON string partition_instance = Partition.from_json(json) # print the JSON string representation of the object -print Partition.to_json() +print(Partition.to_json()) # convert the object into a dict partition_dict = partition_instance.to_dict() diff --git a/equinix_metal/docs/PasswordResetTokensApi.md b/equinix_metal/docs/PasswordResetTokensApi.md index 35bae529..6ebc403c 100644 --- a/equinix_metal/docs/PasswordResetTokensApi.md +++ b/equinix_metal/docs/PasswordResetTokensApi.md @@ -18,9 +18,8 @@ Creates a password reset token ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -59,6 +58,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **email** | **str**| Email of user to create password reset token | @@ -77,6 +77,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | created | - | @@ -84,7 +85,6 @@ void (empty response body) **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **reset_password** > NewPassword reset_password() @@ -95,9 +95,8 @@ Resets current user password. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.new_password import NewPassword from equinix_metal.rest import ApiException @@ -137,6 +136,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + This endpoint does not need any parameter. ### Return type @@ -153,6 +153,7 @@ This endpoint does not need any parameter. - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | ok | - | @@ -160,4 +161,3 @@ This endpoint does not need any parameter. **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/PaymentMethod.md b/equinix_metal/docs/PaymentMethod.md index 0020a18d..c7d1f3a7 100644 --- a/equinix_metal/docs/PaymentMethod.md +++ b/equinix_metal/docs/PaymentMethod.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **billing_address** | [**PaymentMethodBillingAddress**](PaymentMethodBillingAddress.md) | | [optional] @@ -31,7 +32,7 @@ json = "{}" # create an instance of PaymentMethod from a JSON string payment_method_instance = PaymentMethod.from_json(json) # print the JSON string representation of the object -print PaymentMethod.to_json() +print(PaymentMethod.to_json()) # convert the object into a dict payment_method_dict = payment_method_instance.to_dict() diff --git a/equinix_metal/docs/PaymentMethodBillingAddress.md b/equinix_metal/docs/PaymentMethodBillingAddress.md index e46aedaa..b08ed1f9 100644 --- a/equinix_metal/docs/PaymentMethodBillingAddress.md +++ b/equinix_metal/docs/PaymentMethodBillingAddress.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **country_code_alpha2** | **str** | | [optional] @@ -19,7 +20,7 @@ json = "{}" # create an instance of PaymentMethodBillingAddress from a JSON string payment_method_billing_address_instance = PaymentMethodBillingAddress.from_json(json) # print the JSON string representation of the object -print PaymentMethodBillingAddress.to_json() +print(PaymentMethodBillingAddress.to_json()) # convert the object into a dict payment_method_billing_address_dict = payment_method_billing_address_instance.to_dict() diff --git a/equinix_metal/docs/PaymentMethodCreateInput.md b/equinix_metal/docs/PaymentMethodCreateInput.md index bdae4bcf..c7a1c470 100644 --- a/equinix_metal/docs/PaymentMethodCreateInput.md +++ b/equinix_metal/docs/PaymentMethodCreateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **default** | **bool** | | [optional] @@ -19,7 +20,7 @@ json = "{}" # create an instance of PaymentMethodCreateInput from a JSON string payment_method_create_input_instance = PaymentMethodCreateInput.from_json(json) # print the JSON string representation of the object -print PaymentMethodCreateInput.to_json() +print(PaymentMethodCreateInput.to_json()) # convert the object into a dict payment_method_create_input_dict = payment_method_create_input_instance.to_dict() diff --git a/equinix_metal/docs/PaymentMethodList.md b/equinix_metal/docs/PaymentMethodList.md index 550b9b1c..aa13317b 100644 --- a/equinix_metal/docs/PaymentMethodList.md +++ b/equinix_metal/docs/PaymentMethodList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of PaymentMethodList from a JSON string payment_method_list_instance = PaymentMethodList.from_json(json) # print the JSON string representation of the object -print PaymentMethodList.to_json() +print(PaymentMethodList.to_json()) # convert the object into a dict payment_method_list_dict = payment_method_list_instance.to_dict() diff --git a/equinix_metal/docs/PaymentMethodUpdateInput.md b/equinix_metal/docs/PaymentMethodUpdateInput.md index 42875621..f75489fe 100644 --- a/equinix_metal/docs/PaymentMethodUpdateInput.md +++ b/equinix_metal/docs/PaymentMethodUpdateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **billing_address** | **object** | | [optional] @@ -22,7 +23,7 @@ json = "{}" # create an instance of PaymentMethodUpdateInput from a JSON string payment_method_update_input_instance = PaymentMethodUpdateInput.from_json(json) # print the JSON string representation of the object -print PaymentMethodUpdateInput.to_json() +print(PaymentMethodUpdateInput.to_json()) # convert the object into a dict payment_method_update_input_dict = payment_method_update_input_instance.to_dict() diff --git a/equinix_metal/docs/PaymentMethodsApi.md b/equinix_metal/docs/PaymentMethodsApi.md index 51cb2f27..6d57b4bc 100644 --- a/equinix_metal/docs/PaymentMethodsApi.md +++ b/equinix_metal/docs/PaymentMethodsApi.md @@ -19,9 +19,8 @@ Deletes the payment method. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -60,6 +59,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Payment Method UUID | @@ -78,6 +78,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **204** | no content | - | @@ -85,7 +86,6 @@ void (empty response body) **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_payment_method_by_id** > PaymentMethod find_payment_method_by_id(id, include=include) @@ -96,9 +96,8 @@ Returns a payment method ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.payment_method import PaymentMethod from equinix_metal.rest import ApiException @@ -141,6 +140,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Payment Method UUID | @@ -160,6 +160,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -167,7 +168,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **update_payment_method** > PaymentMethod update_payment_method(id, payment_method_update_input, include=include) @@ -178,9 +178,8 @@ Updates the payment method. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.payment_method import PaymentMethod from equinix_metal.models.payment_method_update_input import PaymentMethodUpdateInput @@ -225,6 +224,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Payment Method UUID | @@ -245,6 +245,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -253,4 +254,3 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/Plan.md b/equinix_metal/docs/Plan.md index e5729a50..4119979f 100644 --- a/equinix_metal/docs/Plan.md +++ b/equinix_metal/docs/Plan.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **available_in** | [**List[PlanAvailableInInner]**](PlanAvailableInInner.md) | Shows which facilities the plan is available in, and the facility-based price if it is different from the default price. | [optional] @@ -30,7 +31,7 @@ json = "{}" # create an instance of Plan from a JSON string plan_instance = Plan.from_json(json) # print the JSON string representation of the object -print Plan.to_json() +print(Plan.to_json()) # convert the object into a dict plan_dict = plan_instance.to_dict() diff --git a/equinix_metal/docs/PlanAvailableInInner.md b/equinix_metal/docs/PlanAvailableInInner.md index ac8ad39a..ddc9bd22 100644 --- a/equinix_metal/docs/PlanAvailableInInner.md +++ b/equinix_metal/docs/PlanAvailableInInner.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | href to the Facility | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of PlanAvailableInInner from a JSON string plan_available_in_inner_instance = PlanAvailableInInner.from_json(json) # print the JSON string representation of the object -print PlanAvailableInInner.to_json() +print(PlanAvailableInInner.to_json()) # convert the object into a dict plan_available_in_inner_dict = plan_available_in_inner_instance.to_dict() diff --git a/equinix_metal/docs/PlanAvailableInInnerPrice.md b/equinix_metal/docs/PlanAvailableInInnerPrice.md index 2a102c86..24207c81 100644 --- a/equinix_metal/docs/PlanAvailableInInnerPrice.md +++ b/equinix_metal/docs/PlanAvailableInInnerPrice.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **hour** | **float** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of PlanAvailableInInnerPrice from a JSON string plan_available_in_inner_price_instance = PlanAvailableInInnerPrice.from_json(json) # print the JSON string representation of the object -print PlanAvailableInInnerPrice.to_json() +print(PlanAvailableInInnerPrice.to_json()) # convert the object into a dict plan_available_in_inner_price_dict = plan_available_in_inner_price_instance.to_dict() diff --git a/equinix_metal/docs/PlanAvailableInMetrosInner.md b/equinix_metal/docs/PlanAvailableInMetrosInner.md index c9e10ae9..c657d2e0 100644 --- a/equinix_metal/docs/PlanAvailableInMetrosInner.md +++ b/equinix_metal/docs/PlanAvailableInMetrosInner.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | href to the Metro | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of PlanAvailableInMetrosInner from a JSON string plan_available_in_metros_inner_instance = PlanAvailableInMetrosInner.from_json(json) # print the JSON string representation of the object -print PlanAvailableInMetrosInner.to_json() +print(PlanAvailableInMetrosInner.to_json()) # convert the object into a dict plan_available_in_metros_inner_dict = plan_available_in_metros_inner_instance.to_dict() diff --git a/equinix_metal/docs/PlanList.md b/equinix_metal/docs/PlanList.md index e7a05afa..a48e48ae 100644 --- a/equinix_metal/docs/PlanList.md +++ b/equinix_metal/docs/PlanList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of PlanList from a JSON string plan_list_instance = PlanList.from_json(json) # print the JSON string representation of the object -print PlanList.to_json() +print(PlanList.to_json()) # convert the object into a dict plan_list_dict = plan_list_instance.to_dict() diff --git a/equinix_metal/docs/PlanSpecs.md b/equinix_metal/docs/PlanSpecs.md index c8e2a0c6..5d4971be 100644 --- a/equinix_metal/docs/PlanSpecs.md +++ b/equinix_metal/docs/PlanSpecs.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **cpus** | [**List[PlanSpecsCpusInner]**](PlanSpecsCpusInner.md) | | [optional] @@ -21,7 +22,7 @@ json = "{}" # create an instance of PlanSpecs from a JSON string plan_specs_instance = PlanSpecs.from_json(json) # print the JSON string representation of the object -print PlanSpecs.to_json() +print(PlanSpecs.to_json()) # convert the object into a dict plan_specs_dict = plan_specs_instance.to_dict() diff --git a/equinix_metal/docs/PlanSpecsCpusInner.md b/equinix_metal/docs/PlanSpecsCpusInner.md index f77371b7..e817cf9e 100644 --- a/equinix_metal/docs/PlanSpecsCpusInner.md +++ b/equinix_metal/docs/PlanSpecsCpusInner.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **count** | **int** | | [optional] @@ -18,7 +19,7 @@ json = "{}" # create an instance of PlanSpecsCpusInner from a JSON string plan_specs_cpus_inner_instance = PlanSpecsCpusInner.from_json(json) # print the JSON string representation of the object -print PlanSpecsCpusInner.to_json() +print(PlanSpecsCpusInner.to_json()) # convert the object into a dict plan_specs_cpus_inner_dict = plan_specs_cpus_inner_instance.to_dict() diff --git a/equinix_metal/docs/PlanSpecsDrivesInner.md b/equinix_metal/docs/PlanSpecsDrivesInner.md index fe00599a..e7a51b73 100644 --- a/equinix_metal/docs/PlanSpecsDrivesInner.md +++ b/equinix_metal/docs/PlanSpecsDrivesInner.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **category** | **str** | | [optional] @@ -20,7 +21,7 @@ json = "{}" # create an instance of PlanSpecsDrivesInner from a JSON string plan_specs_drives_inner_instance = PlanSpecsDrivesInner.from_json(json) # print the JSON string representation of the object -print PlanSpecsDrivesInner.to_json() +print(PlanSpecsDrivesInner.to_json()) # convert the object into a dict plan_specs_drives_inner_dict = plan_specs_drives_inner_instance.to_dict() diff --git a/equinix_metal/docs/PlanSpecsFeatures.md b/equinix_metal/docs/PlanSpecsFeatures.md index 9a84f84b..8dd368ce 100644 --- a/equinix_metal/docs/PlanSpecsFeatures.md +++ b/equinix_metal/docs/PlanSpecsFeatures.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -19,7 +20,7 @@ json = "{}" # create an instance of PlanSpecsFeatures from a JSON string plan_specs_features_instance = PlanSpecsFeatures.from_json(json) # print the JSON string representation of the object -print PlanSpecsFeatures.to_json() +print(PlanSpecsFeatures.to_json()) # convert the object into a dict plan_specs_features_dict = plan_specs_features_instance.to_dict() diff --git a/equinix_metal/docs/PlanSpecsMemory.md b/equinix_metal/docs/PlanSpecsMemory.md index b65f6e16..f433db80 100644 --- a/equinix_metal/docs/PlanSpecsMemory.md +++ b/equinix_metal/docs/PlanSpecsMemory.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of PlanSpecsMemory from a JSON string plan_specs_memory_instance = PlanSpecsMemory.from_json(json) # print the JSON string representation of the object -print PlanSpecsMemory.to_json() +print(PlanSpecsMemory.to_json()) # convert the object into a dict plan_specs_memory_dict = plan_specs_memory_instance.to_dict() diff --git a/equinix_metal/docs/PlanSpecsNicsInner.md b/equinix_metal/docs/PlanSpecsNicsInner.md index 613d217d..6e931dba 100644 --- a/equinix_metal/docs/PlanSpecsNicsInner.md +++ b/equinix_metal/docs/PlanSpecsNicsInner.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **count** | **int** | | [optional] @@ -18,7 +19,7 @@ json = "{}" # create an instance of PlanSpecsNicsInner from a JSON string plan_specs_nics_inner_instance = PlanSpecsNicsInner.from_json(json) # print the JSON string representation of the object -print PlanSpecsNicsInner.to_json() +print(PlanSpecsNicsInner.to_json()) # convert the object into a dict plan_specs_nics_inner_dict = plan_specs_nics_inner_instance.to_dict() diff --git a/equinix_metal/docs/PlansApi.md b/equinix_metal/docs/PlansApi.md index e0ff7766..b2e014cd 100644 --- a/equinix_metal/docs/PlansApi.md +++ b/equinix_metal/docs/PlansApi.md @@ -18,9 +18,8 @@ Provides a listing of available plans to provision your device on. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.plan_list import PlanList from equinix_metal.rest import ApiException @@ -66,6 +65,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **categories** | [**List[str]**](str.md)| Filter plans by its category | [optional] @@ -88,13 +88,13 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | **401** | unauthorized | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_plans_by_project** > PlanList find_plans_by_project(id, include=include, exclude=exclude) @@ -105,9 +105,8 @@ Returns a listing of available plans for the given project ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.plan_list import PlanList from equinix_metal.rest import ApiException @@ -151,6 +150,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Project UUID | @@ -171,6 +171,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -179,4 +180,3 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/Port.md b/equinix_metal/docs/Port.md index b4fae0de..fc2a84bf 100644 --- a/equinix_metal/docs/Port.md +++ b/equinix_metal/docs/Port.md @@ -3,6 +3,7 @@ Port is a hardware port associated with a reserved or instantiated hardware device. ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **bond** | [**BondPortData**](BondPortData.md) | | [optional] @@ -26,7 +27,7 @@ json = "{}" # create an instance of Port from a JSON string port_instance = Port.from_json(json) # print the JSON string representation of the object -print Port.to_json() +print(Port.to_json()) # convert the object into a dict port_dict = port_instance.to_dict() diff --git a/equinix_metal/docs/PortAssignInput.md b/equinix_metal/docs/PortAssignInput.md index 591d5a7d..e6ee10b9 100644 --- a/equinix_metal/docs/PortAssignInput.md +++ b/equinix_metal/docs/PortAssignInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of PortAssignInput from a JSON string port_assign_input_instance = PortAssignInput.from_json(json) # print the JSON string representation of the object -print PortAssignInput.to_json() +print(PortAssignInput.to_json()) # convert the object into a dict port_assign_input_dict = port_assign_input_instance.to_dict() diff --git a/equinix_metal/docs/PortConvertLayer3Input.md b/equinix_metal/docs/PortConvertLayer3Input.md index 624c5e77..bc9ffd8d 100644 --- a/equinix_metal/docs/PortConvertLayer3Input.md +++ b/equinix_metal/docs/PortConvertLayer3Input.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of PortConvertLayer3Input from a JSON string port_convert_layer3_input_instance = PortConvertLayer3Input.from_json(json) # print the JSON string representation of the object -print PortConvertLayer3Input.to_json() +print(PortConvertLayer3Input.to_json()) # convert the object into a dict port_convert_layer3_input_dict = port_convert_layer3_input_instance.to_dict() diff --git a/equinix_metal/docs/PortConvertLayer3InputRequestIpsInner.md b/equinix_metal/docs/PortConvertLayer3InputRequestIpsInner.md index 42d68916..f0e45473 100644 --- a/equinix_metal/docs/PortConvertLayer3InputRequestIpsInner.md +++ b/equinix_metal/docs/PortConvertLayer3InputRequestIpsInner.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **address_family** | **int** | | [optional] @@ -18,7 +19,7 @@ json = "{}" # create an instance of PortConvertLayer3InputRequestIpsInner from a JSON string port_convert_layer3_input_request_ips_inner_instance = PortConvertLayer3InputRequestIpsInner.from_json(json) # print the JSON string representation of the object -print PortConvertLayer3InputRequestIpsInner.to_json() +print(PortConvertLayer3InputRequestIpsInner.to_json()) # convert the object into a dict port_convert_layer3_input_request_ips_inner_dict = port_convert_layer3_input_request_ips_inner_instance.to_dict() diff --git a/equinix_metal/docs/PortData.md b/equinix_metal/docs/PortData.md index e6dab708..226a7ef8 100644 --- a/equinix_metal/docs/PortData.md +++ b/equinix_metal/docs/PortData.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **bonded** | **bool** | Bonded is true for NetworkPort ports in a bond and NetworkBondPort ports that are active | [optional] @@ -18,7 +19,7 @@ json = "{}" # create an instance of PortData from a JSON string port_data_instance = PortData.from_json(json) # print the JSON string representation of the object -print PortData.to_json() +print(PortData.to_json()) # convert the object into a dict port_data_dict = port_data_instance.to_dict() diff --git a/equinix_metal/docs/PortVlanAssignment.md b/equinix_metal/docs/PortVlanAssignment.md index 24cca4d2..1121e478 100644 --- a/equinix_metal/docs/PortVlanAssignment.md +++ b/equinix_metal/docs/PortVlanAssignment.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **created_at** | **datetime** | | [optional] @@ -24,7 +25,7 @@ json = "{}" # create an instance of PortVlanAssignment from a JSON string port_vlan_assignment_instance = PortVlanAssignment.from_json(json) # print the JSON string representation of the object -print PortVlanAssignment.to_json() +print(PortVlanAssignment.to_json()) # convert the object into a dict port_vlan_assignment_dict = port_vlan_assignment_instance.to_dict() diff --git a/equinix_metal/docs/PortVlanAssignmentBatch.md b/equinix_metal/docs/PortVlanAssignmentBatch.md index 31b69d43..827b4e06 100644 --- a/equinix_metal/docs/PortVlanAssignmentBatch.md +++ b/equinix_metal/docs/PortVlanAssignmentBatch.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **created_at** | **datetime** | | [optional] @@ -25,7 +26,7 @@ json = "{}" # create an instance of PortVlanAssignmentBatch from a JSON string port_vlan_assignment_batch_instance = PortVlanAssignmentBatch.from_json(json) # print the JSON string representation of the object -print PortVlanAssignmentBatch.to_json() +print(PortVlanAssignmentBatch.to_json()) # convert the object into a dict port_vlan_assignment_batch_dict = port_vlan_assignment_batch_instance.to_dict() diff --git a/equinix_metal/docs/PortVlanAssignmentBatchCreateInput.md b/equinix_metal/docs/PortVlanAssignmentBatchCreateInput.md index f18572bd..b5d3b7a0 100644 --- a/equinix_metal/docs/PortVlanAssignmentBatchCreateInput.md +++ b/equinix_metal/docs/PortVlanAssignmentBatchCreateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of PortVlanAssignmentBatchCreateInput from a JSON string port_vlan_assignment_batch_create_input_instance = PortVlanAssignmentBatchCreateInput.from_json(json) # print the JSON string representation of the object -print PortVlanAssignmentBatchCreateInput.to_json() +print(PortVlanAssignmentBatchCreateInput.to_json()) # convert the object into a dict port_vlan_assignment_batch_create_input_dict = port_vlan_assignment_batch_create_input_instance.to_dict() diff --git a/equinix_metal/docs/PortVlanAssignmentBatchCreateInputVlanAssignmentsInner.md b/equinix_metal/docs/PortVlanAssignmentBatchCreateInputVlanAssignmentsInner.md index 771a784d..1b179b59 100644 --- a/equinix_metal/docs/PortVlanAssignmentBatchCreateInputVlanAssignmentsInner.md +++ b/equinix_metal/docs/PortVlanAssignmentBatchCreateInputVlanAssignmentsInner.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -19,7 +20,7 @@ json = "{}" # create an instance of PortVlanAssignmentBatchCreateInputVlanAssignmentsInner from a JSON string port_vlan_assignment_batch_create_input_vlan_assignments_inner_instance = PortVlanAssignmentBatchCreateInputVlanAssignmentsInner.from_json(json) # print the JSON string representation of the object -print PortVlanAssignmentBatchCreateInputVlanAssignmentsInner.to_json() +print(PortVlanAssignmentBatchCreateInputVlanAssignmentsInner.to_json()) # convert the object into a dict port_vlan_assignment_batch_create_input_vlan_assignments_inner_dict = port_vlan_assignment_batch_create_input_vlan_assignments_inner_instance.to_dict() diff --git a/equinix_metal/docs/PortVlanAssignmentBatchList.md b/equinix_metal/docs/PortVlanAssignmentBatchList.md index c63a1525..16f38fdf 100644 --- a/equinix_metal/docs/PortVlanAssignmentBatchList.md +++ b/equinix_metal/docs/PortVlanAssignmentBatchList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **batches** | [**List[PortVlanAssignmentBatch]**](PortVlanAssignmentBatch.md) | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of PortVlanAssignmentBatchList from a JSON string port_vlan_assignment_batch_list_instance = PortVlanAssignmentBatchList.from_json(json) # print the JSON string representation of the object -print PortVlanAssignmentBatchList.to_json() +print(PortVlanAssignmentBatchList.to_json()) # convert the object into a dict port_vlan_assignment_batch_list_dict = port_vlan_assignment_batch_list_instance.to_dict() diff --git a/equinix_metal/docs/PortVlanAssignmentBatchVlanAssignmentsInner.md b/equinix_metal/docs/PortVlanAssignmentBatchVlanAssignmentsInner.md index 1a1ee424..2f82480a 100644 --- a/equinix_metal/docs/PortVlanAssignmentBatchVlanAssignmentsInner.md +++ b/equinix_metal/docs/PortVlanAssignmentBatchVlanAssignmentsInner.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -20,7 +21,7 @@ json = "{}" # create an instance of PortVlanAssignmentBatchVlanAssignmentsInner from a JSON string port_vlan_assignment_batch_vlan_assignments_inner_instance = PortVlanAssignmentBatchVlanAssignmentsInner.from_json(json) # print the JSON string representation of the object -print PortVlanAssignmentBatchVlanAssignmentsInner.to_json() +print(PortVlanAssignmentBatchVlanAssignmentsInner.to_json()) # convert the object into a dict port_vlan_assignment_batch_vlan_assignments_inner_dict = port_vlan_assignment_batch_vlan_assignments_inner_instance.to_dict() diff --git a/equinix_metal/docs/PortVlanAssignmentList.md b/equinix_metal/docs/PortVlanAssignmentList.md index cae26a1c..a8964556 100644 --- a/equinix_metal/docs/PortVlanAssignmentList.md +++ b/equinix_metal/docs/PortVlanAssignmentList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of PortVlanAssignmentList from a JSON string port_vlan_assignment_list_instance = PortVlanAssignmentList.from_json(json) # print the JSON string representation of the object -print PortVlanAssignmentList.to_json() +print(PortVlanAssignmentList.to_json()) # convert the object into a dict port_vlan_assignment_list_dict = port_vlan_assignment_list_instance.to_dict() diff --git a/equinix_metal/docs/PortsApi.md b/equinix_metal/docs/PortsApi.md index 617907ce..caea5976 100644 --- a/equinix_metal/docs/PortsApi.md +++ b/equinix_metal/docs/PortsApi.md @@ -30,9 +30,8 @@ Sets a virtual network on this port as a \"native VLAN\". The VLAN must have alr ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.port import Port from equinix_metal.rest import ApiException @@ -76,6 +75,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Port UUID | @@ -96,6 +96,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -104,7 +105,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **assign_port** > Port assign_port(id, port_assign_input, include=include) @@ -115,9 +115,8 @@ Assign a hardware port to a virtual network. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.port import Port from equinix_metal.models.port_assign_input import PortAssignInput @@ -162,6 +161,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Port UUID | @@ -182,6 +182,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -191,7 +192,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **bond_port** > Port bond_port(id, bulk_enable=bulk_enable, include=include) @@ -202,9 +202,8 @@ Enabling bonding for one or all ports ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.port import Port from equinix_metal.rest import ApiException @@ -248,6 +247,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Port UUID | @@ -268,6 +268,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -277,7 +278,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **convert_layer2** > Port convert_layer2(id, port_assign_input, include=include) @@ -288,9 +288,8 @@ Converts a bond port to Layer 2. IP assignments of the port will be removed. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.port import Port from equinix_metal.models.port_assign_input import PortAssignInput @@ -335,6 +334,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Port UUID | @@ -355,6 +355,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -364,7 +365,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **convert_layer3** > Port convert_layer3(id, include=include, port_convert_layer3_input=port_convert_layer3_input) @@ -375,9 +375,8 @@ Converts a bond port to Layer 3. VLANs must first be unassigned. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.port import Port from equinix_metal.models.port_convert_layer3_input import PortConvertLayer3Input @@ -422,6 +421,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Port UUID | @@ -442,6 +442,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -451,7 +452,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **create_port_vlan_assignment_batch** > PortVlanAssignmentBatch create_port_vlan_assignment_batch(id, port_vlan_assignment_batch_create_input, include=include) @@ -462,9 +462,8 @@ Create a new asynchronous batch request which handles adding and/or removing the ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.port_vlan_assignment_batch import PortVlanAssignmentBatch from equinix_metal.models.port_vlan_assignment_batch_create_input import PortVlanAssignmentBatchCreateInput @@ -509,6 +508,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Port UUID | @@ -529,6 +529,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | created | - | @@ -538,7 +539,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **delete_native_vlan** > Port delete_native_vlan(id, include=include) @@ -549,9 +549,8 @@ Removes the native VLAN from this port ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.port import Port from equinix_metal.rest import ApiException @@ -594,6 +593,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Port UUID | @@ -613,6 +613,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -621,7 +622,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **disbond_port** > Port disbond_port(id, bulk_disable=bulk_disable, include=include) @@ -632,9 +632,8 @@ Disabling bonding for one or all ports ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.port import Port from equinix_metal.rest import ApiException @@ -678,6 +677,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Port UUID | @@ -698,6 +698,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -707,7 +708,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_port_by_id** > Port find_port_by_id(id, include=include) @@ -718,9 +718,8 @@ Returns a port ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.port import Port from equinix_metal.rest import ApiException @@ -763,6 +762,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Port UUID | @@ -782,6 +782,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -789,7 +790,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_port_vlan_assignment_batch_by_port_id_and_batch_id** > PortVlanAssignmentBatch find_port_vlan_assignment_batch_by_port_id_and_batch_id(id, batch_id, include=include) @@ -800,9 +800,8 @@ Returns the details of an existing Port-VLAN Assignment batch, including the lis ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.port_vlan_assignment_batch import PortVlanAssignmentBatch from equinix_metal.rest import ApiException @@ -846,6 +845,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Port UUID | @@ -866,6 +866,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -874,7 +875,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_port_vlan_assignment_batches** > PortVlanAssignmentBatchList find_port_vlan_assignment_batches(id) @@ -885,9 +885,8 @@ Show all the VLAN assignment batches that have been created for managing this po ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.port_vlan_assignment_batch_list import PortVlanAssignmentBatchList from equinix_metal.rest import ApiException @@ -929,6 +928,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Port UUID | @@ -947,6 +947,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -955,7 +956,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_port_vlan_assignment_by_port_id_and_assignment_id** > PortVlanAssignment find_port_vlan_assignment_by_port_id_and_assignment_id(id, assignment_id, include=include) @@ -966,9 +966,8 @@ Show the details of a specific Port-VLAN assignment, including the current state ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.port_vlan_assignment import PortVlanAssignment from equinix_metal.rest import ApiException @@ -1012,6 +1011,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Port UUID | @@ -1032,6 +1032,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -1040,7 +1041,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_port_vlan_assignments** > PortVlanAssignmentList find_port_vlan_assignments(id, include=include) @@ -1051,9 +1051,8 @@ Show the port's current VLAN assignments, including if this VLAN is set as nativ ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.port_vlan_assignment_list import PortVlanAssignmentList from equinix_metal.rest import ApiException @@ -1096,6 +1095,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Port UUID | @@ -1115,6 +1115,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -1123,7 +1124,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **unassign_port** > Port unassign_port(id, port_assign_input, include=include) @@ -1134,9 +1134,8 @@ Unassign a port for a hardware. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.port import Port from equinix_metal.models.port_assign_input import PortAssignInput @@ -1181,6 +1180,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Port UUID | @@ -1201,6 +1201,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -1210,4 +1211,3 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/Project.md b/equinix_metal/docs/Project.md index e3822b54..4bf1667f 100644 --- a/equinix_metal/docs/Project.md +++ b/equinix_metal/docs/Project.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **backend_transfer_enabled** | **bool** | | [optional] @@ -35,7 +36,7 @@ json = "{}" # create an instance of Project from a JSON string project_instance = Project.from_json(json) # print the JSON string representation of the object -print Project.to_json() +print(Project.to_json()) # convert the object into a dict project_dict = project_instance.to_dict() diff --git a/equinix_metal/docs/ProjectCreateFromRootInput.md b/equinix_metal/docs/ProjectCreateFromRootInput.md index 20c7cfaa..5f8d838e 100644 --- a/equinix_metal/docs/ProjectCreateFromRootInput.md +++ b/equinix_metal/docs/ProjectCreateFromRootInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **customdata** | **object** | | [optional] @@ -22,7 +23,7 @@ json = "{}" # create an instance of ProjectCreateFromRootInput from a JSON string project_create_from_root_input_instance = ProjectCreateFromRootInput.from_json(json) # print the JSON string representation of the object -print ProjectCreateFromRootInput.to_json() +print(ProjectCreateFromRootInput.to_json()) # convert the object into a dict project_create_from_root_input_dict = project_create_from_root_input_instance.to_dict() diff --git a/equinix_metal/docs/ProjectCreateInput.md b/equinix_metal/docs/ProjectCreateInput.md index 6778bebc..16e1c205 100644 --- a/equinix_metal/docs/ProjectCreateInput.md +++ b/equinix_metal/docs/ProjectCreateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **customdata** | **object** | | [optional] @@ -21,7 +22,7 @@ json = "{}" # create an instance of ProjectCreateInput from a JSON string project_create_input_instance = ProjectCreateInput.from_json(json) # print the JSON string representation of the object -print ProjectCreateInput.to_json() +print(ProjectCreateInput.to_json()) # convert the object into a dict project_create_input_dict = project_create_input_instance.to_dict() diff --git a/equinix_metal/docs/ProjectIdName.md b/equinix_metal/docs/ProjectIdName.md index c8d98fc3..debf895d 100644 --- a/equinix_metal/docs/ProjectIdName.md +++ b/equinix_metal/docs/ProjectIdName.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -18,7 +19,7 @@ json = "{}" # create an instance of ProjectIdName from a JSON string project_id_name_instance = ProjectIdName.from_json(json) # print the JSON string representation of the object -print ProjectIdName.to_json() +print(ProjectIdName.to_json()) # convert the object into a dict project_id_name_dict = project_id_name_instance.to_dict() diff --git a/equinix_metal/docs/ProjectList.md b/equinix_metal/docs/ProjectList.md index a047b22e..b700604b 100644 --- a/equinix_metal/docs/ProjectList.md +++ b/equinix_metal/docs/ProjectList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -18,7 +19,7 @@ json = "{}" # create an instance of ProjectList from a JSON string project_list_instance = ProjectList.from_json(json) # print the JSON string representation of the object -print ProjectList.to_json() +print(ProjectList.to_json()) # convert the object into a dict project_list_dict = project_list_instance.to_dict() diff --git a/equinix_metal/docs/ProjectUpdateInput.md b/equinix_metal/docs/ProjectUpdateInput.md index bf061262..4b421904 100644 --- a/equinix_metal/docs/ProjectUpdateInput.md +++ b/equinix_metal/docs/ProjectUpdateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **backend_transfer_enabled** | **bool** | | [optional] @@ -21,7 +22,7 @@ json = "{}" # create an instance of ProjectUpdateInput from a JSON string project_update_input_instance = ProjectUpdateInput.from_json(json) # print the JSON string representation of the object -print ProjectUpdateInput.to_json() +print(ProjectUpdateInput.to_json()) # convert the object into a dict project_update_input_dict = project_update_input_instance.to_dict() diff --git a/equinix_metal/docs/ProjectUsage.md b/equinix_metal/docs/ProjectUsage.md index 2981c1c9..e015bfbc 100644 --- a/equinix_metal/docs/ProjectUsage.md +++ b/equinix_metal/docs/ProjectUsage.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **facility** | **str** | | [optional] @@ -25,7 +26,7 @@ json = "{}" # create an instance of ProjectUsage from a JSON string project_usage_instance = ProjectUsage.from_json(json) # print the JSON string representation of the object -print ProjectUsage.to_json() +print(ProjectUsage.to_json()) # convert the object into a dict project_usage_dict = project_usage_instance.to_dict() diff --git a/equinix_metal/docs/ProjectUsageList.md b/equinix_metal/docs/ProjectUsageList.md index 5a7ae06c..fe64febb 100644 --- a/equinix_metal/docs/ProjectUsageList.md +++ b/equinix_metal/docs/ProjectUsageList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of ProjectUsageList from a JSON string project_usage_list_instance = ProjectUsageList.from_json(json) # print the JSON string representation of the object -print ProjectUsageList.to_json() +print(ProjectUsageList.to_json()) # convert the object into a dict project_usage_list_dict = project_usage_list_instance.to_dict() diff --git a/equinix_metal/docs/ProjectsApi.md b/equinix_metal/docs/ProjectsApi.md index bdf77b3b..17452073 100644 --- a/equinix_metal/docs/ProjectsApi.md +++ b/equinix_metal/docs/ProjectsApi.md @@ -28,9 +28,8 @@ Creates a new project for the user's default organization. If the user does not ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.project import Project from equinix_metal.models.project_create_from_root_input import ProjectCreateFromRootInput @@ -75,6 +74,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **project_create_from_root_input** | [**ProjectCreateFromRootInput**](ProjectCreateFromRootInput.md)| Project to create | @@ -95,6 +95,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | created | - | @@ -102,7 +103,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **create_project_invitation** > Invitation create_project_invitation(project_id, invitation_input, include=include) @@ -113,9 +113,8 @@ In order to add a user to a project, they must first be invited. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.invitation import Invitation from equinix_metal.models.invitation_input import InvitationInput @@ -160,6 +159,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **project_id** | **str**| Project UUID | @@ -180,6 +180,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | created | - | @@ -189,7 +190,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **create_transfer_request** > TransferRequest create_transfer_request(id, transfer_request_input, include=include) @@ -200,9 +200,8 @@ Organization owners can transfer their projects to other organizations. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.transfer_request import TransferRequest from equinix_metal.models.transfer_request_input import TransferRequestInput @@ -247,6 +246,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| UUID of the project to be transferred | @@ -267,6 +267,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | created | - | @@ -276,7 +277,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **delete_project** > delete_project(id) @@ -287,9 +287,8 @@ Deletes the project. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -328,6 +327,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Project UUID | @@ -346,6 +346,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **204** | no content | - | @@ -354,7 +355,6 @@ void (empty response body) **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_ip_reservation_customdata** > find_ip_reservation_customdata(project_id, id) @@ -365,9 +365,8 @@ Provides the custom metadata stored for this IP Reservation in json format ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -407,6 +406,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **project_id** | **str**| Project UUID | @@ -426,6 +426,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -434,7 +435,6 @@ void (empty response body) **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_project_by_id** > Project find_project_by_id(id, include=include, exclude=exclude) @@ -445,9 +445,8 @@ Returns a single project if the user has access ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.project import Project from equinix_metal.rest import ApiException @@ -491,6 +490,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Project UUID | @@ -511,6 +511,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -519,7 +520,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_project_customdata** > find_project_customdata(id) @@ -530,9 +530,8 @@ Provides the custom metadata stored for this project in json format ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -571,6 +570,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Project UUID | @@ -589,6 +589,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -597,7 +598,6 @@ void (empty response body) **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_project_invitations** > InvitationList find_project_invitations(project_id, include=include, page=page, per_page=per_page) @@ -608,9 +608,8 @@ Returns all invitations in a project. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.invitation_list import InvitationList from equinix_metal.rest import ApiException @@ -655,6 +654,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **project_id** | **str**| Project UUID | @@ -676,6 +676,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -684,7 +685,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_project_memberships** > MembershipList find_project_memberships(project_id, search=search, include=include, page=page, per_page=per_page) @@ -695,9 +695,8 @@ Returns all memberships in a project. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.membership_list import MembershipList from equinix_metal.rest import ApiException @@ -743,6 +742,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **project_id** | **str**| Project UUID | @@ -765,6 +765,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -773,7 +774,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_projects** > ProjectList find_projects(name=name, include=include, exclude=exclude, page=page, per_page=per_page) @@ -784,9 +784,8 @@ Returns a collection of projects that the current user is a member of. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.project_list import ProjectList from equinix_metal.rest import ApiException @@ -832,6 +831,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **name** | **str**| Filter results by name. | [optional] @@ -854,18 +854,16 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | **401** | unauthorized | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_projects_all_pages** > ProjectList find_projects_all_pages(name=name, include=include, exclude=exclude, per_page=per_page) - Just like [**find_projects**](ProjectsApi.md#find_projects) but fetches resources from all pages. This method doesn't take `page` parameter. Other parameters, return type and other characteristics are the same as in [**find_projects**](ProjectsApi.md#find_projects). - # **update_project** > Project update_project(id, project_update_input, include=include, exclude=exclude) @@ -876,9 +874,8 @@ Updates the project. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.project import Project from equinix_metal.models.project_update_input import ProjectUpdateInput @@ -924,6 +921,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Project UUID | @@ -945,6 +943,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -954,4 +953,3 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/Raid.md b/equinix_metal/docs/Raid.md index c8aec72b..a7b74406 100644 --- a/equinix_metal/docs/Raid.md +++ b/equinix_metal/docs/Raid.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **devices** | **List[str]** | | [optional] @@ -19,7 +20,7 @@ json = "{}" # create an instance of Raid from a JSON string raid_instance = Raid.from_json(json) # print the JSON string representation of the object -print Raid.to_json() +print(Raid.to_json()) # convert the object into a dict raid_dict = raid_instance.to_dict() diff --git a/equinix_metal/docs/RecoveryCodeList.md b/equinix_metal/docs/RecoveryCodeList.md index bf5a5044..8332075a 100644 --- a/equinix_metal/docs/RecoveryCodeList.md +++ b/equinix_metal/docs/RecoveryCodeList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of RecoveryCodeList from a JSON string recovery_code_list_instance = RecoveryCodeList.from_json(json) # print the JSON string representation of the object -print RecoveryCodeList.to_json() +print(RecoveryCodeList.to_json()) # convert the object into a dict recovery_code_list_dict = recovery_code_list_instance.to_dict() diff --git a/equinix_metal/docs/RequestIPReservation201Response.md b/equinix_metal/docs/RequestIPReservation201Response.md index ed305a1a..07d0ba6a 100644 --- a/equinix_metal/docs/RequestIPReservation201Response.md +++ b/equinix_metal/docs/RequestIPReservation201Response.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **addon** | **bool** | | [optional] @@ -46,7 +47,7 @@ json = "{}" # create an instance of RequestIPReservation201Response from a JSON string request_ip_reservation201_response_instance = RequestIPReservation201Response.from_json(json) # print the JSON string representation of the object -print RequestIPReservation201Response.to_json() +print(RequestIPReservation201Response.to_json()) # convert the object into a dict request_ip_reservation201_response_dict = request_ip_reservation201_response_instance.to_dict() diff --git a/equinix_metal/docs/RequestIPReservationRequest.md b/equinix_metal/docs/RequestIPReservationRequest.md index 8516d43b..2b664050 100644 --- a/equinix_metal/docs/RequestIPReservationRequest.md +++ b/equinix_metal/docs/RequestIPReservationRequest.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **comments** | **str** | | [optional] @@ -28,7 +29,7 @@ json = "{}" # create an instance of RequestIPReservationRequest from a JSON string request_ip_reservation_request_instance = RequestIPReservationRequest.from_json(json) # print the JSON string representation of the object -print RequestIPReservationRequest.to_json() +print(RequestIPReservationRequest.to_json()) # convert the object into a dict request_ip_reservation_request_dict = request_ip_reservation_request_instance.to_dict() diff --git a/equinix_metal/docs/SSHKey.md b/equinix_metal/docs/SSHKey.md index cd713bc0..f6511a78 100644 --- a/equinix_metal/docs/SSHKey.md +++ b/equinix_metal/docs/SSHKey.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **created_at** | **datetime** | | [optional] @@ -24,7 +25,7 @@ json = "{}" # create an instance of SSHKey from a JSON string ssh_key_instance = SSHKey.from_json(json) # print the JSON string representation of the object -print SSHKey.to_json() +print(SSHKey.to_json()) # convert the object into a dict ssh_key_dict = ssh_key_instance.to_dict() diff --git a/equinix_metal/docs/SSHKeyCreateInput.md b/equinix_metal/docs/SSHKeyCreateInput.md index 5207e9b2..32cad51a 100644 --- a/equinix_metal/docs/SSHKeyCreateInput.md +++ b/equinix_metal/docs/SSHKeyCreateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -20,7 +21,7 @@ json = "{}" # create an instance of SSHKeyCreateInput from a JSON string ssh_key_create_input_instance = SSHKeyCreateInput.from_json(json) # print the JSON string representation of the object -print SSHKeyCreateInput.to_json() +print(SSHKeyCreateInput.to_json()) # convert the object into a dict ssh_key_create_input_dict = ssh_key_create_input_instance.to_dict() diff --git a/equinix_metal/docs/SSHKeyInput.md b/equinix_metal/docs/SSHKeyInput.md index 555488e0..e45eb3c3 100644 --- a/equinix_metal/docs/SSHKeyInput.md +++ b/equinix_metal/docs/SSHKeyInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -19,7 +20,7 @@ json = "{}" # create an instance of SSHKeyInput from a JSON string ssh_key_input_instance = SSHKeyInput.from_json(json) # print the JSON string representation of the object -print SSHKeyInput.to_json() +print(SSHKeyInput.to_json()) # convert the object into a dict ssh_key_input_dict = ssh_key_input_instance.to_dict() diff --git a/equinix_metal/docs/SSHKeyList.md b/equinix_metal/docs/SSHKeyList.md index e7057bfa..93b50e8c 100644 --- a/equinix_metal/docs/SSHKeyList.md +++ b/equinix_metal/docs/SSHKeyList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of SSHKeyList from a JSON string ssh_key_list_instance = SSHKeyList.from_json(json) # print the JSON string representation of the object -print SSHKeyList.to_json() +print(SSHKeyList.to_json()) # convert the object into a dict ssh_key_list_dict = ssh_key_list_instance.to_dict() diff --git a/equinix_metal/docs/SSHKeysApi.md b/equinix_metal/docs/SSHKeysApi.md index 0aa567fc..e69c4ee2 100644 --- a/equinix_metal/docs/SSHKeysApi.md +++ b/equinix_metal/docs/SSHKeysApi.md @@ -24,9 +24,8 @@ Creates a ssh key. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.ssh_key import SSHKey from equinix_metal.models.ssh_key_create_input import SSHKeyCreateInput @@ -71,6 +70,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Project UUID | @@ -91,6 +91,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | created | - | @@ -98,7 +99,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **create_ssh_key** > SSHKey create_ssh_key(ssh_key_create_input, include=include) @@ -109,9 +109,8 @@ Creates a ssh key. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.ssh_key import SSHKey from equinix_metal.models.ssh_key_create_input import SSHKeyCreateInput @@ -155,6 +154,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ssh_key_create_input** | [**SSHKeyCreateInput**](SSHKeyCreateInput.md)| ssh key to create | @@ -174,6 +174,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | created | - | @@ -181,7 +182,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **delete_ssh_key** > delete_ssh_key(id) @@ -192,9 +192,8 @@ Deletes the ssh key. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -233,6 +232,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| ssh key UUID | @@ -251,6 +251,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **204** | no content | - | @@ -259,7 +260,6 @@ void (empty response body) **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_device_ssh_keys** > SSHKeyList find_device_ssh_keys(id, search_string=search_string, include=include) @@ -270,9 +270,8 @@ Returns a collection of the device's ssh keys. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.ssh_key_list import SSHKeyList from equinix_metal.rest import ApiException @@ -316,6 +315,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Project UUID | @@ -336,13 +336,13 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | **401** | unauthorized | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_project_ssh_keys** > SSHKeyList find_project_ssh_keys(id, query=query, include=include) @@ -353,9 +353,8 @@ Returns a collection of the project's ssh keys. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.ssh_key_list import SSHKeyList from equinix_metal.rest import ApiException @@ -399,6 +398,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Project UUID | @@ -419,13 +419,13 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | **401** | unauthorized | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_ssh_key_by_id** > SSHKey find_ssh_key_by_id(id, include=include) @@ -436,9 +436,8 @@ Returns a single ssh key if the user has access ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.ssh_key import SSHKey from equinix_metal.rest import ApiException @@ -481,6 +480,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| SSH Key UUID | @@ -500,6 +500,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -508,7 +509,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_ssh_keys** > SSHKeyList find_ssh_keys(search=search, include=include) @@ -519,9 +519,8 @@ Returns a collection of the user’s ssh keys. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.ssh_key_list import SSHKeyList from equinix_metal.rest import ApiException @@ -564,6 +563,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **search** | **str**| Search by key, label, or fingerprint | [optional] @@ -583,13 +583,13 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | **401** | unauthorized | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **update_ssh_key** > SSHKey update_ssh_key(id, ssh_key_input, include=include) @@ -600,9 +600,8 @@ Updates the ssh key. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.ssh_key import SSHKey from equinix_metal.models.ssh_key_input import SSHKeyInput @@ -647,6 +646,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| SSH Key UUID | @@ -667,6 +667,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -676,4 +677,3 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/SelfServiceReservationItemRequest.md b/equinix_metal/docs/SelfServiceReservationItemRequest.md index 6df69bc2..454bffe3 100644 --- a/equinix_metal/docs/SelfServiceReservationItemRequest.md +++ b/equinix_metal/docs/SelfServiceReservationItemRequest.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **amount** | **float** | | [optional] @@ -21,7 +22,7 @@ json = "{}" # create an instance of SelfServiceReservationItemRequest from a JSON string self_service_reservation_item_request_instance = SelfServiceReservationItemRequest.from_json(json) # print the JSON string representation of the object -print SelfServiceReservationItemRequest.to_json() +print(SelfServiceReservationItemRequest.to_json()) # convert the object into a dict self_service_reservation_item_request_dict = self_service_reservation_item_request_instance.to_dict() diff --git a/equinix_metal/docs/SelfServiceReservationItemResponse.md b/equinix_metal/docs/SelfServiceReservationItemResponse.md index 20730a64..6f28e3b5 100644 --- a/equinix_metal/docs/SelfServiceReservationItemResponse.md +++ b/equinix_metal/docs/SelfServiceReservationItemResponse.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **amount** | **float** | | [optional] @@ -28,7 +29,7 @@ json = "{}" # create an instance of SelfServiceReservationItemResponse from a JSON string self_service_reservation_item_response_instance = SelfServiceReservationItemResponse.from_json(json) # print the JSON string representation of the object -print SelfServiceReservationItemResponse.to_json() +print(SelfServiceReservationItemResponse.to_json()) # convert the object into a dict self_service_reservation_item_response_dict = self_service_reservation_item_response_instance.to_dict() diff --git a/equinix_metal/docs/SelfServiceReservationList.md b/equinix_metal/docs/SelfServiceReservationList.md index 86fb2c7f..a17bc3bb 100644 --- a/equinix_metal/docs/SelfServiceReservationList.md +++ b/equinix_metal/docs/SelfServiceReservationList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of SelfServiceReservationList from a JSON string self_service_reservation_list_instance = SelfServiceReservationList.from_json(json) # print the JSON string representation of the object -print SelfServiceReservationList.to_json() +print(SelfServiceReservationList.to_json()) # convert the object into a dict self_service_reservation_list_dict = self_service_reservation_list_instance.to_dict() diff --git a/equinix_metal/docs/SelfServiceReservationResponse.md b/equinix_metal/docs/SelfServiceReservationResponse.md index d0a79b63..b5f669a7 100644 --- a/equinix_metal/docs/SelfServiceReservationResponse.md +++ b/equinix_metal/docs/SelfServiceReservationResponse.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **created_at** | **datetime** | | [optional] @@ -27,7 +28,7 @@ json = "{}" # create an instance of SelfServiceReservationResponse from a JSON string self_service_reservation_response_instance = SelfServiceReservationResponse.from_json(json) # print the JSON string representation of the object -print SelfServiceReservationResponse.to_json() +print(SelfServiceReservationResponse.to_json()) # convert the object into a dict self_service_reservation_response_dict = self_service_reservation_response_instance.to_dict() diff --git a/equinix_metal/docs/SelfServiceReservationsApi.md b/equinix_metal/docs/SelfServiceReservationsApi.md index 9ed29978..4c7d0514 100644 --- a/equinix_metal/docs/SelfServiceReservationsApi.md +++ b/equinix_metal/docs/SelfServiceReservationsApi.md @@ -19,9 +19,8 @@ Creates a reservation. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.create_self_service_reservation_request import CreateSelfServiceReservationRequest from equinix_metal.models.self_service_reservation_response import SelfServiceReservationResponse @@ -65,6 +64,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **project_id** | **str**| Project UUID | @@ -84,6 +84,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | created | - | @@ -91,7 +92,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_self_service_reservation** > SelfServiceReservationResponse find_self_service_reservation(id, project_id) @@ -102,9 +102,8 @@ Returns a reservation ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.self_service_reservation_response import SelfServiceReservationResponse from equinix_metal.rest import ApiException @@ -147,6 +146,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Reservation short_id | @@ -166,6 +166,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -173,7 +174,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_self_service_reservations** > SelfServiceReservationList find_self_service_reservations(project_id, page=page, per_page=per_page, categories=categories) @@ -184,9 +184,8 @@ Returns all reservations. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.self_service_reservation_list import SelfServiceReservationList from equinix_metal.rest import ApiException @@ -231,6 +230,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **project_id** | **str**| Project UUID | @@ -252,10 +252,10 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | **401** | unauthorized | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/ServerInfo.md b/equinix_metal/docs/ServerInfo.md index 22902923..baa558ed 100644 --- a/equinix_metal/docs/ServerInfo.md +++ b/equinix_metal/docs/ServerInfo.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **facility** | **str** | | [optional] @@ -20,7 +21,7 @@ json = "{}" # create an instance of ServerInfo from a JSON string server_info_instance = ServerInfo.from_json(json) # print the JSON string representation of the object -print ServerInfo.to_json() +print(ServerInfo.to_json()) # convert the object into a dict server_info_dict = server_info_instance.to_dict() diff --git a/equinix_metal/docs/SharedPortVCVlanCreateInput.md b/equinix_metal/docs/SharedPortVCVlanCreateInput.md index c4f0f9b7..bc6c30f3 100644 --- a/equinix_metal/docs/SharedPortVCVlanCreateInput.md +++ b/equinix_metal/docs/SharedPortVCVlanCreateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **contact_email** | **str** | The preferred email used for communication and notifications about the Equinix Fabric interconnection. Required when using a Project API key. Optional and defaults to the primary user email address when using a User API key. | [optional] @@ -25,7 +26,7 @@ json = "{}" # create an instance of SharedPortVCVlanCreateInput from a JSON string shared_port_vc_vlan_create_input_instance = SharedPortVCVlanCreateInput.from_json(json) # print the JSON string representation of the object -print SharedPortVCVlanCreateInput.to_json() +print(SharedPortVCVlanCreateInput.to_json()) # convert the object into a dict shared_port_vc_vlan_create_input_dict = shared_port_vc_vlan_create_input_instance.to_dict() diff --git a/equinix_metal/docs/SpotMarketApi.md b/equinix_metal/docs/SpotMarketApi.md index ca455c2e..c27a123e 100644 --- a/equinix_metal/docs/SpotMarketApi.md +++ b/equinix_metal/docs/SpotMarketApi.md @@ -23,9 +23,8 @@ Creates a new spot market request. Type-specific options (such as operating_sys ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.spot_market_request import SpotMarketRequest from equinix_metal.models.spot_market_request_create_input import SpotMarketRequestCreateInput @@ -69,6 +68,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Project UUID | @@ -88,6 +88,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | created | - | @@ -96,7 +97,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **delete_spot_market_request** > delete_spot_market_request(id, force_termination=force_termination) @@ -107,9 +107,8 @@ Deletes the spot market request. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -149,6 +148,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| SpotMarketRequest UUID | @@ -168,6 +168,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **204** | no content | - | @@ -176,7 +177,6 @@ void (empty response body) **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_metro_spot_market_prices** > SpotMarketPricesPerMetroList find_metro_spot_market_prices(metro=metro, plan=plan) @@ -187,9 +187,8 @@ Get Equinix Metal current spot market prices for all metros. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.spot_market_prices_per_metro_list import SpotMarketPricesPerMetroList from equinix_metal.rest import ApiException @@ -232,6 +231,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **metro** | **str**| Metro to filter spot market prices | [optional] @@ -251,6 +251,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -258,7 +259,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_spot_market_prices** > SpotMarketPricesList find_spot_market_prices(facility=facility, plan=plan) @@ -269,9 +269,8 @@ Get Equinix Metal current spot market prices. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.spot_market_prices_list import SpotMarketPricesList from equinix_metal.rest import ApiException @@ -314,6 +313,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **facility** | **str**| Facility to check spot market prices | [optional] @@ -333,6 +333,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -340,7 +341,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_spot_market_prices_history** > SpotPricesHistoryReport find_spot_market_prices_history(facility, plan, var_from, until, metro=metro) @@ -351,9 +351,8 @@ Get spot market prices for a given plan and facility in a fixed period of time ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.spot_prices_history_report import SpotPricesHistoryReport from equinix_metal.rest import ApiException @@ -399,6 +398,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **facility** | **str**| Facility to check spot market prices | @@ -421,6 +421,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -428,7 +429,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_spot_market_request_by_id** > SpotMarketRequest find_spot_market_request_by_id(id, include=include) @@ -439,9 +439,8 @@ Returns a single spot market request ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.spot_market_request import SpotMarketRequest from equinix_metal.rest import ApiException @@ -484,6 +483,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| SpotMarketRequest UUID | @@ -503,6 +503,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -511,7 +512,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **list_spot_market_requests** > SpotMarketRequestList list_spot_market_requests(id) @@ -522,9 +522,8 @@ View all spot market requests for a given project. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.spot_market_request_list import SpotMarketRequestList from equinix_metal.rest import ApiException @@ -566,6 +565,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Project UUID | @@ -584,6 +584,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -591,4 +592,3 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/SpotMarketPricesList.md b/equinix_metal/docs/SpotMarketPricesList.md index 9d2f2ffc..753012c3 100644 --- a/equinix_metal/docs/SpotMarketPricesList.md +++ b/equinix_metal/docs/SpotMarketPricesList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of SpotMarketPricesList from a JSON string spot_market_prices_list_instance = SpotMarketPricesList.from_json(json) # print the JSON string representation of the object -print SpotMarketPricesList.to_json() +print(SpotMarketPricesList.to_json()) # convert the object into a dict spot_market_prices_list_dict = spot_market_prices_list_instance.to_dict() diff --git a/equinix_metal/docs/SpotMarketPricesPerMetroList.md b/equinix_metal/docs/SpotMarketPricesPerMetroList.md index b89e6c2a..2abc229a 100644 --- a/equinix_metal/docs/SpotMarketPricesPerMetroList.md +++ b/equinix_metal/docs/SpotMarketPricesPerMetroList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of SpotMarketPricesPerMetroList from a JSON string spot_market_prices_per_metro_list_instance = SpotMarketPricesPerMetroList.from_json(json) # print the JSON string representation of the object -print SpotMarketPricesPerMetroList.to_json() +print(SpotMarketPricesPerMetroList.to_json()) # convert the object into a dict spot_market_prices_per_metro_list_dict = spot_market_prices_per_metro_list_instance.to_dict() diff --git a/equinix_metal/docs/SpotMarketPricesPerMetroReport.md b/equinix_metal/docs/SpotMarketPricesPerMetroReport.md index 2388e132..43982173 100644 --- a/equinix_metal/docs/SpotMarketPricesPerMetroReport.md +++ b/equinix_metal/docs/SpotMarketPricesPerMetroReport.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **am** | [**SpotPricesPerFacility**](SpotPricesPerFacility.md) | | [optional] @@ -23,7 +24,7 @@ json = "{}" # create an instance of SpotMarketPricesPerMetroReport from a JSON string spot_market_prices_per_metro_report_instance = SpotMarketPricesPerMetroReport.from_json(json) # print the JSON string representation of the object -print SpotMarketPricesPerMetroReport.to_json() +print(SpotMarketPricesPerMetroReport.to_json()) # convert the object into a dict spot_market_prices_per_metro_report_dict = spot_market_prices_per_metro_report_instance.to_dict() diff --git a/equinix_metal/docs/SpotMarketRequest.md b/equinix_metal/docs/SpotMarketRequest.md index 6c6adb80..e42050a7 100644 --- a/equinix_metal/docs/SpotMarketRequest.md +++ b/equinix_metal/docs/SpotMarketRequest.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **created_at** | **datetime** | | [optional] @@ -26,7 +27,7 @@ json = "{}" # create an instance of SpotMarketRequest from a JSON string spot_market_request_instance = SpotMarketRequest.from_json(json) # print the JSON string representation of the object -print SpotMarketRequest.to_json() +print(SpotMarketRequest.to_json()) # convert the object into a dict spot_market_request_dict = spot_market_request_instance.to_dict() diff --git a/equinix_metal/docs/SpotMarketRequestCreateInput.md b/equinix_metal/docs/SpotMarketRequestCreateInput.md index e24a5eea..9272293f 100644 --- a/equinix_metal/docs/SpotMarketRequestCreateInput.md +++ b/equinix_metal/docs/SpotMarketRequestCreateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **devices_max** | **int** | | [optional] @@ -23,7 +24,7 @@ json = "{}" # create an instance of SpotMarketRequestCreateInput from a JSON string spot_market_request_create_input_instance = SpotMarketRequestCreateInput.from_json(json) # print the JSON string representation of the object -print SpotMarketRequestCreateInput.to_json() +print(SpotMarketRequestCreateInput.to_json()) # convert the object into a dict spot_market_request_create_input_dict = spot_market_request_create_input_instance.to_dict() diff --git a/equinix_metal/docs/SpotMarketRequestCreateInputInstanceParameters.md b/equinix_metal/docs/SpotMarketRequestCreateInputInstanceParameters.md index 1b0cf4b4..0cf353b6 100644 --- a/equinix_metal/docs/SpotMarketRequestCreateInputInstanceParameters.md +++ b/equinix_metal/docs/SpotMarketRequestCreateInputInstanceParameters.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **always_pxe** | **bool** | | [optional] @@ -34,7 +35,7 @@ json = "{}" # create an instance of SpotMarketRequestCreateInputInstanceParameters from a JSON string spot_market_request_create_input_instance_parameters_instance = SpotMarketRequestCreateInputInstanceParameters.from_json(json) # print the JSON string representation of the object -print SpotMarketRequestCreateInputInstanceParameters.to_json() +print(SpotMarketRequestCreateInputInstanceParameters.to_json()) # convert the object into a dict spot_market_request_create_input_instance_parameters_dict = spot_market_request_create_input_instance_parameters_instance.to_dict() diff --git a/equinix_metal/docs/SpotMarketRequestList.md b/equinix_metal/docs/SpotMarketRequestList.md index 932907ee..565c4d62 100644 --- a/equinix_metal/docs/SpotMarketRequestList.md +++ b/equinix_metal/docs/SpotMarketRequestList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of SpotMarketRequestList from a JSON string spot_market_request_list_instance = SpotMarketRequestList.from_json(json) # print the JSON string representation of the object -print SpotMarketRequestList.to_json() +print(SpotMarketRequestList.to_json()) # convert the object into a dict spot_market_request_list_dict = spot_market_request_list_instance.to_dict() diff --git a/equinix_metal/docs/SpotMarketRequestMetro.md b/equinix_metal/docs/SpotMarketRequestMetro.md index 907f3a21..47a19097 100644 --- a/equinix_metal/docs/SpotMarketRequestMetro.md +++ b/equinix_metal/docs/SpotMarketRequestMetro.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **code** | **str** | | [optional] @@ -20,7 +21,7 @@ json = "{}" # create an instance of SpotMarketRequestMetro from a JSON string spot_market_request_metro_instance = SpotMarketRequestMetro.from_json(json) # print the JSON string representation of the object -print SpotMarketRequestMetro.to_json() +print(SpotMarketRequestMetro.to_json()) # convert the object into a dict spot_market_request_metro_dict = spot_market_request_metro_instance.to_dict() diff --git a/equinix_metal/docs/SpotPricesDatapoints.md b/equinix_metal/docs/SpotPricesDatapoints.md index 5f2bafc9..ae45b31b 100644 --- a/equinix_metal/docs/SpotPricesDatapoints.md +++ b/equinix_metal/docs/SpotPricesDatapoints.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **datapoints** | **List[List[float]]** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of SpotPricesDatapoints from a JSON string spot_prices_datapoints_instance = SpotPricesDatapoints.from_json(json) # print the JSON string representation of the object -print SpotPricesDatapoints.to_json() +print(SpotPricesDatapoints.to_json()) # convert the object into a dict spot_prices_datapoints_dict = spot_prices_datapoints_instance.to_dict() diff --git a/equinix_metal/docs/SpotPricesHistoryReport.md b/equinix_metal/docs/SpotPricesHistoryReport.md index 02eac19a..baa55c46 100644 --- a/equinix_metal/docs/SpotPricesHistoryReport.md +++ b/equinix_metal/docs/SpotPricesHistoryReport.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of SpotPricesHistoryReport from a JSON string spot_prices_history_report_instance = SpotPricesHistoryReport.from_json(json) # print the JSON string representation of the object -print SpotPricesHistoryReport.to_json() +print(SpotPricesHistoryReport.to_json()) # convert the object into a dict spot_prices_history_report_dict = spot_prices_history_report_instance.to_dict() diff --git a/equinix_metal/docs/SpotPricesPerBaremetal.md b/equinix_metal/docs/SpotPricesPerBaremetal.md index 75238f9b..ba01f676 100644 --- a/equinix_metal/docs/SpotPricesPerBaremetal.md +++ b/equinix_metal/docs/SpotPricesPerBaremetal.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of SpotPricesPerBaremetal from a JSON string spot_prices_per_baremetal_instance = SpotPricesPerBaremetal.from_json(json) # print the JSON string representation of the object -print SpotPricesPerBaremetal.to_json() +print(SpotPricesPerBaremetal.to_json()) # convert the object into a dict spot_prices_per_baremetal_dict = spot_prices_per_baremetal_instance.to_dict() diff --git a/equinix_metal/docs/SpotPricesPerFacility.md b/equinix_metal/docs/SpotPricesPerFacility.md index cecea574..d4bdd44a 100644 --- a/equinix_metal/docs/SpotPricesPerFacility.md +++ b/equinix_metal/docs/SpotPricesPerFacility.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **baremetal_0** | [**SpotPricesPerBaremetal**](SpotPricesPerBaremetal.md) | | [optional] @@ -25,7 +26,7 @@ json = "{}" # create an instance of SpotPricesPerFacility from a JSON string spot_prices_per_facility_instance = SpotPricesPerFacility.from_json(json) # print the JSON string representation of the object -print SpotPricesPerFacility.to_json() +print(SpotPricesPerFacility.to_json()) # convert the object into a dict spot_prices_per_facility_dict = spot_prices_per_facility_instance.to_dict() diff --git a/equinix_metal/docs/SpotPricesPerNewFacility.md b/equinix_metal/docs/SpotPricesPerNewFacility.md index 62aeed78..0ca1299d 100644 --- a/equinix_metal/docs/SpotPricesPerNewFacility.md +++ b/equinix_metal/docs/SpotPricesPerNewFacility.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **baremetal_1e** | [**SpotPricesPerBaremetal**](SpotPricesPerBaremetal.md) | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of SpotPricesPerNewFacility from a JSON string spot_prices_per_new_facility_instance = SpotPricesPerNewFacility.from_json(json) # print the JSON string representation of the object -print SpotPricesPerNewFacility.to_json() +print(SpotPricesPerNewFacility.to_json()) # convert the object into a dict spot_prices_per_new_facility_dict = spot_prices_per_new_facility_instance.to_dict() diff --git a/equinix_metal/docs/SpotPricesReport.md b/equinix_metal/docs/SpotPricesReport.md index 07fd0e5b..657c5a17 100644 --- a/equinix_metal/docs/SpotPricesReport.md +++ b/equinix_metal/docs/SpotPricesReport.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **ams1** | [**SpotPricesPerFacility**](SpotPricesPerFacility.md) | | [optional] @@ -30,7 +31,7 @@ json = "{}" # create an instance of SpotPricesReport from a JSON string spot_prices_report_instance = SpotPricesReport.from_json(json) # print the JSON string representation of the object -print SpotPricesReport.to_json() +print(SpotPricesReport.to_json()) # convert the object into a dict spot_prices_report_dict = spot_prices_report_instance.to_dict() diff --git a/equinix_metal/docs/Storage.md b/equinix_metal/docs/Storage.md index ba6b717d..ec922902 100644 --- a/equinix_metal/docs/Storage.md +++ b/equinix_metal/docs/Storage.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **disks** | [**List[Disk]**](Disk.md) | | [optional] @@ -19,7 +20,7 @@ json = "{}" # create an instance of Storage from a JSON string storage_instance = Storage.from_json(json) # print the JSON string representation of the object -print Storage.to_json() +print(Storage.to_json()) # convert the object into a dict storage_dict = storage_instance.to_dict() diff --git a/equinix_metal/docs/SupportRequestApi.md b/equinix_metal/docs/SupportRequestApi.md index c5062696..4262012f 100644 --- a/equinix_metal/docs/SupportRequestApi.md +++ b/equinix_metal/docs/SupportRequestApi.md @@ -17,9 +17,8 @@ Support Ticket. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.support_request_input import SupportRequestInput from equinix_metal.rest import ApiException @@ -59,6 +58,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **support_request_input** | [**SupportRequestInput**](SupportRequestInput.md)| Support Request to create | @@ -77,6 +77,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **204** | no content | - | @@ -86,4 +87,3 @@ void (empty response body) **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/SupportRequestInput.md b/equinix_metal/docs/SupportRequestInput.md index f8ad747f..25c0da91 100644 --- a/equinix_metal/docs/SupportRequestInput.md +++ b/equinix_metal/docs/SupportRequestInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **device_id** | **str** | | [optional] @@ -21,7 +22,7 @@ json = "{}" # create an instance of SupportRequestInput from a JSON string support_request_input_instance = SupportRequestInput.from_json(json) # print the JSON string representation of the object -print SupportRequestInput.to_json() +print(SupportRequestInput.to_json()) # convert the object into a dict support_request_input_dict = support_request_input_instance.to_dict() diff --git a/equinix_metal/docs/TransferRequest.md b/equinix_metal/docs/TransferRequest.md index 387925fa..a09c3439 100644 --- a/equinix_metal/docs/TransferRequest.md +++ b/equinix_metal/docs/TransferRequest.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **created_at** | **datetime** | | [optional] @@ -21,7 +22,7 @@ json = "{}" # create an instance of TransferRequest from a JSON string transfer_request_instance = TransferRequest.from_json(json) # print the JSON string representation of the object -print TransferRequest.to_json() +print(TransferRequest.to_json()) # convert the object into a dict transfer_request_dict = transfer_request_instance.to_dict() diff --git a/equinix_metal/docs/TransferRequestInput.md b/equinix_metal/docs/TransferRequestInput.md index fa91817b..85ebf1b3 100644 --- a/equinix_metal/docs/TransferRequestInput.md +++ b/equinix_metal/docs/TransferRequestInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of TransferRequestInput from a JSON string transfer_request_input_instance = TransferRequestInput.from_json(json) # print the JSON string representation of the object -print TransferRequestInput.to_json() +print(TransferRequestInput.to_json()) # convert the object into a dict transfer_request_input_dict = transfer_request_input_instance.to_dict() diff --git a/equinix_metal/docs/TransferRequestList.md b/equinix_metal/docs/TransferRequestList.md index e10f2782..2411d288 100644 --- a/equinix_metal/docs/TransferRequestList.md +++ b/equinix_metal/docs/TransferRequestList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of TransferRequestList from a JSON string transfer_request_list_instance = TransferRequestList.from_json(json) # print the JSON string representation of the object -print TransferRequestList.to_json() +print(TransferRequestList.to_json()) # convert the object into a dict transfer_request_list_dict = transfer_request_list_instance.to_dict() diff --git a/equinix_metal/docs/TransferRequestsApi.md b/equinix_metal/docs/TransferRequestsApi.md index d510a945..11b9eabb 100644 --- a/equinix_metal/docs/TransferRequestsApi.md +++ b/equinix_metal/docs/TransferRequestsApi.md @@ -19,9 +19,8 @@ Accept a transfer request. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -60,6 +59,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Transfer request UUID | @@ -78,6 +78,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **204** | no content | - | @@ -86,7 +87,6 @@ void (empty response body) **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **decline_transfer_request** > decline_transfer_request(id) @@ -97,9 +97,8 @@ Decline a transfer request. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -138,6 +137,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Transfer request UUID | @@ -156,6 +156,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **204** | no content | - | @@ -164,7 +165,6 @@ void (empty response body) **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_transfer_request_by_id** > TransferRequest find_transfer_request_by_id(id, include=include) @@ -175,9 +175,8 @@ Returns a single transfer request. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.transfer_request import TransferRequest from equinix_metal.rest import ApiException @@ -220,6 +219,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Transfer request UUID | @@ -239,6 +239,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -247,4 +248,3 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/TwoFactorAuthApi.md b/equinix_metal/docs/TwoFactorAuthApi.md index f22318ed..42cdaf46 100644 --- a/equinix_metal/docs/TwoFactorAuthApi.md +++ b/equinix_metal/docs/TwoFactorAuthApi.md @@ -20,9 +20,8 @@ Disables two factor authentication. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -59,6 +58,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + This endpoint does not need any parameter. ### Return type @@ -75,6 +75,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **204** | no content | - | @@ -82,7 +83,6 @@ void (empty response body) **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **disable_tfa_sms** > disable_tfa_sms() @@ -93,9 +93,8 @@ Disables two factor authentication. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -132,6 +131,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + This endpoint does not need any parameter. ### Return type @@ -148,6 +148,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **204** | no content | - | @@ -155,7 +156,6 @@ void (empty response body) **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **enable_tfa_app** > enable_tfa_app() @@ -166,9 +166,8 @@ Enables two factor authentication using authenticator app. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -205,6 +204,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + This endpoint does not need any parameter. ### Return type @@ -221,13 +221,13 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | **401** | unauthorized | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **enable_tfa_sms** > enable_tfa_sms() @@ -238,9 +238,8 @@ Enables two factor authentication with sms. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -277,6 +276,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + This endpoint does not need any parameter. ### Return type @@ -293,10 +293,10 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | **401** | unauthorized | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/UpdateEmailInput.md b/equinix_metal/docs/UpdateEmailInput.md index e37e33cb..32764a38 100644 --- a/equinix_metal/docs/UpdateEmailInput.md +++ b/equinix_metal/docs/UpdateEmailInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **default** | **bool** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of UpdateEmailInput from a JSON string update_email_input_instance = UpdateEmailInput.from_json(json) # print the JSON string representation of the object -print UpdateEmailInput.to_json() +print(UpdateEmailInput.to_json()) # convert the object into a dict update_email_input_dict = update_email_input_instance.to_dict() diff --git a/equinix_metal/docs/UsagesApi.md b/equinix_metal/docs/UsagesApi.md index fe72fdf9..d63a88e3 100644 --- a/equinix_metal/docs/UsagesApi.md +++ b/equinix_metal/docs/UsagesApi.md @@ -18,9 +18,8 @@ Returns all usages for a device. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.device_usage_list import DeviceUsageList from equinix_metal.rest import ApiException @@ -64,6 +63,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Device UUID | @@ -84,6 +84,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -91,7 +92,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_project_usage** > ProjectUsageList find_project_usage(id, created_after=created_after, created_before=created_before) @@ -102,9 +102,8 @@ Returns all usages for a project. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.project_usage_list import ProjectUsageList from equinix_metal.rest import ApiException @@ -148,6 +147,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Project UUID | @@ -168,6 +168,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -175,4 +176,3 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/User.md b/equinix_metal/docs/User.md index aeca62fc..1e73c9d1 100644 --- a/equinix_metal/docs/User.md +++ b/equinix_metal/docs/User.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **avatar_thumb_url** | **str** | | [optional] @@ -37,7 +38,7 @@ json = "{}" # create an instance of User from a JSON string user_instance = User.from_json(json) # print the JSON string representation of the object -print User.to_json() +print(User.to_json()) # convert the object into a dict user_dict = user_instance.to_dict() diff --git a/equinix_metal/docs/UserCreateInput.md b/equinix_metal/docs/UserCreateInput.md index e3247842..05d2d48d 100644 --- a/equinix_metal/docs/UserCreateInput.md +++ b/equinix_metal/docs/UserCreateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **avatar** | **bytearray** | | [optional] @@ -33,7 +34,7 @@ json = "{}" # create an instance of UserCreateInput from a JSON string user_create_input_instance = UserCreateInput.from_json(json) # print the JSON string representation of the object -print UserCreateInput.to_json() +print(UserCreateInput.to_json()) # convert the object into a dict user_create_input_dict = user_create_input_instance.to_dict() diff --git a/equinix_metal/docs/UserLimited.md b/equinix_metal/docs/UserLimited.md index 4ef6fc4c..8e137f97 100644 --- a/equinix_metal/docs/UserLimited.md +++ b/equinix_metal/docs/UserLimited.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **avatar_thumb_url** | **str** | Avatar thumbnail URL of the User | [optional] @@ -20,7 +21,7 @@ json = "{}" # create an instance of UserLimited from a JSON string user_limited_instance = UserLimited.from_json(json) # print the JSON string representation of the object -print UserLimited.to_json() +print(UserLimited.to_json()) # convert the object into a dict user_limited_dict = user_limited_instance.to_dict() diff --git a/equinix_metal/docs/UserList.md b/equinix_metal/docs/UserList.md index 0874bd4f..0821aa7a 100644 --- a/equinix_metal/docs/UserList.md +++ b/equinix_metal/docs/UserList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -18,7 +19,7 @@ json = "{}" # create an instance of UserList from a JSON string user_list_instance = UserList.from_json(json) # print the JSON string representation of the object -print UserList.to_json() +print(UserList.to_json()) # convert the object into a dict user_list_dict = user_list_instance.to_dict() diff --git a/equinix_metal/docs/UserLite.md b/equinix_metal/docs/UserLite.md index e144fec1..31068af9 100644 --- a/equinix_metal/docs/UserLite.md +++ b/equinix_metal/docs/UserLite.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **avatar_thumb_url** | **str** | Avatar thumbnail URL of the User | [optional] @@ -25,7 +26,7 @@ json = "{}" # create an instance of UserLite from a JSON string user_lite_instance = UserLite.from_json(json) # print the JSON string representation of the object -print UserLite.to_json() +print(UserLite.to_json()) # convert the object into a dict user_lite_dict = user_lite_instance.to_dict() diff --git a/equinix_metal/docs/UserUpdateInput.md b/equinix_metal/docs/UserUpdateInput.md index 9450249c..8d219816 100644 --- a/equinix_metal/docs/UserUpdateInput.md +++ b/equinix_metal/docs/UserUpdateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **customdata** | **object** | | [optional] @@ -22,7 +23,7 @@ json = "{}" # create an instance of UserUpdateInput from a JSON string user_update_input_instance = UserUpdateInput.from_json(json) # print the JSON string representation of the object -print UserUpdateInput.to_json() +print(UserUpdateInput.to_json()) # convert the object into a dict user_update_input_dict = user_update_input_instance.to_dict() diff --git a/equinix_metal/docs/UserVerificationTokensApi.md b/equinix_metal/docs/UserVerificationTokensApi.md index 6cbc5763..96a0ec68 100644 --- a/equinix_metal/docs/UserVerificationTokensApi.md +++ b/equinix_metal/docs/UserVerificationTokensApi.md @@ -18,9 +18,8 @@ Consumes an email verification token and verifies the user associated with it. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.verify_email import VerifyEmail from equinix_metal.rest import ApiException @@ -61,6 +60,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **verify_email** | [**VerifyEmail**](VerifyEmail.md)| Email to create | @@ -80,6 +80,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -87,7 +88,6 @@ void (empty response body) **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **create_validation_request** > create_validation_request(login, include=include) @@ -98,9 +98,8 @@ Creates an email verification request ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -140,6 +139,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **login** | **str**| Email for verification request | @@ -159,6 +159,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | created | - | @@ -166,4 +167,3 @@ void (empty response body) **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/Userdata.md b/equinix_metal/docs/Userdata.md index f1bd8f35..03eff31b 100644 --- a/equinix_metal/docs/Userdata.md +++ b/equinix_metal/docs/Userdata.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of Userdata from a JSON string userdata_instance = Userdata.from_json(json) # print the JSON string representation of the object -print Userdata.to_json() +print(Userdata.to_json()) # convert the object into a dict userdata_dict = userdata_instance.to_dict() diff --git a/equinix_metal/docs/UserdataApi.md b/equinix_metal/docs/UserdataApi.md index 541cbfdb..6b1bb8f2 100644 --- a/equinix_metal/docs/UserdataApi.md +++ b/equinix_metal/docs/UserdataApi.md @@ -17,9 +17,8 @@ Validates user data (Userdata) ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -58,6 +57,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **userdata** | **str**| Userdata to validate | [optional] @@ -76,6 +76,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **204** | no content | - | @@ -83,4 +84,3 @@ void (empty response body) **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/UsersApi.md b/equinix_metal/docs/UsersApi.md index 96c8c4c8..ee679972 100644 --- a/equinix_metal/docs/UsersApi.md +++ b/equinix_metal/docs/UsersApi.md @@ -24,9 +24,8 @@ Creates a user. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.user import User from equinix_metal.models.user_create_input import UserCreateInput @@ -71,6 +70,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **user_create_input** | [**UserCreateInput**](UserCreateInput.md)| User to create | @@ -91,6 +91,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | created | - | @@ -98,7 +99,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_current_user** > User find_current_user(include=include, exclude=exclude) @@ -109,9 +109,8 @@ Returns the user object for the currently logged-in user. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.user import User from equinix_metal.rest import ApiException @@ -154,6 +153,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **include** | [**List[str]**](str.md)| Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. | [optional] @@ -173,13 +173,13 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | **401** | unauthorized | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_invitations** > InvitationList find_invitations(include=include, page=page, per_page=per_page) @@ -190,9 +190,8 @@ Returns all invitations in current user. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.invitation_list import InvitationList from equinix_metal.rest import ApiException @@ -236,6 +235,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **include** | [**List[str]**](str.md)| Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. | [optional] @@ -256,6 +256,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -264,7 +265,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_user_by_id** > User find_user_by_id(id, include=include, exclude=exclude) @@ -275,9 +275,8 @@ Returns a single user if the user has access ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.user import User from equinix_metal.rest import ApiException @@ -321,6 +320,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| User UUID | @@ -341,6 +341,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -349,7 +350,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_user_customdata** > find_user_customdata(id) @@ -360,9 +360,8 @@ Provides the custom metadata stored for this user in json format ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -401,6 +400,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| User UUID | @@ -419,6 +419,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -427,7 +428,6 @@ void (empty response body) **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_users** > UserList find_users(include=include, exclude=exclude, page=page, per_page=per_page) @@ -438,9 +438,8 @@ Returns a list of users that the are accessible to the current user (all users i ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.user_list import UserList from equinix_metal.rest import ApiException @@ -485,6 +484,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **include** | [**List[str]**](str.md)| Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. | [optional] @@ -506,18 +506,16 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | **401** | unauthorized | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_users_all_pages** > UserList find_users_all_pages(include=include, exclude=exclude, per_page=per_page) - Just like [**find_users**](UsersApi.md#find_users) but fetches resources from all pages. This method doesn't take `page` parameter. Other parameters, return type and other characteristics are the same as in [**find_users**](UsersApi.md#find_users). - # **update_current_user** > User update_current_user(user_update_input, include=include, exclude=exclude) @@ -528,9 +526,8 @@ Updates the currently logged-in user. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.user import User from equinix_metal.models.user_update_input import UserUpdateInput @@ -575,6 +572,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **user_update_input** | [**UserUpdateInput**](UserUpdateInput.md)| User to update | @@ -595,6 +593,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -602,4 +601,3 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/VLANsApi.md b/equinix_metal/docs/VLANsApi.md index 75f4e7bf..5ce1c435 100644 --- a/equinix_metal/docs/VLANsApi.md +++ b/equinix_metal/docs/VLANsApi.md @@ -20,9 +20,8 @@ Creates an virtual network. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.virtual_network import VirtualNetwork from equinix_metal.models.virtual_network_create_input import VirtualNetworkCreateInput @@ -68,6 +67,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Project UUID | @@ -89,6 +89,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | created | - | @@ -98,7 +99,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **delete_virtual_network** > VirtualNetwork delete_virtual_network(id, include=include, exclude=exclude) @@ -109,9 +109,8 @@ Deletes a virtual network. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.virtual_network import VirtualNetwork from equinix_metal.rest import ApiException @@ -155,6 +154,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Virtual Network UUID | @@ -175,6 +175,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -184,7 +185,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_virtual_networks** > VirtualNetworkList find_virtual_networks(id, include=include, exclude=exclude, facility=facility, metro=metro) @@ -195,9 +195,8 @@ Provides a list of virtual networks for a single project. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.virtual_network_list import VirtualNetworkList from equinix_metal.rest import ApiException @@ -243,6 +242,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Project UUID | @@ -265,6 +265,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -273,7 +274,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **get_virtual_network** > VirtualNetwork get_virtual_network(id, include=include, exclude=exclude) @@ -284,9 +284,8 @@ Get a virtual network. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.virtual_network import VirtualNetwork from equinix_metal.rest import ApiException @@ -330,6 +329,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Virtual Network UUID | @@ -350,6 +350,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -359,4 +360,3 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/VRFsApi.md b/equinix_metal/docs/VRFsApi.md index 33cdf288..59a7eab1 100644 --- a/equinix_metal/docs/VRFsApi.md +++ b/equinix_metal/docs/VRFsApi.md @@ -32,9 +32,8 @@ Return a single BGP Dynamic Neighbor resource ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.bgp_dynamic_neighbor import BgpDynamicNeighbor from equinix_metal.rest import ApiException @@ -78,6 +77,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| BGP Dynamic Neighbor UUID | @@ -98,6 +98,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | OK | - | @@ -105,7 +106,6 @@ Name | Type | Description | Notes **404** | Not Found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **create_bgp_dynamic_neighbor** > BgpDynamicNeighbor create_bgp_dynamic_neighbor(id, bgp_dynamic_neighbor_create_input, include=include, exclude=exclude) @@ -116,9 +116,8 @@ Create a VRF BGP Dynamic Neighbor range. BGP Dynamic Neighbor records are limit ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.bgp_dynamic_neighbor import BgpDynamicNeighbor from equinix_metal.models.bgp_dynamic_neighbor_create_input import BgpDynamicNeighborCreateInput @@ -164,6 +163,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Metal Gateway UUID | @@ -185,6 +185,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | Created | - | @@ -194,7 +195,6 @@ Name | Type | Description | Notes **422** | Unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **create_vrf** > Vrf create_vrf(id, vrf_create_input, include=include, exclude=exclude) @@ -205,9 +205,8 @@ Creates a new VRF in the specified project ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.vrf import Vrf from equinix_metal.models.vrf_create_input import VrfCreateInput @@ -253,6 +252,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Project UUID | @@ -274,6 +274,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | created | - | @@ -282,7 +283,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **create_vrf_route** > VrfRoute create_vrf_route(id, vrf_route_create_input, include=include, exclude=exclude) @@ -293,9 +293,8 @@ Create a route in a VRF. Currently only static default routes are supported. No ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.vrf_route import VrfRoute from equinix_metal.models.vrf_route_create_input import VrfRouteCreateInput @@ -341,6 +340,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| VRF UUID | @@ -362,6 +362,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | OK | - | @@ -371,7 +372,6 @@ Name | Type | Description | Notes **422** | Unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **delete_bgp_dynamic_neighbor_by_id** > BgpDynamicNeighbor delete_bgp_dynamic_neighbor_by_id(id, include=include, exclude=exclude) @@ -382,9 +382,8 @@ Trigger the removal of a BGP Neighbor range from a VRF ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.bgp_dynamic_neighbor import BgpDynamicNeighbor from equinix_metal.rest import ApiException @@ -428,6 +427,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| BGP Dynamic Neighbor UUID | @@ -448,6 +448,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **202** | Accepted | - | @@ -456,7 +457,6 @@ Name | Type | Description | Notes **404** | Not Found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **delete_vrf** > delete_vrf(id) @@ -467,9 +467,8 @@ Deletes the VRF ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.rest import ApiException from pprint import pprint @@ -508,6 +507,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| VRF UUID | @@ -526,6 +526,7 @@ void (empty response body) - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **204** | no content | - | @@ -534,7 +535,6 @@ void (empty response body) **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **delete_vrf_route_by_id** > VrfRoute delete_vrf_route_by_id(id, include=include, exclude=exclude) @@ -545,9 +545,8 @@ Trigger the deletion of a VRF Route resource. The status of the route will updat ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.vrf_route import VrfRoute from equinix_metal.rest import ApiException @@ -591,6 +590,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| VRF Route UUID | @@ -611,6 +611,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **202** | Accepted | - | @@ -619,7 +620,6 @@ Name | Type | Description | Notes **404** | Not Found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_vrf_by_id** > Vrf find_vrf_by_id(id, include=include, exclude=exclude) @@ -630,9 +630,8 @@ Returns a single VRF resource ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.vrf import Vrf from equinix_metal.rest import ApiException @@ -676,6 +675,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| VRF UUID | @@ -696,6 +696,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -704,7 +705,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_vrf_ip_reservation** > VrfIpReservation find_vrf_ip_reservation(vrf_id, id, include=include, exclude=exclude) @@ -715,9 +715,8 @@ Returns the IP Reservation for the VRF. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.vrf_ip_reservation import VrfIpReservation from equinix_metal.rest import ApiException @@ -762,6 +761,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **vrf_id** | **str**| VRF UUID | @@ -783,6 +783,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -790,7 +791,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_vrf_ip_reservations** > VrfIpReservationList find_vrf_ip_reservations(id, include=include, exclude=exclude) @@ -801,9 +801,8 @@ Returns the list of VRF IP Reservations for the VRF. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.vrf_ip_reservation_list import VrfIpReservationList from equinix_metal.rest import ApiException @@ -847,6 +846,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| VRF UUID | @@ -867,6 +867,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -874,7 +875,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_vrf_route_by_id** > VrfRoute find_vrf_route_by_id(id, include=include, exclude=exclude) @@ -885,9 +885,8 @@ Returns a single VRF Route resource ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.vrf_route import VrfRoute from equinix_metal.rest import ApiException @@ -931,6 +930,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| VRF Route UUID | @@ -951,6 +951,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | OK | - | @@ -958,7 +959,6 @@ Name | Type | Description | Notes **404** | Not Found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **find_vrfs** > VrfList find_vrfs(id, include=include, exclude=exclude, metro=metro) @@ -969,9 +969,8 @@ Returns the list of VRFs for a single project. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.vrf_list import VrfList from equinix_metal.rest import ApiException @@ -1016,6 +1015,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Project UUID | @@ -1037,6 +1037,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -1044,7 +1045,6 @@ Name | Type | Description | Notes **404** | not found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **get_bgp_dynamic_neighbors** > BgpDynamicNeighborList get_bgp_dynamic_neighbors(id, include=include, exclude=exclude) @@ -1055,9 +1055,8 @@ Returns the list of VRF BGP Dynamic Neighbors for this Metal Gateway ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.bgp_dynamic_neighbor_list import BgpDynamicNeighborList from equinix_metal.rest import ApiException @@ -1101,6 +1100,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Metal Gateway UUID | @@ -1121,6 +1121,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | OK | - | @@ -1128,7 +1129,6 @@ Name | Type | Description | Notes **404** | Not Found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **get_vrf_routes** > VrfRouteList get_vrf_routes(id, include=include, exclude=exclude) @@ -1139,9 +1139,8 @@ Returns the list of routes for the VRF ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.vrf_route_list import VrfRouteList from equinix_metal.rest import ApiException @@ -1185,6 +1184,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| VRF UUID | @@ -1205,6 +1205,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | OK | - | @@ -1212,7 +1213,6 @@ Name | Type | Description | Notes **404** | Not Found | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **update_vrf** > Vrf update_vrf(id, vrf_update_input, include=include, exclude=exclude) @@ -1223,9 +1223,8 @@ Updates the VRF. ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.vrf import Vrf from equinix_metal.models.vrf_update_input import VrfUpdateInput @@ -1271,6 +1270,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| VRF UUID | @@ -1292,6 +1292,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | ok | - | @@ -1301,7 +1302,6 @@ Name | Type | Description | Notes **422** | unprocessable entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **update_vrf_route_by_id** > VrfRoute update_vrf_route_by_id(id, vrf_route_update_input, include=include, exclude=exclude) @@ -1312,9 +1312,8 @@ Requests a VRF Route be redeployed across the network. Updating the prefix or ne ### Example * Api Key Authentication (x_auth_token): + ```python -import time -import os import equinix_metal from equinix_metal.models.vrf_route import VrfRoute from equinix_metal.models.vrf_route_update_input import VrfRouteUpdateInput @@ -1360,6 +1359,7 @@ with equinix_metal.ApiClient(configuration) as api_client: ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| VRF Route UUID | @@ -1381,6 +1381,7 @@ Name | Type | Description | Notes - **Accept**: application/json ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| **202** | Accepted | - | @@ -1391,4 +1392,3 @@ Name | Type | Description | Notes **429** | Too Many Requests | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/equinix_metal/docs/VerifyEmail.md b/equinix_metal/docs/VerifyEmail.md index bc7cc025..56f27596 100644 --- a/equinix_metal/docs/VerifyEmail.md +++ b/equinix_metal/docs/VerifyEmail.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of VerifyEmail from a JSON string verify_email_instance = VerifyEmail.from_json(json) # print the JSON string representation of the object -print VerifyEmail.to_json() +print(VerifyEmail.to_json()) # convert the object into a dict verify_email_dict = verify_email_instance.to_dict() diff --git a/equinix_metal/docs/VirtualCircuit.md b/equinix_metal/docs/VirtualCircuit.md index 90f9f3cb..531230fc 100644 --- a/equinix_metal/docs/VirtualCircuit.md +++ b/equinix_metal/docs/VirtualCircuit.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **bill** | **bool** | True if the Virtual Circuit is being billed. Currently, only Virtual Circuits of Fabric VCs (Metal Billed) will be billed. Usage will start the first time the Virtual Circuit becomes active, and will not stop until it is deleted from Metal. | [optional] [default to False] @@ -38,7 +39,7 @@ json = "{}" # create an instance of VirtualCircuit from a JSON string virtual_circuit_instance = VirtualCircuit.from_json(json) # print the JSON string representation of the object -print VirtualCircuit.to_json() +print(VirtualCircuit.to_json()) # convert the object into a dict virtual_circuit_dict = virtual_circuit_instance.to_dict() diff --git a/equinix_metal/docs/VirtualCircuitCreateInput.md b/equinix_metal/docs/VirtualCircuitCreateInput.md index 2d391898..e306b914 100644 --- a/equinix_metal/docs/VirtualCircuitCreateInput.md +++ b/equinix_metal/docs/VirtualCircuitCreateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **description** | **str** | | [optional] @@ -29,7 +30,7 @@ json = "{}" # create an instance of VirtualCircuitCreateInput from a JSON string virtual_circuit_create_input_instance = VirtualCircuitCreateInput.from_json(json) # print the JSON string representation of the object -print VirtualCircuitCreateInput.to_json() +print(VirtualCircuitCreateInput.to_json()) # convert the object into a dict virtual_circuit_create_input_dict = virtual_circuit_create_input_instance.to_dict() diff --git a/equinix_metal/docs/VirtualCircuitList.md b/equinix_metal/docs/VirtualCircuitList.md index 764478cc..f21e27c4 100644 --- a/equinix_metal/docs/VirtualCircuitList.md +++ b/equinix_metal/docs/VirtualCircuitList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of VirtualCircuitList from a JSON string virtual_circuit_list_instance = VirtualCircuitList.from_json(json) # print the JSON string representation of the object -print VirtualCircuitList.to_json() +print(VirtualCircuitList.to_json()) # convert the object into a dict virtual_circuit_list_dict = virtual_circuit_list_instance.to_dict() diff --git a/equinix_metal/docs/VirtualCircuitUpdateInput.md b/equinix_metal/docs/VirtualCircuitUpdateInput.md index 9230b69c..be132e54 100644 --- a/equinix_metal/docs/VirtualCircuitUpdateInput.md +++ b/equinix_metal/docs/VirtualCircuitUpdateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **description** | **str** | | [optional] @@ -26,7 +27,7 @@ json = "{}" # create an instance of VirtualCircuitUpdateInput from a JSON string virtual_circuit_update_input_instance = VirtualCircuitUpdateInput.from_json(json) # print the JSON string representation of the object -print VirtualCircuitUpdateInput.to_json() +print(VirtualCircuitUpdateInput.to_json()) # convert the object into a dict virtual_circuit_update_input_dict = virtual_circuit_update_input_instance.to_dict() diff --git a/equinix_metal/docs/VirtualNetwork.md b/equinix_metal/docs/VirtualNetwork.md index 208fe1f6..0ed7c51d 100644 --- a/equinix_metal/docs/VirtualNetwork.md +++ b/equinix_metal/docs/VirtualNetwork.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **assigned_to** | [**Href**](Href.md) | | [optional] @@ -27,7 +28,7 @@ json = "{}" # create an instance of VirtualNetwork from a JSON string virtual_network_instance = VirtualNetwork.from_json(json) # print the JSON string representation of the object -print VirtualNetwork.to_json() +print(VirtualNetwork.to_json()) # convert the object into a dict virtual_network_dict = virtual_network_instance.to_dict() diff --git a/equinix_metal/docs/VirtualNetworkCreateInput.md b/equinix_metal/docs/VirtualNetworkCreateInput.md index c8101dd1..12bd8611 100644 --- a/equinix_metal/docs/VirtualNetworkCreateInput.md +++ b/equinix_metal/docs/VirtualNetworkCreateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **description** | **str** | | [optional] @@ -21,7 +22,7 @@ json = "{}" # create an instance of VirtualNetworkCreateInput from a JSON string virtual_network_create_input_instance = VirtualNetworkCreateInput.from_json(json) # print the JSON string representation of the object -print VirtualNetworkCreateInput.to_json() +print(VirtualNetworkCreateInput.to_json()) # convert the object into a dict virtual_network_create_input_dict = virtual_network_create_input_instance.to_dict() diff --git a/equinix_metal/docs/VirtualNetworkList.md b/equinix_metal/docs/VirtualNetworkList.md index 522437fa..316e870c 100644 --- a/equinix_metal/docs/VirtualNetworkList.md +++ b/equinix_metal/docs/VirtualNetworkList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of VirtualNetworkList from a JSON string virtual_network_list_instance = VirtualNetworkList.from_json(json) # print the JSON string representation of the object -print VirtualNetworkList.to_json() +print(VirtualNetworkList.to_json()) # convert the object into a dict virtual_network_list_dict = virtual_network_list_instance.to_dict() diff --git a/equinix_metal/docs/VlanCSPConnectionCreateInput.md b/equinix_metal/docs/VlanCSPConnectionCreateInput.md index 929c2caa..5896d8f6 100644 --- a/equinix_metal/docs/VlanCSPConnectionCreateInput.md +++ b/equinix_metal/docs/VlanCSPConnectionCreateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **contact_email** | **str** | The preferred email used for communication and notifications about the Equinix Fabric interconnection. Required when using a Project API key. Optional and defaults to the primary user email address when using a User API key. | [optional] @@ -26,7 +27,7 @@ json = "{}" # create an instance of VlanCSPConnectionCreateInput from a JSON string vlan_csp_connection_create_input_instance = VlanCSPConnectionCreateInput.from_json(json) # print the JSON string representation of the object -print VlanCSPConnectionCreateInput.to_json() +print(VlanCSPConnectionCreateInput.to_json()) # convert the object into a dict vlan_csp_connection_create_input_dict = vlan_csp_connection_create_input_instance.to_dict() diff --git a/equinix_metal/docs/VlanCSPConnectionCreateInputFabricProvider.md b/equinix_metal/docs/VlanCSPConnectionCreateInputFabricProvider.md index 50a8da60..5534f742 100644 --- a/equinix_metal/docs/VlanCSPConnectionCreateInputFabricProvider.md +++ b/equinix_metal/docs/VlanCSPConnectionCreateInputFabricProvider.md @@ -3,6 +3,7 @@ Configuration information for connecting to external cloud service provider. ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **account_id** | **str** | AWS Account ID | @@ -20,7 +21,7 @@ json = "{}" # create an instance of VlanCSPConnectionCreateInputFabricProvider from a JSON string vlan_csp_connection_create_input_fabric_provider_instance = VlanCSPConnectionCreateInputFabricProvider.from_json(json) # print the JSON string representation of the object -print VlanCSPConnectionCreateInputFabricProvider.to_json() +print(VlanCSPConnectionCreateInputFabricProvider.to_json()) # convert the object into a dict vlan_csp_connection_create_input_fabric_provider_dict = vlan_csp_connection_create_input_fabric_provider_instance.to_dict() diff --git a/equinix_metal/docs/VlanFabricVcCreateInput.md b/equinix_metal/docs/VlanFabricVcCreateInput.md index 2e2289a1..9689a57e 100644 --- a/equinix_metal/docs/VlanFabricVcCreateInput.md +++ b/equinix_metal/docs/VlanFabricVcCreateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **contact_email** | **str** | The preferred email used for communication and notifications about the Equinix Fabric interconnection. Required when using a Project API key. Optional and defaults to the primary user email address when using a User API key. | [optional] @@ -27,7 +28,7 @@ json = "{}" # create an instance of VlanFabricVcCreateInput from a JSON string vlan_fabric_vc_create_input_instance = VlanFabricVcCreateInput.from_json(json) # print the JSON string representation of the object -print VlanFabricVcCreateInput.to_json() +print(VlanFabricVcCreateInput.to_json()) # convert the object into a dict vlan_fabric_vc_create_input_dict = vlan_fabric_vc_create_input_instance.to_dict() diff --git a/equinix_metal/docs/VlanVirtualCircuit.md b/equinix_metal/docs/VlanVirtualCircuit.md index ce1d9eb0..e53e9af1 100644 --- a/equinix_metal/docs/VlanVirtualCircuit.md +++ b/equinix_metal/docs/VlanVirtualCircuit.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **bill** | **bool** | True if the Virtual Circuit is being billed. Currently, only Virtual Circuits of Fabric VCs (Metal Billed) will be billed. Usage will start the first time the Virtual Circuit becomes active, and will not stop until it is deleted from Metal. | [optional] [default to False] @@ -32,7 +33,7 @@ json = "{}" # create an instance of VlanVirtualCircuit from a JSON string vlan_virtual_circuit_instance = VlanVirtualCircuit.from_json(json) # print the JSON string representation of the object -print VlanVirtualCircuit.to_json() +print(VlanVirtualCircuit.to_json()) # convert the object into a dict vlan_virtual_circuit_dict = vlan_virtual_circuit_instance.to_dict() diff --git a/equinix_metal/docs/VlanVirtualCircuitCreateInput.md b/equinix_metal/docs/VlanVirtualCircuitCreateInput.md index 55a444a0..cb7035f4 100644 --- a/equinix_metal/docs/VlanVirtualCircuitCreateInput.md +++ b/equinix_metal/docs/VlanVirtualCircuitCreateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **description** | **str** | | [optional] @@ -23,7 +24,7 @@ json = "{}" # create an instance of VlanVirtualCircuitCreateInput from a JSON string vlan_virtual_circuit_create_input_instance = VlanVirtualCircuitCreateInput.from_json(json) # print the JSON string representation of the object -print VlanVirtualCircuitCreateInput.to_json() +print(VlanVirtualCircuitCreateInput.to_json()) # convert the object into a dict vlan_virtual_circuit_create_input_dict = vlan_virtual_circuit_create_input_instance.to_dict() diff --git a/equinix_metal/docs/VlanVirtualCircuitUpdateInput.md b/equinix_metal/docs/VlanVirtualCircuitUpdateInput.md index 572eee0d..cd3c3a0c 100644 --- a/equinix_metal/docs/VlanVirtualCircuitUpdateInput.md +++ b/equinix_metal/docs/VlanVirtualCircuitUpdateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **description** | **str** | | [optional] @@ -21,7 +22,7 @@ json = "{}" # create an instance of VlanVirtualCircuitUpdateInput from a JSON string vlan_virtual_circuit_update_input_instance = VlanVirtualCircuitUpdateInput.from_json(json) # print the JSON string representation of the object -print VlanVirtualCircuitUpdateInput.to_json() +print(VlanVirtualCircuitUpdateInput.to_json()) # convert the object into a dict vlan_virtual_circuit_update_input_dict = vlan_virtual_circuit_update_input_instance.to_dict() diff --git a/equinix_metal/docs/Vrf.md b/equinix_metal/docs/Vrf.md index e0fdc6cf..46787430 100644 --- a/equinix_metal/docs/Vrf.md +++ b/equinix_metal/docs/Vrf.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **bgp_dynamic_neighbors_bfd_enabled** | **bool** | Toggle BFD on dynamic bgp neighbors sessions | [optional] @@ -32,7 +33,7 @@ json = "{}" # create an instance of Vrf from a JSON string vrf_instance = Vrf.from_json(json) # print the JSON string representation of the object -print Vrf.to_json() +print(Vrf.to_json()) # convert the object into a dict vrf_dict = vrf_instance.to_dict() diff --git a/equinix_metal/docs/VrfCreateInput.md b/equinix_metal/docs/VrfCreateInput.md index 3581d269..25a218c7 100644 --- a/equinix_metal/docs/VrfCreateInput.md +++ b/equinix_metal/docs/VrfCreateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **bgp_dynamic_neighbors_bfd_enabled** | **bool** | Toggle BFD on dynamic bgp neighbors sessions | [optional] @@ -25,7 +26,7 @@ json = "{}" # create an instance of VrfCreateInput from a JSON string vrf_create_input_instance = VrfCreateInput.from_json(json) # print the JSON string representation of the object -print VrfCreateInput.to_json() +print(VrfCreateInput.to_json()) # convert the object into a dict vrf_create_input_dict = vrf_create_input_instance.to_dict() diff --git a/equinix_metal/docs/VrfFabricVcCreateInput.md b/equinix_metal/docs/VrfFabricVcCreateInput.md index 472771ff..0effb1ca 100644 --- a/equinix_metal/docs/VrfFabricVcCreateInput.md +++ b/equinix_metal/docs/VrfFabricVcCreateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **contact_email** | **str** | The preferred email used for communication and notifications about the Equinix Fabric interconnection. Required when using a Project API key. Optional and defaults to the primary user email address when using a User API key. | [optional] @@ -27,7 +28,7 @@ json = "{}" # create an instance of VrfFabricVcCreateInput from a JSON string vrf_fabric_vc_create_input_instance = VrfFabricVcCreateInput.from_json(json) # print the JSON string representation of the object -print VrfFabricVcCreateInput.to_json() +print(VrfFabricVcCreateInput.to_json()) # convert the object into a dict vrf_fabric_vc_create_input_dict = vrf_fabric_vc_create_input_instance.to_dict() diff --git a/equinix_metal/docs/VrfIpReservation.md b/equinix_metal/docs/VrfIpReservation.md index 58e3e36d..d0ea2b3a 100644 --- a/equinix_metal/docs/VrfIpReservation.md +++ b/equinix_metal/docs/VrfIpReservation.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **address** | **str** | | [optional] @@ -39,7 +40,7 @@ json = "{}" # create an instance of VrfIpReservation from a JSON string vrf_ip_reservation_instance = VrfIpReservation.from_json(json) # print the JSON string representation of the object -print VrfIpReservation.to_json() +print(VrfIpReservation.to_json()) # convert the object into a dict vrf_ip_reservation_dict = vrf_ip_reservation_instance.to_dict() diff --git a/equinix_metal/docs/VrfIpReservationCreateInput.md b/equinix_metal/docs/VrfIpReservationCreateInput.md index 0f3d2cb0..e908e0b2 100644 --- a/equinix_metal/docs/VrfIpReservationCreateInput.md +++ b/equinix_metal/docs/VrfIpReservationCreateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **cidr** | **int** | The size of the VRF IP Reservation's subnet | @@ -23,7 +24,7 @@ json = "{}" # create an instance of VrfIpReservationCreateInput from a JSON string vrf_ip_reservation_create_input_instance = VrfIpReservationCreateInput.from_json(json) # print the JSON string representation of the object -print VrfIpReservationCreateInput.to_json() +print(VrfIpReservationCreateInput.to_json()) # convert the object into a dict vrf_ip_reservation_create_input_dict = vrf_ip_reservation_create_input_instance.to_dict() diff --git a/equinix_metal/docs/VrfIpReservationList.md b/equinix_metal/docs/VrfIpReservationList.md index 1b89581e..d644d4e0 100644 --- a/equinix_metal/docs/VrfIpReservationList.md +++ b/equinix_metal/docs/VrfIpReservationList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of VrfIpReservationList from a JSON string vrf_ip_reservation_list_instance = VrfIpReservationList.from_json(json) # print the JSON string representation of the object -print VrfIpReservationList.to_json() +print(VrfIpReservationList.to_json()) # convert the object into a dict vrf_ip_reservation_list_dict = vrf_ip_reservation_list_instance.to_dict() diff --git a/equinix_metal/docs/VrfList.md b/equinix_metal/docs/VrfList.md index d4c64686..a4f942f9 100644 --- a/equinix_metal/docs/VrfList.md +++ b/equinix_metal/docs/VrfList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -17,7 +18,7 @@ json = "{}" # create an instance of VrfList from a JSON string vrf_list_instance = VrfList.from_json(json) # print the JSON string representation of the object -print VrfList.to_json() +print(VrfList.to_json()) # convert the object into a dict vrf_list_dict = vrf_list_instance.to_dict() diff --git a/equinix_metal/docs/VrfMetalGateway.md b/equinix_metal/docs/VrfMetalGateway.md index 0d48f1fc..82904821 100644 --- a/equinix_metal/docs/VrfMetalGateway.md +++ b/equinix_metal/docs/VrfMetalGateway.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **created_at** | **datetime** | | [optional] @@ -25,7 +26,7 @@ json = "{}" # create an instance of VrfMetalGateway from a JSON string vrf_metal_gateway_instance = VrfMetalGateway.from_json(json) # print the JSON string representation of the object -print VrfMetalGateway.to_json() +print(VrfMetalGateway.to_json()) # convert the object into a dict vrf_metal_gateway_dict = vrf_metal_gateway_instance.to_dict() diff --git a/equinix_metal/docs/VrfMetalGatewayCreateInput.md b/equinix_metal/docs/VrfMetalGatewayCreateInput.md index 4ffc0bd6..e81bc69e 100644 --- a/equinix_metal/docs/VrfMetalGatewayCreateInput.md +++ b/equinix_metal/docs/VrfMetalGatewayCreateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -18,7 +19,7 @@ json = "{}" # create an instance of VrfMetalGatewayCreateInput from a JSON string vrf_metal_gateway_create_input_instance = VrfMetalGatewayCreateInput.from_json(json) # print the JSON string representation of the object -print VrfMetalGatewayCreateInput.to_json() +print(VrfMetalGatewayCreateInput.to_json()) # convert the object into a dict vrf_metal_gateway_create_input_dict = vrf_metal_gateway_create_input_instance.to_dict() diff --git a/equinix_metal/docs/VrfRoute.md b/equinix_metal/docs/VrfRoute.md index 9e48ec59..64d115b0 100644 --- a/equinix_metal/docs/VrfRoute.md +++ b/equinix_metal/docs/VrfRoute.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **created_at** | **datetime** | | [optional] [readonly] @@ -27,7 +28,7 @@ json = "{}" # create an instance of VrfRoute from a JSON string vrf_route_instance = VrfRoute.from_json(json) # print the JSON string representation of the object -print VrfRoute.to_json() +print(VrfRoute.to_json()) # convert the object into a dict vrf_route_dict = vrf_route_instance.to_dict() diff --git a/equinix_metal/docs/VrfRouteCreateInput.md b/equinix_metal/docs/VrfRouteCreateInput.md index d77a9537..b53eaa8b 100644 --- a/equinix_metal/docs/VrfRouteCreateInput.md +++ b/equinix_metal/docs/VrfRouteCreateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -19,7 +20,7 @@ json = "{}" # create an instance of VrfRouteCreateInput from a JSON string vrf_route_create_input_instance = VrfRouteCreateInput.from_json(json) # print the JSON string representation of the object -print VrfRouteCreateInput.to_json() +print(VrfRouteCreateInput.to_json()) # convert the object into a dict vrf_route_create_input_dict = vrf_route_create_input_instance.to_dict() diff --git a/equinix_metal/docs/VrfRouteList.md b/equinix_metal/docs/VrfRouteList.md index 7f7d7cbb..4d7d5d0e 100644 --- a/equinix_metal/docs/VrfRouteList.md +++ b/equinix_metal/docs/VrfRouteList.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -18,7 +19,7 @@ json = "{}" # create an instance of VrfRouteList from a JSON string vrf_route_list_instance = VrfRouteList.from_json(json) # print the JSON string representation of the object -print VrfRouteList.to_json() +print(VrfRouteList.to_json()) # convert the object into a dict vrf_route_list_dict = vrf_route_list_instance.to_dict() diff --git a/equinix_metal/docs/VrfRouteUpdateInput.md b/equinix_metal/docs/VrfRouteUpdateInput.md index ae1cb4b8..b07bef94 100644 --- a/equinix_metal/docs/VrfRouteUpdateInput.md +++ b/equinix_metal/docs/VrfRouteUpdateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **href** | **str** | | [optional] @@ -19,7 +20,7 @@ json = "{}" # create an instance of VrfRouteUpdateInput from a JSON string vrf_route_update_input_instance = VrfRouteUpdateInput.from_json(json) # print the JSON string representation of the object -print VrfRouteUpdateInput.to_json() +print(VrfRouteUpdateInput.to_json()) # convert the object into a dict vrf_route_update_input_dict = vrf_route_update_input_instance.to_dict() diff --git a/equinix_metal/docs/VrfUpdateInput.md b/equinix_metal/docs/VrfUpdateInput.md index 9a88d63c..e3c20a6b 100644 --- a/equinix_metal/docs/VrfUpdateInput.md +++ b/equinix_metal/docs/VrfUpdateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **bgp_dynamic_neighbors_bfd_enabled** | **bool** | Toggle BFD on dynamic bgp neighbors sessions | [optional] @@ -24,7 +25,7 @@ json = "{}" # create an instance of VrfUpdateInput from a JSON string vrf_update_input_instance = VrfUpdateInput.from_json(json) # print the JSON string representation of the object -print VrfUpdateInput.to_json() +print(VrfUpdateInput.to_json()) # convert the object into a dict vrf_update_input_dict = vrf_update_input_instance.to_dict() diff --git a/equinix_metal/docs/VrfVirtualCircuit.md b/equinix_metal/docs/VrfVirtualCircuit.md index 6be1fa0c..ef6041e9 100644 --- a/equinix_metal/docs/VrfVirtualCircuit.md +++ b/equinix_metal/docs/VrfVirtualCircuit.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **created_at** | **datetime** | | [optional] @@ -34,7 +35,7 @@ json = "{}" # create an instance of VrfVirtualCircuit from a JSON string vrf_virtual_circuit_instance = VrfVirtualCircuit.from_json(json) # print the JSON string representation of the object -print VrfVirtualCircuit.to_json() +print(VrfVirtualCircuit.to_json()) # convert the object into a dict vrf_virtual_circuit_dict = vrf_virtual_circuit_instance.to_dict() diff --git a/equinix_metal/docs/VrfVirtualCircuitCreateInput.md b/equinix_metal/docs/VrfVirtualCircuitCreateInput.md index 0fe14c4e..4dc89106 100644 --- a/equinix_metal/docs/VrfVirtualCircuitCreateInput.md +++ b/equinix_metal/docs/VrfVirtualCircuitCreateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **customer_ip** | **str** | An IP address from the subnet that will be used on the Customer side. This parameter is optional, but if supplied, we will use the other usable IP address in the subnet as the Metal IP. By default, the last usable IP address in the subnet will be used. | [optional] @@ -28,7 +29,7 @@ json = "{}" # create an instance of VrfVirtualCircuitCreateInput from a JSON string vrf_virtual_circuit_create_input_instance = VrfVirtualCircuitCreateInput.from_json(json) # print the JSON string representation of the object -print VrfVirtualCircuitCreateInput.to_json() +print(VrfVirtualCircuitCreateInput.to_json()) # convert the object into a dict vrf_virtual_circuit_create_input_dict = vrf_virtual_circuit_create_input_instance.to_dict() diff --git a/equinix_metal/docs/VrfVirtualCircuitUpdateInput.md b/equinix_metal/docs/VrfVirtualCircuitUpdateInput.md index 0aef7034..7c73c36c 100644 --- a/equinix_metal/docs/VrfVirtualCircuitUpdateInput.md +++ b/equinix_metal/docs/VrfVirtualCircuitUpdateInput.md @@ -2,6 +2,7 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **customer_ip** | **str** | An IP address from the subnet that will be used on the Customer side. This parameter is optional, but if supplied, we will use the other usable IP address in the subnet as the Metal IP. By default, the last usable IP address in the subnet will be used. | [optional] @@ -25,7 +26,7 @@ json = "{}" # create an instance of VrfVirtualCircuitUpdateInput from a JSON string vrf_virtual_circuit_update_input_instance = VrfVirtualCircuitUpdateInput.from_json(json) # print the JSON string representation of the object -print VrfVirtualCircuitUpdateInput.to_json() +print(VrfVirtualCircuitUpdateInput.to_json()) # convert the object into a dict vrf_virtual_circuit_update_input_dict = vrf_virtual_circuit_update_input_instance.to_dict() diff --git a/equinix_metal/equinix_metal/api/authentication_api.py b/equinix_metal/equinix_metal/api/authentication_api.py index 69a183da..4d9426d6 100644 --- a/equinix_metal/equinix_metal/api/authentication_api.py +++ b/equinix_metal/equinix_metal/api/authentication_api.py @@ -12,210 +12,352 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictStr, conlist - -from typing import Optional - +from pydantic import Field, StrictStr +from typing import List, Optional +from typing_extensions import Annotated from equinix_metal.models.auth_token import AuthToken from equinix_metal.models.auth_token_input import AuthTokenInput from equinix_metal.models.auth_token_list import AuthTokenList -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class AuthenticationApi(object): +class AuthenticationApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def create_api_key( + self, + auth_token_input: Annotated[AuthTokenInput, Field(description="API key to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> AuthToken: + """Create an API key - @validate_arguments - def create_api_key(self, auth_token_input : Annotated[AuthTokenInput, Field(..., description="API key to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> AuthToken: # noqa: E501 - """Create an API key # noqa: E501 - - Creates a API key for the current user. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_api_key(auth_token_input, include, async_req=True) - >>> result = thread.get() + Creates a API key for the current user. :param auth_token_input: API key to create (required) :type auth_token_input: AuthTokenInput :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: AuthToken - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the create_api_key_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.create_api_key_with_http_info(auth_token_input, include, **kwargs) # noqa: E501 - - @validate_arguments - def create_api_key_with_http_info(self, auth_token_input : Annotated[AuthTokenInput, Field(..., description="API key to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Create an API key # noqa: E501 - - Creates a API key for the current user. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_api_key_with_http_info(auth_token_input, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._create_api_key_serialize( + auth_token_input=auth_token_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "AuthToken", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_api_key_with_http_info( + self, + auth_token_input: Annotated[AuthTokenInput, Field(description="API key to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[AuthToken]: + """Create an API key + + Creates a API key for the current user. :param auth_token_input: API key to create (required) :type auth_token_input: AuthTokenInput :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(AuthToken, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._create_api_key_serialize( + auth_token_input=auth_token_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '201': "AuthToken", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'auth_token_input', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def create_api_key_without_preload_content( + self, + auth_token_input: Annotated[AuthTokenInput, Field(description="API key to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create an API key + + Creates a API key for the current user. + + :param auth_token_input: API key to create (required) + :type auth_token_input: AuthTokenInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_api_key_serialize( + auth_token_input=auth_token_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_api_key" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '201': "AuthToken", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} + def _create_api_key_serialize( + self, + auth_token_input, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['auth_token_input'] is not None: - _body_params = _params['auth_token_input'] + if auth_token_input is not None: + _body_params = auth_token_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '201': "AuthToken", - '401': "Error", - '404': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/user/api-keys', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/user/api-keys', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def create_project_api_key(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], auth_token_input : Annotated[AuthTokenInput, Field(..., description="API Key to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> AuthToken: # noqa: E501 - """Create an API key for a project. # noqa: E501 - Creates an API key for a project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def create_project_api_key( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + auth_token_input: Annotated[AuthTokenInput, Field(description="API Key to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> AuthToken: + """Create an API key for a project. - >>> thread = api.create_project_api_key(id, auth_token_input, include, async_req=True) - >>> result = thread.get() + Creates an API key for a project. :param id: Project UUID (required) :type id: str @@ -223,32 +365,77 @@ def create_project_api_key(self, id : Annotated[StrictStr, Field(..., descriptio :type auth_token_input: AuthTokenInput :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: AuthToken - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the create_project_api_key_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.create_project_api_key_with_http_info(id, auth_token_input, include, **kwargs) # noqa: E501 - - @validate_arguments - def create_project_api_key_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], auth_token_input : Annotated[AuthTokenInput, Field(..., description="API Key to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Create an API key for a project. # noqa: E501 - - Creates an API key for a project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_project_api_key_with_http_info(id, auth_token_input, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._create_project_api_key_serialize( + id=id, + auth_token_input=auth_token_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "AuthToken", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_project_api_key_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + auth_token_input: Annotated[AuthTokenInput, Field(description="API Key to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[AuthToken]: + """Create an API key for a project. + + Creates an API key for a project. :param id: Project UUID (required) :type id: str @@ -256,692 +443,1293 @@ def create_project_api_key_with_http_info(self, id : Annotated[StrictStr, Field( :type auth_token_input: AuthTokenInput :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(AuthToken, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._create_project_api_key_serialize( + id=id, + auth_token_input=auth_token_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "AuthToken", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id', - 'auth_token_input', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def create_project_api_key_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + auth_token_input: Annotated[AuthTokenInput, Field(description="API Key to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create an API key for a project. + + Creates an API key for a project. + + :param id: Project UUID (required) + :type id: str + :param auth_token_input: API Key to create (required) + :type auth_token_input: AuthTokenInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_project_api_key_serialize( + id=id, + auth_token_input=auth_token_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_project_api_key" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '201': "AuthToken", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _create_project_api_key_serialize( + self, + id, + auth_token_input, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['auth_token_input'] is not None: - _body_params = _params['auth_token_input'] + if auth_token_input is not None: + _body_params = auth_token_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '201': "AuthToken", - '401': "Error", - '404': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{id}/api-keys', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/projects/{id}/api-keys', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def delete_api_key(self, id : Annotated[StrictStr, Field(..., description="API Key UUID")], **kwargs) -> None: # noqa: E501 - """Delete the API key # noqa: E501 - Deletes the API key. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def delete_api_key( + self, + id: Annotated[StrictStr, Field(description="API Key UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete the API key - >>> thread = api.delete_api_key(id, async_req=True) - >>> result = thread.get() + Deletes the API key. :param id: API Key UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the delete_api_key_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.delete_api_key_with_http_info(id, **kwargs) # noqa: E501 - - @validate_arguments - def delete_api_key_with_http_info(self, id : Annotated[StrictStr, Field(..., description="API Key UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """Delete the API key # noqa: E501 - - Deletes the API key. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_api_key_with_http_info(id, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._delete_api_key_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_api_key_with_http_info( + self, + id: Annotated[StrictStr, Field(description="API Key UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete the API key + + Deletes the API key. :param id: API Key UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 + + _param = self._delete_api_key_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def delete_api_key_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="API Key UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete the API key + + Deletes the API key. + + :param id: API Key UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_api_key_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_api_key" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _delete_api_key_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/api-keys/{id}', 'DELETE', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='DELETE', + resource_path='/api-keys/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def delete_user_api_key(self, id : Annotated[StrictStr, Field(..., description="API Key UUID")], **kwargs) -> None: # noqa: E501 - """Delete the API key # noqa: E501 - Deletes the current user API key. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def delete_user_api_key( + self, + id: Annotated[StrictStr, Field(description="API Key UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete the API key - >>> thread = api.delete_user_api_key(id, async_req=True) - >>> result = thread.get() + Deletes the current user API key. :param id: API Key UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the delete_user_api_key_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.delete_user_api_key_with_http_info(id, **kwargs) # noqa: E501 - - @validate_arguments - def delete_user_api_key_with_http_info(self, id : Annotated[StrictStr, Field(..., description="API Key UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """Delete the API key # noqa: E501 - - Deletes the current user API key. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_user_api_key_with_http_info(id, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._delete_user_api_key_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_user_api_key_with_http_info( + self, + id: Annotated[StrictStr, Field(description="API Key UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete the API key + + Deletes the current user API key. :param id: API Key UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 + + _param = self._delete_user_api_key_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def delete_user_api_key_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="API Key UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete the API key + + Deletes the current user API key. + + :param id: API Key UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_user_api_key_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_user_api_key" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _delete_user_api_key_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/user/api-keys/{id}', 'DELETE', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='DELETE', + resource_path='/user/api-keys/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_api_keys(self, search : Annotated[Optional[StrictStr], Field(description="Search by description")] = None, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> AuthTokenList: # noqa: E501 - """Retrieve all user API keys # noqa: E501 - Returns all API keys for the current user. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_api_keys( + self, + search: Annotated[Optional[StrictStr], Field(description="Search by description")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> AuthTokenList: + """Retrieve all user API keys - >>> thread = api.find_api_keys(search, include, async_req=True) - >>> result = thread.get() + Returns all API keys for the current user. :param search: Search by description :type search: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: AuthTokenList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_api_keys_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_api_keys_with_http_info(search, include, **kwargs) # noqa: E501 - - @validate_arguments - def find_api_keys_with_http_info(self, search : Annotated[Optional[StrictStr], Field(description="Search by description")] = None, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve all user API keys # noqa: E501 - - Returns all API keys for the current user. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_api_keys_with_http_info(search, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_api_keys_serialize( + search=search, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AuthTokenList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_api_keys_with_http_info( + self, + search: Annotated[Optional[StrictStr], Field(description="Search by description")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[AuthTokenList]: + """Retrieve all user API keys + + Returns all API keys for the current user. :param search: Search by description :type search: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(AuthTokenList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_api_keys_serialize( + search=search, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "AuthTokenList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'search', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def find_api_keys_without_preload_content( + self, + search: Annotated[Optional[StrictStr], Field(description="Search by description")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all user API keys + + Returns all API keys for the current user. + + :param search: Search by description + :type search: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_api_keys_serialize( + search=search, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_api_keys" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "AuthTokenList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} + def _find_api_keys_serialize( + self, + search, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the query parameters - _query_params = [] - if _params.get('search') is not None: # noqa: E501 - _query_params.append(('search', _params['search'])) + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + # process the query parameters + if search is not None: + + _query_params.append(('search', search)) + + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "AuthTokenList", - '401': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/user/api-keys', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/user/api-keys', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_project_api_keys(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> AuthTokenList: # noqa: E501 - """Retrieve all API keys for the project. # noqa: E501 - Returns all API keys for a specific project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_project_api_keys( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> AuthTokenList: + """Retrieve all API keys for the project. - >>> thread = api.find_project_api_keys(id, include, async_req=True) - >>> result = thread.get() + Returns all API keys for a specific project. :param id: Project UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: AuthTokenList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_project_api_keys_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_project_api_keys_with_http_info(id, include, **kwargs) # noqa: E501 - - @validate_arguments - def find_project_api_keys_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve all API keys for the project. # noqa: E501 - - Returns all API keys for a specific project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_project_api_keys_with_http_info(id, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_project_api_keys_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AuthTokenList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_project_api_keys_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[AuthTokenList]: + """Retrieve all API keys for the project. + + Returns all API keys for a specific project. :param id: Project UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(AuthTokenList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_project_api_keys_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AuthTokenList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def find_project_api_keys_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all API keys for the project. + + Returns all API keys for a specific project. + + :param id: Project UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_project_api_keys_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_project_api_keys" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "AuthTokenList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_project_api_keys_serialize( + self, + id, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "AuthTokenList", - '401': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{id}/api-keys', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/projects/{id}/api-keys', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/batches_api.py b/equinix_metal/equinix_metal/api/batches_api.py index 347dc1d8..edf57d87 100644 --- a/equinix_metal/equinix_metal/api/batches_api.py +++ b/equinix_metal/equinix_metal/api/batches_api.py @@ -12,642 +12,1169 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictBool, StrictStr, conlist - -from typing import Optional - +from pydantic import Field, StrictBool, StrictStr +from typing import List, Optional +from typing_extensions import Annotated from equinix_metal.models.batch import Batch from equinix_metal.models.batches_list import BatchesList from equinix_metal.models.instances_batch_create_input import InstancesBatchCreateInput -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class BatchesApi(object): +class BatchesApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def create_device_batch( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + instances_batch_create_input: Annotated[InstancesBatchCreateInput, Field(description="Batches to create")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> BatchesList: + """Create a devices batch - @validate_arguments - def create_device_batch(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], instances_batch_create_input : Annotated[InstancesBatchCreateInput, Field(..., description="Batches to create")], **kwargs) -> BatchesList: # noqa: E501 - """Create a devices batch # noqa: E501 - - Creates new devices in batch and provisions them in our datacenter. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_device_batch(id, instances_batch_create_input, async_req=True) - >>> result = thread.get() + Creates new devices in batch and provisions them in our datacenter. :param id: Project UUID (required) :type id: str :param instances_batch_create_input: Batches to create (required) :type instances_batch_create_input: InstancesBatchCreateInput - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: BatchesList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the create_device_batch_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.create_device_batch_with_http_info(id, instances_batch_create_input, **kwargs) # noqa: E501 - - @validate_arguments - def create_device_batch_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], instances_batch_create_input : Annotated[InstancesBatchCreateInput, Field(..., description="Batches to create")], **kwargs) -> ApiResponse: # noqa: E501 - """Create a devices batch # noqa: E501 - - Creates new devices in batch and provisions them in our datacenter. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_device_batch_with_http_info(id, instances_batch_create_input, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._create_device_batch_serialize( + id=id, + instances_batch_create_input=instances_batch_create_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "BatchesList", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_device_batch_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + instances_batch_create_input: Annotated[InstancesBatchCreateInput, Field(description="Batches to create")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[BatchesList]: + """Create a devices batch + + Creates new devices in batch and provisions them in our datacenter. :param id: Project UUID (required) :type id: str :param instances_batch_create_input: Batches to create (required) :type instances_batch_create_input: InstancesBatchCreateInput - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(BatchesList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._create_device_batch_serialize( + id=id, + instances_batch_create_input=instances_batch_create_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '201': "BatchesList", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id', - 'instances_batch_create_input' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def create_device_batch_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + instances_batch_create_input: Annotated[InstancesBatchCreateInput, Field(description="Batches to create")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a devices batch + + Creates new devices in batch and provisions them in our datacenter. + + :param id: Project UUID (required) + :type id: str + :param instances_batch_create_input: Batches to create (required) + :type instances_batch_create_input: InstancesBatchCreateInput + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_device_batch_serialize( + id=id, + instances_batch_create_input=instances_batch_create_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_device_batch" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '201': "BatchesList", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _create_device_batch_serialize( + self, + id, + instances_batch_create_input, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['instances_batch_create_input'] is not None: - _body_params = _params['instances_batch_create_input'] + if instances_batch_create_input is not None: + _body_params = instances_batch_create_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '201': "BatchesList", - '401': "Error", - '403': "Error", - '404': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{id}/devices/batch', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/projects/{id}/devices/batch', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def delete_batch(self, id : Annotated[StrictStr, Field(..., description="Batch UUID")], remove_associated_instances : Annotated[Optional[StrictBool], Field(description="Delete all instances created from this batch")] = None, **kwargs) -> None: # noqa: E501 - """Delete the Batch # noqa: E501 - Deletes the Batch. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def delete_batch( + self, + id: Annotated[StrictStr, Field(description="Batch UUID")], + remove_associated_instances: Annotated[Optional[StrictBool], Field(description="Delete all instances created from this batch")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete the Batch - >>> thread = api.delete_batch(id, remove_associated_instances, async_req=True) - >>> result = thread.get() + Deletes the Batch. :param id: Batch UUID (required) :type id: str :param remove_associated_instances: Delete all instances created from this batch :type remove_associated_instances: bool - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the delete_batch_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.delete_batch_with_http_info(id, remove_associated_instances, **kwargs) # noqa: E501 - - @validate_arguments - def delete_batch_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Batch UUID")], remove_associated_instances : Annotated[Optional[StrictBool], Field(description="Delete all instances created from this batch")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Delete the Batch # noqa: E501 - - Deletes the Batch. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_batch_with_http_info(id, remove_associated_instances, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._delete_batch_serialize( + id=id, + remove_associated_instances=remove_associated_instances, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_batch_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Batch UUID")], + remove_associated_instances: Annotated[Optional[StrictBool], Field(description="Delete all instances created from this batch")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete the Batch + + Deletes the Batch. :param id: Batch UUID (required) :type id: str :param remove_associated_instances: Delete all instances created from this batch :type remove_associated_instances: bool - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 + + _param = self._delete_batch_serialize( + id=id, + remove_associated_instances=remove_associated_instances, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id', - 'remove_associated_instances' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def delete_batch_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Batch UUID")], + remove_associated_instances: Annotated[Optional[StrictBool], Field(description="Delete all instances created from this batch")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete the Batch + + Deletes the Batch. + + :param id: Batch UUID (required) + :type id: str + :param remove_associated_instances: Delete all instances created from this batch + :type remove_associated_instances: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_batch_serialize( + id=id, + remove_associated_instances=remove_associated_instances, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_batch" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _delete_batch_serialize( + self, + id, + remove_associated_instances, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('remove_associated_instances') is not None: # noqa: E501 - _query_params.append(('remove_associated_instances', _params['remove_associated_instances'])) + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if remove_associated_instances is not None: + + _query_params.append(('remove_associated_instances', remove_associated_instances)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/batches/{id}', 'DELETE', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='DELETE', + resource_path='/batches/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_batch_by_id(self, id : Annotated[StrictStr, Field(..., description="Batch UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> Batch: # noqa: E501 - """Retrieve a Batch # noqa: E501 - Returns a Batch # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_batch_by_id( + self, + id: Annotated[StrictStr, Field(description="Batch UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Batch: + """Retrieve a Batch - >>> thread = api.find_batch_by_id(id, include, async_req=True) - >>> result = thread.get() + Returns a Batch :param id: Batch UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Batch - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_batch_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_batch_by_id_with_http_info(id, include, **kwargs) # noqa: E501 - - @validate_arguments - def find_batch_by_id_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Batch UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve a Batch # noqa: E501 - - Returns a Batch # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_batch_by_id_with_http_info(id, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_batch_by_id_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Batch", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_batch_by_id_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Batch UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Batch]: + """Retrieve a Batch + + Returns a Batch :param id: Batch UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Batch, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_batch_by_id_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "Batch", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def find_batch_by_id_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Batch UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve a Batch + + Returns a Batch + + :param id: Batch UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_batch_by_id_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_batch_by_id" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "Batch", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_batch_by_id_serialize( + self, + id, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "Batch", - '401': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/batches/{id}', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/batches/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_batches_by_project(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> BatchesList: # noqa: E501 - """Retrieve all batches by project # noqa: E501 - Returns all batches for the given project # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_batches_by_project( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> BatchesList: + """Retrieve all batches by project - >>> thread = api.find_batches_by_project(id, include, async_req=True) - >>> result = thread.get() + Returns all batches for the given project :param id: Project UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: BatchesList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_batches_by_project_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_batches_by_project_with_http_info(id, include, **kwargs) # noqa: E501 - - @validate_arguments - def find_batches_by_project_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve all batches by project # noqa: E501 - - Returns all batches for the given project # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_batches_by_project_with_http_info(id, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_batches_by_project_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BatchesList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_batches_by_project_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[BatchesList]: + """Retrieve all batches by project + + Returns all batches for the given project :param id: Project UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(BatchesList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_batches_by_project_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "BatchesList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def find_batches_by_project_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all batches by project + + Returns all batches for the given project + + :param id: Project UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_batches_by_project_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_batches_by_project" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "BatchesList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_batches_by_project_serialize( + self, + id, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "BatchesList", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{id}/batches', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/projects/{id}/batches', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/bgp_api.py b/equinix_metal/equinix_metal/api/bgp_api.py index 7607c0db..a22d778d 100644 --- a/equinix_metal/equinix_metal/api/bgp_api.py +++ b/equinix_metal/equinix_metal/api/bgp_api.py @@ -12,776 +12,1416 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictBool, StrictStr, conlist - -from typing import Optional - +from pydantic import Field, StrictBool, StrictStr +from typing import List, Optional +from typing_extensions import Annotated from equinix_metal.models.bgp_config import BgpConfig from equinix_metal.models.bgp_config_request_input import BgpConfigRequestInput from equinix_metal.models.bgp_session import BgpSession from equinix_metal.models.bgp_session_list import BgpSessionList from equinix_metal.models.global_bgp_range_list import GlobalBgpRangeList -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class BGPApi(object): +class BGPApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def delete_bgp_session( + self, + id: Annotated[StrictStr, Field(description="BGP session UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete the BGP session - @validate_arguments - def delete_bgp_session(self, id : Annotated[StrictStr, Field(..., description="BGP session UUID")], **kwargs) -> None: # noqa: E501 - """Delete the BGP session # noqa: E501 - - Deletes the BGP session. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_bgp_session(id, async_req=True) - >>> result = thread.get() + Deletes the BGP session. :param id: BGP session UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the delete_bgp_session_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.delete_bgp_session_with_http_info(id, **kwargs) # noqa: E501 - - @validate_arguments - def delete_bgp_session_with_http_info(self, id : Annotated[StrictStr, Field(..., description="BGP session UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """Delete the BGP session # noqa: E501 - - Deletes the BGP session. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_bgp_session_with_http_info(id, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._delete_bgp_session_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_bgp_session_with_http_info( + self, + id: Annotated[StrictStr, Field(description="BGP session UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete the BGP session + + Deletes the BGP session. :param id: BGP session UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 + + _param = self._delete_bgp_session_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def delete_bgp_session_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="BGP session UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete the BGP session + + Deletes the BGP session. + + :param id: BGP session UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_bgp_session_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_bgp_session" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _delete_bgp_session_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/bgp/sessions/{id}', 'DELETE', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='DELETE', + resource_path='/bgp/sessions/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_bgp_config_by_project(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> BgpConfig: # noqa: E501 - """Retrieve a bgp config # noqa: E501 - Returns a bgp config # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_bgp_config_by_project( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> BgpConfig: + """Retrieve a bgp config - >>> thread = api.find_bgp_config_by_project(id, include, async_req=True) - >>> result = thread.get() + Returns a bgp config :param id: Project UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: BgpConfig - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_bgp_config_by_project_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_bgp_config_by_project_with_http_info(id, include, **kwargs) # noqa: E501 - - @validate_arguments - def find_bgp_config_by_project_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve a bgp config # noqa: E501 - - Returns a bgp config # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_bgp_config_by_project_with_http_info(id, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_bgp_config_by_project_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BgpConfig", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_bgp_config_by_project_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[BgpConfig]: + """Retrieve a bgp config + + Returns a bgp config :param id: Project UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(BgpConfig, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_bgp_config_by_project_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "BgpConfig", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def find_bgp_config_by_project_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve a bgp config + + Returns a bgp config + + :param id: Project UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_bgp_config_by_project_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_bgp_config_by_project" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "BgpConfig", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_bgp_config_by_project_serialize( + self, + id, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "BgpConfig", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{id}/bgp-config', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/projects/{id}/bgp-config', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_bgp_session_by_id(self, id : Annotated[StrictStr, Field(..., description="BGP session UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> BgpSession: # noqa: E501 - """Retrieve a BGP session # noqa: E501 - Returns a BGP session # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_bgp_session_by_id( + self, + id: Annotated[StrictStr, Field(description="BGP session UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> BgpSession: + """Retrieve a BGP session - >>> thread = api.find_bgp_session_by_id(id, include, async_req=True) - >>> result = thread.get() + Returns a BGP session :param id: BGP session UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: BgpSession - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_bgp_session_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_bgp_session_by_id_with_http_info(id, include, **kwargs) # noqa: E501 - - @validate_arguments - def find_bgp_session_by_id_with_http_info(self, id : Annotated[StrictStr, Field(..., description="BGP session UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve a BGP session # noqa: E501 - - Returns a BGP session # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_bgp_session_by_id_with_http_info(id, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_bgp_session_by_id_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BgpSession", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_bgp_session_by_id_with_http_info( + self, + id: Annotated[StrictStr, Field(description="BGP session UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[BgpSession]: + """Retrieve a BGP session + + Returns a BGP session :param id: BGP session UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(BgpSession, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_bgp_session_by_id_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "BgpSession", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def find_bgp_session_by_id_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="BGP session UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve a BGP session + + Returns a BGP session + + :param id: BGP session UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_bgp_session_by_id_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_bgp_session_by_id" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "BgpSession", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_bgp_session_by_id_serialize( + self, + id, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "BgpSession", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/bgp/sessions/{id}', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/bgp/sessions/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_global_bgp_ranges(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], **kwargs) -> GlobalBgpRangeList: # noqa: E501 - """Retrieve all global bgp ranges # noqa: E501 - Returns all global bgp ranges for a project # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_global_bgp_ranges( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GlobalBgpRangeList: + """Retrieve all global bgp ranges - >>> thread = api.find_global_bgp_ranges(id, async_req=True) - >>> result = thread.get() + Returns all global bgp ranges for a project :param id: Project UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: GlobalBgpRangeList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_global_bgp_ranges_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_global_bgp_ranges_with_http_info(id, **kwargs) # noqa: E501 - - @validate_arguments - def find_global_bgp_ranges_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve all global bgp ranges # noqa: E501 - - Returns all global bgp ranges for a project # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_global_bgp_ranges_with_http_info(id, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_global_bgp_ranges_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GlobalBgpRangeList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_global_bgp_ranges_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GlobalBgpRangeList]: + """Retrieve all global bgp ranges + + Returns all global bgp ranges for a project :param id: Project UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(GlobalBgpRangeList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_global_bgp_ranges_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GlobalBgpRangeList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def find_global_bgp_ranges_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all global bgp ranges + + Returns all global bgp ranges for a project + + :param id: Project UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_global_bgp_ranges_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_global_bgp_ranges" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "GlobalBgpRangeList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_global_bgp_ranges_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "GlobalBgpRangeList", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{id}/global-bgp-ranges', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/projects/{id}/global-bgp-ranges', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_project_bgp_sessions(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], **kwargs) -> BgpSessionList: # noqa: E501 - """Retrieve all BGP sessions for project # noqa: E501 - Provides a listing of available BGP sessions for the project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_project_bgp_sessions( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> BgpSessionList: + """Retrieve all BGP sessions for project - >>> thread = api.find_project_bgp_sessions(id, async_req=True) - >>> result = thread.get() + Provides a listing of available BGP sessions for the project. :param id: Project UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: BgpSessionList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_project_bgp_sessions_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_project_bgp_sessions_with_http_info(id, **kwargs) # noqa: E501 - - @validate_arguments - def find_project_bgp_sessions_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve all BGP sessions for project # noqa: E501 - - Provides a listing of available BGP sessions for the project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_project_bgp_sessions_with_http_info(id, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_project_bgp_sessions_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BgpSessionList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_project_bgp_sessions_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[BgpSessionList]: + """Retrieve all BGP sessions for project + + Provides a listing of available BGP sessions for the project. :param id: Project UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(BgpSessionList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_project_bgp_sessions_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "BgpSessionList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def find_project_bgp_sessions_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all BGP sessions for project + + Provides a listing of available BGP sessions for the project. + + :param id: Project UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_project_bgp_sessions_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_project_bgp_sessions" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "BgpSessionList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_project_bgp_sessions_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "BgpSessionList", - '401': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{id}/bgp/sessions', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/projects/{id}/bgp/sessions', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def request_bgp_config(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], bgp_config_request_input : Annotated[BgpConfigRequestInput, Field(..., description="BGP config Request to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> None: # noqa: E501 - """Requesting bgp config # noqa: E501 - Requests to enable bgp configuration for a project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def request_bgp_config( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + bgp_config_request_input: Annotated[BgpConfigRequestInput, Field(description="BGP config Request to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Requesting bgp config - >>> thread = api.request_bgp_config(id, bgp_config_request_input, include, async_req=True) - >>> result = thread.get() + Requests to enable bgp configuration for a project. :param id: Project UUID (required) :type id: str @@ -789,32 +1429,78 @@ def request_bgp_config(self, id : Annotated[StrictStr, Field(..., description="P :type bgp_config_request_input: BgpConfigRequestInput :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the request_bgp_config_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.request_bgp_config_with_http_info(id, bgp_config_request_input, include, **kwargs) # noqa: E501 - - @validate_arguments - def request_bgp_config_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], bgp_config_request_input : Annotated[BgpConfigRequestInput, Field(..., description="BGP config Request to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Requesting bgp config # noqa: E501 - - Requests to enable bgp configuration for a project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.request_bgp_config_with_http_info(id, bgp_config_request_input, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._request_bgp_config_serialize( + id=id, + bgp_config_request_input=bgp_config_request_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def request_bgp_config_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + bgp_config_request_input: Annotated[BgpConfigRequestInput, Field(description="BGP config Request to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Requesting bgp config + + Requests to enable bgp configuration for a project. :param id: Project UUID (required) :type id: str @@ -822,265 +1508,505 @@ def request_bgp_config_with_http_info(self, id : Annotated[StrictStr, Field(..., :type bgp_config_request_input: BgpConfigRequestInput :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 + + _param = self._request_bgp_config_serialize( + id=id, + bgp_config_request_input=bgp_config_request_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id', - 'bgp_config_request_input', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def request_bgp_config_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + bgp_config_request_input: Annotated[BgpConfigRequestInput, Field(description="BGP config Request to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Requesting bgp config + + Requests to enable bgp configuration for a project. + + :param id: Project UUID (required) + :type id: str + :param bgp_config_request_input: BGP config Request to create (required) + :type bgp_config_request_input: BgpConfigRequestInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._request_bgp_config_serialize( + id=id, + bgp_config_request_input=bgp_config_request_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method request_bgp_config" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _request_bgp_config_serialize( + self, + id, + bgp_config_request_input, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['bgp_config_request_input'] is not None: - _body_params = _params['bgp_config_request_input'] + if bgp_config_request_input is not None: + _body_params = bgp_config_request_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = {} + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{id}/bgp-configs', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/projects/{id}/bgp-configs', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def update_bgp_session(self, id : Annotated[StrictStr, Field(..., description="BGP session UUID")], body : Annotated[StrictBool, Field(..., description="Default route")], **kwargs) -> None: # noqa: E501 - """Update the BGP session # noqa: E501 - Updates the BGP session by either enabling or disabling the default route functionality. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def update_bgp_session( + self, + id: Annotated[StrictStr, Field(description="BGP session UUID")], + body: Annotated[StrictBool, Field(description="Default route")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Update the BGP session - >>> thread = api.update_bgp_session(id, body, async_req=True) - >>> result = thread.get() + Updates the BGP session by either enabling or disabling the default route functionality. :param id: BGP session UUID (required) :type id: str :param body: Default route (required) :type body: bool - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the update_bgp_session_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.update_bgp_session_with_http_info(id, body, **kwargs) # noqa: E501 - - @validate_arguments - def update_bgp_session_with_http_info(self, id : Annotated[StrictStr, Field(..., description="BGP session UUID")], body : Annotated[StrictBool, Field(..., description="Default route")], **kwargs) -> ApiResponse: # noqa: E501 - """Update the BGP session # noqa: E501 - - Updates the BGP session by either enabling or disabling the default route functionality. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.update_bgp_session_with_http_info(id, body, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._update_bgp_session_serialize( + id=id, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_bgp_session_with_http_info( + self, + id: Annotated[StrictStr, Field(description="BGP session UUID")], + body: Annotated[StrictBool, Field(description="Default route")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Update the BGP session + + Updates the BGP session by either enabling or disabling the default route functionality. :param id: BGP session UUID (required) :type id: str :param body: Default route (required) :type body: bool - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 + + _param = self._update_bgp_session_serialize( + id=id, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id', - 'body' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def update_bgp_session_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="BGP session UUID")], + body: Annotated[StrictBool, Field(description="Default route")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update the BGP session + + Updates the BGP session by either enabling or disabling the default route functionality. + + :param id: BGP session UUID (required) + :type id: str + :param body: Default route (required) + :type body: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_bgp_session_serialize( + id=id, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method update_bgp_session" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _update_bgp_session_serialize( + self, + id, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['body'] is not None: - _body_params = _params['body'] + if body is not None: + _body_params = body + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = {} + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/bgp/sessions/{id}', 'PUT', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='PUT', + resource_path='/bgp/sessions/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/capacity_api.py b/equinix_metal/equinix_metal/api/capacity_api.py index 34b0dd35..2b7b6a7e 100644 --- a/equinix_metal/equinix_metal/api/capacity_api.py +++ b/equinix_metal/equinix_metal/api/capacity_api.py @@ -12,881 +12,1596 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated from pydantic import Field, StrictStr - +from typing_extensions import Annotated from equinix_metal.models.capacity_check_per_facility_list import CapacityCheckPerFacilityList from equinix_metal.models.capacity_check_per_metro_list import CapacityCheckPerMetroList from equinix_metal.models.capacity_input import CapacityInput from equinix_metal.models.capacity_list import CapacityList -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class CapacityApi(object): +class CapacityApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def check_capacity_for_facility( + self, + capacity_input: Annotated[CapacityInput, Field(description="Facility to check capacity in")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CapacityCheckPerFacilityList: + """(Deprecated) Check capacity + + Validates if a deploy can be fulfilled. - @validate_arguments - def check_capacity_for_facility(self, capacity_input : Annotated[CapacityInput, Field(..., description="Facility to check capacity in")], **kwargs) -> CapacityCheckPerFacilityList: # noqa: E501 - """(Deprecated) Check capacity # noqa: E501 + :param capacity_input: Facility to check capacity in (required) + :type capacity_input: CapacityInput + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /capacity is deprecated.", DeprecationWarning) - Validates if a deploy can be fulfilled. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _param = self._check_capacity_for_facility_serialize( + capacity_input=capacity_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - >>> thread = api.check_capacity_for_facility(capacity_input, async_req=True) - >>> result = thread.get() + _response_types_map: Dict[str, Optional[str]] = { + '200': "CapacityCheckPerFacilityList", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def check_capacity_for_facility_with_http_info( + self, + capacity_input: Annotated[CapacityInput, Field(description="Facility to check capacity in")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CapacityCheckPerFacilityList]: + """(Deprecated) Check capacity + + Validates if a deploy can be fulfilled. :param capacity_input: Facility to check capacity in (required) :type capacity_input: CapacityInput - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: CapacityCheckPerFacilityList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the check_capacity_for_facility_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.check_capacity_for_facility_with_http_info(capacity_input, **kwargs) # noqa: E501 - - @validate_arguments - def check_capacity_for_facility_with_http_info(self, capacity_input : Annotated[CapacityInput, Field(..., description="Facility to check capacity in")], **kwargs) -> ApiResponse: # noqa: E501 - """(Deprecated) Check capacity # noqa: E501 - - Validates if a deploy can be fulfilled. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.check_capacity_for_facility_with_http_info(capacity_input, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + warnings.warn("POST /capacity is deprecated.", DeprecationWarning) + + _param = self._check_capacity_for_facility_serialize( + capacity_input=capacity_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CapacityCheckPerFacilityList", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def check_capacity_for_facility_without_preload_content( + self, + capacity_input: Annotated[CapacityInput, Field(description="Facility to check capacity in")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """(Deprecated) Check capacity + + Validates if a deploy can be fulfilled. :param capacity_input: Facility to check capacity in (required) :type capacity_input: CapacityInput - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(CapacityCheckPerFacilityList, status_code(int), headers(HTTPHeaderDict)) - """ - + """ # noqa: E501 warnings.warn("POST /capacity is deprecated.", DeprecationWarning) - _params = locals() + _param = self._check_capacity_for_facility_serialize( + capacity_input=capacity_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _all_params = [ - 'capacity_input' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + _response_types_map: Dict[str, Optional[str]] = { + '200': "CapacityCheckPerFacilityList", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) + return response_data.response - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method check_capacity_for_facility" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + def _check_capacity_for_facility_serialize( + self, + capacity_input, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the path parameters - _path_params = {} + _host = None + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['capacity_input'] is not None: - _body_params = _params['capacity_input'] + if capacity_input is not None: + _body_params = capacity_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '200': "CapacityCheckPerFacilityList", - '401': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/capacity', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/capacity', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def check_capacity_for_metro(self, capacity_input : Annotated[CapacityInput, Field(..., description="Metro to check capacity in")], **kwargs) -> CapacityCheckPerMetroList: # noqa: E501 - """Check capacity for a metro # noqa: E501 - Validates if a deploy can be fulfilled in a metro. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def check_capacity_for_metro( + self, + capacity_input: Annotated[CapacityInput, Field(description="Metro to check capacity in")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CapacityCheckPerMetroList: + """Check capacity for a metro - >>> thread = api.check_capacity_for_metro(capacity_input, async_req=True) - >>> result = thread.get() + Validates if a deploy can be fulfilled in a metro. :param capacity_input: Metro to check capacity in (required) :type capacity_input: CapacityInput - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: CapacityCheckPerMetroList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the check_capacity_for_metro_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.check_capacity_for_metro_with_http_info(capacity_input, **kwargs) # noqa: E501 - - @validate_arguments - def check_capacity_for_metro_with_http_info(self, capacity_input : Annotated[CapacityInput, Field(..., description="Metro to check capacity in")], **kwargs) -> ApiResponse: # noqa: E501 - """Check capacity for a metro # noqa: E501 - - Validates if a deploy can be fulfilled in a metro. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.check_capacity_for_metro_with_http_info(capacity_input, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._check_capacity_for_metro_serialize( + capacity_input=capacity_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CapacityCheckPerMetroList", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def check_capacity_for_metro_with_http_info( + self, + capacity_input: Annotated[CapacityInput, Field(description="Metro to check capacity in")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CapacityCheckPerMetroList]: + """Check capacity for a metro + + Validates if a deploy can be fulfilled in a metro. :param capacity_input: Metro to check capacity in (required) :type capacity_input: CapacityInput - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(CapacityCheckPerMetroList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._check_capacity_for_metro_serialize( + capacity_input=capacity_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "CapacityCheckPerMetroList", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'capacity_input' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def check_capacity_for_metro_without_preload_content( + self, + capacity_input: Annotated[CapacityInput, Field(description="Metro to check capacity in")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Check capacity for a metro + + Validates if a deploy can be fulfilled in a metro. + + :param capacity_input: Metro to check capacity in (required) + :type capacity_input: CapacityInput + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._check_capacity_for_metro_serialize( + capacity_input=capacity_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method check_capacity_for_metro" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "CapacityCheckPerMetroList", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} + def _check_capacity_for_metro_serialize( + self, + capacity_input, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['capacity_input'] is not None: - _body_params = _params['capacity_input'] + if capacity_input is not None: + _body_params = capacity_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '200': "CapacityCheckPerMetroList", - '401': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/capacity/metros', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/capacity/metros', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_capacity_for_facility(self, **kwargs) -> CapacityList: # noqa: E501 - """View capacity # noqa: E501 - Returns a list of facilities and plans with their current capacity. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_capacity_for_facility( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CapacityList: + """View capacity - >>> thread = api.find_capacity_for_facility(async_req=True) - >>> result = thread.get() + Returns a list of facilities and plans with their current capacity. - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: CapacityList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_capacity_for_facility_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_capacity_for_facility_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - def find_capacity_for_facility_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 - """View capacity # noqa: E501 - - Returns a list of facilities and plans with their current capacity. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_capacity_for_facility_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + """ # noqa: E501 + + _param = self._find_capacity_for_facility_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CapacityList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_capacity_for_facility_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CapacityList]: + """View capacity + + Returns a list of facilities and plans with their current capacity. + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(CapacityList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 - _params = locals() + _param = self._find_capacity_for_facility_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _all_params = [ - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + _response_types_map: Dict[str, Optional[str]] = { + '200': "CapacityList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def find_capacity_for_facility_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """View capacity + + Returns a list of facilities and plans with their current capacity. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_capacity_for_facility_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_capacity_for_facility" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "CapacityList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} + def _find_capacity_for_facility_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "CapacityList", - '401': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/capacity', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/capacity', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_capacity_for_metro(self, **kwargs) -> CapacityList: # noqa: E501 - """View capacity for metros # noqa: E501 - Returns a list of metros and plans with their current capacity. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_capacity_for_metro( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CapacityList: + """View capacity for metros - >>> thread = api.find_capacity_for_metro(async_req=True) - >>> result = thread.get() + Returns a list of metros and plans with their current capacity. - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: CapacityList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_capacity_for_metro_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_capacity_for_metro_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - def find_capacity_for_metro_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 - """View capacity for metros # noqa: E501 - - Returns a list of metros and plans with their current capacity. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_capacity_for_metro_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + """ # noqa: E501 + + _param = self._find_capacity_for_metro_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CapacityList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_capacity_for_metro_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CapacityList]: + """View capacity for metros + + Returns a list of metros and plans with their current capacity. + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(CapacityList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 - _params = locals() + _param = self._find_capacity_for_metro_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _all_params = [ - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + _response_types_map: Dict[str, Optional[str]] = { + '200': "CapacityList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def find_capacity_for_metro_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """View capacity for metros + + Returns a list of metros and plans with their current capacity. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_capacity_for_metro_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_capacity_for_metro" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "CapacityList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} + def _find_capacity_for_metro_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "CapacityList", - '401': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/capacity/metros', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/capacity/metros', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_organization_capacity_per_facility(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], **kwargs) -> CapacityList: # noqa: E501 - """View available hardware plans per Facility for given organization # noqa: E501 - Returns a list of facilities and plans with their current capacity. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_organization_capacity_per_facility( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CapacityList: + """View available hardware plans per Facility for given organization - >>> thread = api.find_organization_capacity_per_facility(id, async_req=True) - >>> result = thread.get() + Returns a list of facilities and plans with their current capacity. :param id: Organization UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: CapacityList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_organization_capacity_per_facility_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_organization_capacity_per_facility_with_http_info(id, **kwargs) # noqa: E501 - - @validate_arguments - def find_organization_capacity_per_facility_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """View available hardware plans per Facility for given organization # noqa: E501 - - Returns a list of facilities and plans with their current capacity. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_organization_capacity_per_facility_with_http_info(id, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_organization_capacity_per_facility_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CapacityList", + '401': "Error", + '403': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_organization_capacity_per_facility_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CapacityList]: + """View available hardware plans per Facility for given organization + + Returns a list of facilities and plans with their current capacity. :param id: Organization UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(CapacityList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_organization_capacity_per_facility_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "CapacityList", + '401': "Error", + '403': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def find_organization_capacity_per_facility_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """View available hardware plans per Facility for given organization + + Returns a list of facilities and plans with their current capacity. + + :param id: Organization UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_organization_capacity_per_facility_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_organization_capacity_per_facility" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "CapacityList", + '401': "Error", + '403': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_organization_capacity_per_facility_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "CapacityList", - '401': "Error", - '403': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/organizations/{id}/capacity', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/organizations/{id}/capacity', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_organization_capacity_per_metro(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], **kwargs) -> CapacityList: # noqa: E501 - """View available hardware plans per Metro for given organization # noqa: E501 - Returns a list of metros and plans with their current capacity. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_organization_capacity_per_metro( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CapacityList: + """View available hardware plans per Metro for given organization - >>> thread = api.find_organization_capacity_per_metro(id, async_req=True) - >>> result = thread.get() + Returns a list of metros and plans with their current capacity. :param id: Organization UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: CapacityList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_organization_capacity_per_metro_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_organization_capacity_per_metro_with_http_info(id, **kwargs) # noqa: E501 - - @validate_arguments - def find_organization_capacity_per_metro_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """View available hardware plans per Metro for given organization # noqa: E501 - - Returns a list of metros and plans with their current capacity. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_organization_capacity_per_metro_with_http_info(id, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_organization_capacity_per_metro_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CapacityList", + '401': "Error", + '403': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_organization_capacity_per_metro_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CapacityList]: + """View available hardware plans per Metro for given organization + + Returns a list of metros and plans with their current capacity. :param id: Organization UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(CapacityList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_organization_capacity_per_metro_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CapacityList", + '401': "Error", + '403': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def find_organization_capacity_per_metro_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """View available hardware plans per Metro for given organization + + Returns a list of metros and plans with their current capacity. + + :param id: Organization UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_organization_capacity_per_metro_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_organization_capacity_per_metro" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "CapacityList", + '401': "Error", + '403': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_organization_capacity_per_metro_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "CapacityList", - '401': "Error", - '403': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/organizations/{id}/capacity/metros', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/organizations/{id}/capacity/metros', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/console_log_details_api.py b/equinix_metal/equinix_metal/api/console_log_details_api.py index 307af156..0abdf7b1 100644 --- a/equinix_metal/equinix_metal/api/console_log_details_api.py +++ b/equinix_metal/equinix_metal/api/console_log_details_api.py @@ -12,177 +12,293 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated from pydantic import Field, StrictStr +from typing_extensions import Annotated -from typing import Union - - -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class ConsoleLogDetailsApi(object): +class ConsoleLogDetailsApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def capture_screenshot( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> bytearray: + """capture_screenshot - @validate_arguments - def capture_screenshot(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], **kwargs) -> bytearray: # noqa: E501 - """capture_screenshot # noqa: E501 - - Capture a screenshot from the device, if supported, via the BMC. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.capture_screenshot(id, async_req=True) - >>> result = thread.get() + Capture a screenshot from the device, if supported, via the BMC. :param id: Device UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: bytearray - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the capture_screenshot_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.capture_screenshot_with_http_info(id, **kwargs) # noqa: E501 - - @validate_arguments - def capture_screenshot_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """capture_screenshot # noqa: E501 - - Capture a screenshot from the device, if supported, via the BMC. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.capture_screenshot_with_http_info(id, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._capture_screenshot_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytearray", + '403': "Error", + '404': "Error", + '501': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def capture_screenshot_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[bytearray]: + """capture_screenshot + + Capture a screenshot from the device, if supported, via the BMC. :param id: Device UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(bytearray, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._capture_screenshot_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytearray", + '403': "Error", + '404': "Error", + '501': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def capture_screenshot_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """capture_screenshot + + Capture a screenshot from the device, if supported, via the BMC. + + :param id: Device UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._capture_screenshot_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytearray", + '403': "Error", + '404': "Error", + '501': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) + return response_data.response - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method capture_screenshot" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + def _capture_screenshot_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + _host = None + + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/jpeg', 'application/json']) # noqa: E501 + [ + 'application/jpeg', + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "bytearray", - '403': "Error", - '404': "Error", - '501': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/devices/{id}/diagnostics/screenshot', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/devices/{id}/diagnostics/screenshot', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/devices_api.py b/equinix_metal/equinix_metal/api/devices_api.py index 42866586..e1367ba6 100644 --- a/equinix_metal/equinix_metal/api/devices_api.py +++ b/equinix_metal/equinix_metal/api/devices_api.py @@ -12,18 +12,14 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictBool, StrictStr, conint, conlist, validator - -from typing import Optional - +from pydantic import Field, StrictBool, StrictStr, field_validator +from typing import List, Optional +from typing_extensions import Annotated from equinix_metal.models.bgp_session_input import BGPSessionInput from equinix_metal.models.bgp_session import BgpSession from equinix_metal.models.bgp_session_list import BgpSessionList @@ -42,36 +38,122 @@ from equinix_metal.models.metadata import Metadata from equinix_metal.models.userdata import Userdata -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class DevicesApi(object): +class DevicesApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def create_bgp_session( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + bgp_session_input: Annotated[BGPSessionInput, Field(description="BGP session to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> BgpSession: + """Create a BGP session - @validate_arguments - def create_bgp_session(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], bgp_session_input : Annotated[BGPSessionInput, Field(..., description="BGP session to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> BgpSession: # noqa: E501 - """Create a BGP session # noqa: E501 + Creates a BGP session. - Creates a BGP session. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + :param id: Device UUID (required) + :type id: str + :param bgp_session_input: BGP session to create (required) + :type bgp_session_input: BGPSessionInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_bgp_session_serialize( + id=id, + bgp_session_input=bgp_session_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - >>> thread = api.create_bgp_session(id, bgp_session_input, include, async_req=True) - >>> result = thread.get() + _response_types_map: Dict[str, Optional[str]] = { + '201': "BgpSession", + '401': "Error", + '403': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_bgp_session_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + bgp_session_input: Annotated[BGPSessionInput, Field(description="BGP session to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[BgpSession]: + """Create a BGP session + + Creates a BGP session. :param id: Device UUID (required) :type id: str @@ -79,32 +161,77 @@ def create_bgp_session(self, id : Annotated[StrictStr, Field(..., description="D :type bgp_session_input: BGPSessionInput :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: BgpSession - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the create_bgp_session_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.create_bgp_session_with_http_info(id, bgp_session_input, include, **kwargs) # noqa: E501 + """ # noqa: E501 + + _param = self._create_bgp_session_serialize( + id=id, + bgp_session_input=bgp_session_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "BgpSession", + '401': "Error", + '403': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - @validate_arguments - def create_bgp_session_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], bgp_session_input : Annotated[BGPSessionInput, Field(..., description="BGP session to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Create a BGP session # noqa: E501 - Creates a BGP session. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def create_bgp_session_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + bgp_session_input: Annotated[BGPSessionInput, Field(description="BGP session to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a BGP session - >>> thread = api.create_bgp_session_with_http_info(id, bgp_session_input, include, async_req=True) - >>> result = thread.get() + Creates a BGP session. :param id: Device UUID (required) :type id: str @@ -112,132 +239,155 @@ def create_bgp_session_with_http_info(self, id : Annotated[StrictStr, Field(..., :type bgp_session_input: BGPSessionInput :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(BgpSession, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._create_bgp_session_serialize( + id=id, + bgp_session_input=bgp_session_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "BgpSession", + '401': "Error", + '403': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _params = locals() - _all_params = [ - 'id', - 'bgp_session_input', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_bgp_session" % _key - ) - _params[_key] = _val - del _params['kwargs'] + def _create_bgp_session_serialize( + self, + id, + bgp_session_input, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - _collection_formats = {} + _host = None - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' - + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['bgp_session_input'] is not None: - _body_params = _params['bgp_session_input'] + if bgp_session_input is not None: + _body_params = bgp_session_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '201': "BgpSession", - '401': "Error", - '403': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/devices/{id}/bgp/sessions', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/devices/{id}/bgp/sessions', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def create_device(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], create_device_request : Annotated[CreateDeviceRequest, Field(..., description="Device to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> Device: # noqa: E501 - """Create a device # noqa: E501 - Creates a new device and provisions it in the specified location. Device type-specific options are accepted. For example, `baremetal` devices accept `operating_system`, `hostname`, and `plan`. These parameters may not be accepted for other device types. The default device type is `baremetal`. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def create_device( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + create_device_request: Annotated[CreateDeviceRequest, Field(description="Device to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Device: + """Create a device - >>> thread = api.create_device(id, create_device_request, include, exclude, async_req=True) - >>> result = thread.get() + Creates a new device and provisions it in the specified location. Device type-specific options are accepted. For example, `baremetal` devices accept `operating_system`, `hostname`, and `plan`. These parameters may not be accepted for other device types. The default device type is `baremetal`. :param id: Project UUID (required) :type id: str @@ -247,32 +397,80 @@ def create_device(self, id : Annotated[StrictStr, Field(..., description="Projec :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Device - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the create_device_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.create_device_with_http_info(id, create_device_request, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def create_device_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], create_device_request : Annotated[CreateDeviceRequest, Field(..., description="Device to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Create a device # noqa: E501 + """ # noqa: E501 + + _param = self._create_device_serialize( + id=id, + create_device_request=create_device_request, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Creates a new device and provisions it in the specified location. Device type-specific options are accepted. For example, `baremetal` devices accept `operating_system`, `hostname`, and `plan`. These parameters may not be accepted for other device types. The default device type is `baremetal`. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '201': "Device", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_device_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + create_device_request: Annotated[CreateDeviceRequest, Field(description="Device to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Device]: + """Create a device - >>> thread = api.create_device_with_http_info(id, create_device_request, include, exclude, async_req=True) - >>> result = thread.get() + Creates a new device and provisions it in the specified location. Device type-specific options are accepted. For example, `baremetal` devices accept `operating_system`, `hostname`, and `plan`. These parameters may not be accepted for other device types. The default device type is `baremetal`. :param id: Project UUID (required) :type id: str @@ -282,138 +480,246 @@ def create_device_with_http_info(self, id : Annotated[StrictStr, Field(..., desc :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Device, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._create_device_serialize( + id=id, + create_device_request=create_device_request, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '201': "Device", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id', - 'create_device_request', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_device" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + @validate_call + def create_device_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + create_device_request: Annotated[CreateDeviceRequest, Field(description="Device to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a device - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + Creates a new device and provisions it in the specified location. Device type-specific options are accepted. For example, `baremetal` devices accept `operating_system`, `hostname`, and `plan`. These parameters may not be accepted for other device types. The default device type is `baremetal`. + :param id: Project UUID (required) + :type id: str + :param create_device_request: Device to create (required) + :type create_device_request: CreateDeviceRequest + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_device_serialize( + id=id, + create_device_request=create_device_request, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _response_types_map: Dict[str, Optional[str]] = { + '201': "Device", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_device_serialize( + self, + id, + create_device_request, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['create_device_request'] is not None: - _body_params = _params['create_device_request'] + if create_device_request is not None: + _body_params = create_device_request + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '201': "Device", - '401': "Error", - '403': "Error", - '404': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{id}/devices', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/projects/{id}/devices', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def create_ip_assignment(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], ip_assignment_input : Annotated[IPAssignmentInput, Field(..., description="IPAssignment to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> IPAssignment: # noqa: E501 - """Create an ip assignment # noqa: E501 - Creates an ip assignment for a device. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def create_ip_assignment( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + ip_assignment_input: Annotated[IPAssignmentInput, Field(description="IPAssignment to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> IPAssignment: + """Create an ip assignment - >>> thread = api.create_ip_assignment(id, ip_assignment_input, include, exclude, async_req=True) - >>> result = thread.get() + Creates an ip assignment for a device. :param id: Device UUID (required) :type id: str @@ -423,32 +729,79 @@ def create_ip_assignment(self, id : Annotated[StrictStr, Field(..., description= :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: IPAssignment - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the create_ip_assignment_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.create_ip_assignment_with_http_info(id, ip_assignment_input, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def create_ip_assignment_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], ip_assignment_input : Annotated[IPAssignmentInput, Field(..., description="IPAssignment to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Create an ip assignment # noqa: E501 + """ # noqa: E501 + + _param = self._create_ip_assignment_serialize( + id=id, + ip_assignment_input=ip_assignment_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Creates an ip assignment for a device. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '201': "IPAssignment", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_ip_assignment_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + ip_assignment_input: Annotated[IPAssignmentInput, Field(description="IPAssignment to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[IPAssignment]: + """Create an ip assignment - >>> thread = api.create_ip_assignment_with_http_info(id, ip_assignment_input, include, exclude, async_req=True) - >>> result = thread.get() + Creates an ip assignment for a device. :param id: Device UUID (required) :type id: str @@ -458,432 +811,808 @@ def create_ip_assignment_with_http_info(self, id : Annotated[StrictStr, Field(.. :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(IPAssignment, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'id', - 'ip_assignment_input', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_ip_assignment" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] - - - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' - - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' - - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params['ip_assignment_input'] is not None: - _body_params = _params['ip_assignment_input'] - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list - - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 + """ # noqa: E501 + + _param = self._create_ip_assignment_serialize( + id=id, + ip_assignment_input=ip_assignment_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _response_types_map = { + _response_types_map: Dict[str, Optional[str]] = { '201': "IPAssignment", '401': "Error", '404': "Error", '422': "Error", } - - return self.api_client.call_api( - '/devices/{id}/ips', 'POST', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + ) - @validate_arguments - def delete_device(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], force_delete : Annotated[Optional[StrictBool], Field(description="Force the deletion of the device, by detaching any storage volume still active.")] = None, **kwargs) -> None: # noqa: E501 - """Delete the device # noqa: E501 - Deletes a device and deprovisions it in our datacenter. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def create_ip_assignment_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + ip_assignment_input: Annotated[IPAssignmentInput, Field(description="IPAssignment to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create an ip assignment - >>> thread = api.delete_device(id, force_delete, async_req=True) - >>> result = thread.get() + Creates an ip assignment for a device. :param id: Device UUID (required) :type id: str - :param force_delete: Force the deletion of the device, by detaching any storage volume still active. - :type force_delete: bool - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional + :param ip_assignment_input: IPAssignment to create (required) + :type ip_assignment_input: IPAssignmentInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the delete_device_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.delete_device_with_http_info(id, force_delete, **kwargs) # noqa: E501 + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_ip_assignment_serialize( + id=id, + ip_assignment_input=ip_assignment_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - @validate_arguments - def delete_device_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], force_delete : Annotated[Optional[StrictBool], Field(description="Force the deletion of the device, by detaching any storage volume still active.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Delete the device # noqa: E501 + _response_types_map: Dict[str, Optional[str]] = { + '201': "IPAssignment", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_ip_assignment_serialize( + self, + id, + ip_assignment_input, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - Deletes a device and deprovisions it in our datacenter. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + + # process the header parameters + # process the form parameters + # process the body parameter + if ip_assignment_input is not None: + _body_params = ip_assignment_input - >>> thread = api.delete_device_with_http_info(id, force_delete, async_req=True) - >>> result = thread.get() + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/devices/{id}/ips', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + @validate_call + def delete_device( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + force_delete: Annotated[Optional[StrictBool], Field(description="Force the deletion of the device, by detaching any storage volume still active.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete the device + + Deletes a device and deprovisions it in our datacenter. :param id: Device UUID (required) :type id: str :param force_delete: Force the deletion of the device, by detaching any storage volume still active. :type force_delete: bool - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 + + _param = self._delete_device_serialize( + id=id, + force_delete=force_delete, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_device_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + force_delete: Annotated[Optional[StrictBool], Field(description="Force the deletion of the device, by detaching any storage volume still active.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete the device - _all_params = [ - 'id', - 'force_delete' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_device" % _key - ) - _params[_key] = _val - del _params['kwargs'] + Deletes a device and deprovisions it in our datacenter. + + :param id: Device UUID (required) + :type id: str + :param force_delete: Force the deletion of the device, by detaching any storage volume still active. + :type force_delete: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_device_serialize( + id=id, + force_delete=force_delete, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _collection_formats = {} + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + @validate_call + def delete_device_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + force_delete: Annotated[Optional[StrictBool], Field(description="Force the deletion of the device, by detaching any storage volume still active.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete the device - # process the query parameters - _query_params = [] - if _params.get('force_delete') is not None: # noqa: E501 - _query_params.append(('force_delete', _params['force_delete'])) + Deletes a device and deprovisions it in our datacenter. + + :param id: Device UUID (required) + :type id: str + :param force_delete: Force the deletion of the device, by detaching any storage volume still active. + :type force_delete: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_device_serialize( + id=id, + force_delete=force_delete, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_device_serialize( + self, + id, + force_delete, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if force_delete is not None: + + _query_params.append(('force_delete', force_delete)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/devices/{id}', 'DELETE', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='DELETE', + resource_path='/devices/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_bgp_sessions(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> BgpSessionList: # noqa: E501 - """Retrieve all BGP sessions # noqa: E501 - Provides a listing of available BGP sessions for the device. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_bgp_sessions( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> BgpSessionList: + """Retrieve all BGP sessions - >>> thread = api.find_bgp_sessions(id, include, async_req=True) - >>> result = thread.get() + Provides a listing of available BGP sessions for the device. :param id: Device UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: BgpSessionList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_bgp_sessions_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_bgp_sessions_with_http_info(id, include, **kwargs) # noqa: E501 + """ # noqa: E501 + + _param = self._find_bgp_sessions_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BgpSessionList", + '401': "Error", + '403': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_bgp_sessions_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[BgpSessionList]: + """Retrieve all BGP sessions - @validate_arguments - def find_bgp_sessions_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve all BGP sessions # noqa: E501 + Provides a listing of available BGP sessions for the device. - Provides a listing of available BGP sessions for the device. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + :param id: Device UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_bgp_sessions_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BgpSessionList", + '401': "Error", + '403': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - >>> thread = api.find_bgp_sessions_with_http_info(id, include, async_req=True) - >>> result = thread.get() + + @validate_call + def find_bgp_sessions_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all BGP sessions + + Provides a listing of available BGP sessions for the device. :param id: Device UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(BgpSessionList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_bgp_sessions_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "BgpSessionList", + '401': "Error", + '403': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _all_params = [ - 'id', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_bgp_sessions" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + def _find_bgp_sessions_serialize( + self, + id, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' - + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "BgpSessionList", - '401': "Error", - '403': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/devices/{id}/bgp/sessions', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/devices/{id}/bgp/sessions', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_device_by_id(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> Device: # noqa: E501 - """Retrieve a device # noqa: E501 - Type-specific options (such as facility for baremetal devices) will be included as part of the main data structure. State value can be one of: active inactive queued or provisioning # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_device_by_id( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Device: + """Retrieve a device - >>> thread = api.find_device_by_id(id, include, exclude, async_req=True) - >>> result = thread.get() + Type-specific options (such as facility for baremetal devices) will be included as part of the main data structure. State value can be one of: active inactive queued or provisioning :param id: Device UUID (required) :type id: str @@ -891,32 +1620,77 @@ def find_device_by_id(self, id : Annotated[StrictStr, Field(..., description="De :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Device - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_device_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_device_by_id_with_http_info(id, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def find_device_by_id_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve a device # noqa: E501 + """ # noqa: E501 + + _param = self._find_device_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Type-specific options (such as facility for baremetal devices) will be included as part of the main data structure. State value can be one of: active inactive queued or provisioning # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "Device", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_device_by_id_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Device]: + """Retrieve a device - >>> thread = api.find_device_by_id_with_http_info(id, include, exclude, async_req=True) - >>> result = thread.get() + Type-specific options (such as facility for baremetal devices) will be included as part of the main data structure. State value can be one of: active inactive queued or provisioning :param id: Device UUID (required) :type id: str @@ -924,547 +1698,1094 @@ def find_device_by_id_with_http_info(self, id : Annotated[StrictStr, Field(..., :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Device, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_device_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "Device", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_device_by_id" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + @validate_call + def find_device_by_id_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve a device - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + Type-specific options (such as facility for baremetal devices) will be included as part of the main data structure. State value can be one of: active inactive queued or provisioning + :param id: Device UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_device_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _response_types_map: Dict[str, Optional[str]] = { + '200': "Device", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _find_device_by_id_serialize( + self, + id, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _host = None + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "Device", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/devices/{id}', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/devices/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_device_customdata(self, id : Annotated[StrictStr, Field(..., description="Instance UUID")], **kwargs) -> None: # noqa: E501 - """Retrieve the custom metadata of an instance # noqa: E501 - Provides the custom metadata stored for this instance in json format # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_device_customdata( + self, + id: Annotated[StrictStr, Field(description="Instance UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Retrieve the custom metadata of an instance - >>> thread = api.find_device_customdata(id, async_req=True) - >>> result = thread.get() + Provides the custom metadata stored for this instance in json format :param id: Instance UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_device_customdata_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_device_customdata_with_http_info(id, **kwargs) # noqa: E501 + """ # noqa: E501 + + _param = self._find_device_customdata_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - @validate_arguments - def find_device_customdata_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Instance UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve the custom metadata of an instance # noqa: E501 + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_device_customdata_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Instance UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Retrieve the custom metadata of an instance - Provides the custom metadata stored for this instance in json format # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + Provides the custom metadata stored for this instance in json format - >>> thread = api.find_device_customdata_with_http_info(id, async_req=True) - >>> result = thread.get() + :param id: Instance UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_device_customdata_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def find_device_customdata_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Instance UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve the custom metadata of an instance + + Provides the custom metadata stored for this instance in json format :param id: Instance UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 + + _param = self._find_device_customdata_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _params = locals() - _all_params = [ - 'id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_device_customdata" % _key - ) - _params[_key] = _val - del _params['kwargs'] + def _find_device_customdata_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - _collection_formats = {} + _host = None - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/devices/{id}/customdata', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/devices/{id}/customdata', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_device_metadata_by_id(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], **kwargs) -> Metadata: # noqa: E501 - """Retrieve metadata # noqa: E501 - Retrieve device metadata # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_device_metadata_by_id( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Metadata: + """Retrieve metadata - >>> thread = api.find_device_metadata_by_id(id, async_req=True) - >>> result = thread.get() + Retrieve device metadata :param id: Device UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Metadata - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_device_metadata_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_device_metadata_by_id_with_http_info(id, **kwargs) # noqa: E501 + """ # noqa: E501 + + _param = self._find_device_metadata_by_id_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - @validate_arguments - def find_device_metadata_by_id_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve metadata # noqa: E501 + _response_types_map: Dict[str, Optional[str]] = { + '200': "Metadata", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_device_metadata_by_id_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Metadata]: + """Retrieve metadata - Retrieve device metadata # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + Retrieve device metadata - >>> thread = api.find_device_metadata_by_id_with_http_info(id, async_req=True) - >>> result = thread.get() + :param id: Device UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_device_metadata_by_id_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Metadata", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def find_device_metadata_by_id_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve metadata + + Retrieve device metadata :param id: Device UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Metadata, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_device_metadata_by_id_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Metadata", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _params = locals() - _all_params = [ - 'id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_device_metadata_by_id" % _key - ) - _params[_key] = _val - del _params['kwargs'] + def _find_device_metadata_by_id_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - _collection_formats = {} + _host = None - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "Metadata", - '401': "Error", - '404': "Error", - '422': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/devices/{id}/metadata', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/devices/{id}/metadata', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_device_userdata_by_id(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], **kwargs) -> Userdata: # noqa: E501 - """Retrieve userdata # noqa: E501 - Retrieve device userdata # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_device_userdata_by_id( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Userdata: + """Retrieve userdata - >>> thread = api.find_device_userdata_by_id(id, async_req=True) - >>> result = thread.get() + Retrieve device userdata :param id: Device UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Userdata - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_device_userdata_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_device_userdata_by_id_with_http_info(id, **kwargs) # noqa: E501 + """ # noqa: E501 + + _param = self._find_device_userdata_by_id_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - @validate_arguments - def find_device_userdata_by_id_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve userdata # noqa: E501 + _response_types_map: Dict[str, Optional[str]] = { + '200': "Userdata", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_device_userdata_by_id_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Userdata]: + """Retrieve userdata - Retrieve device userdata # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + Retrieve device userdata - >>> thread = api.find_device_userdata_by_id_with_http_info(id, async_req=True) - >>> result = thread.get() + :param id: Device UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_device_userdata_by_id_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Userdata", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def find_device_userdata_by_id_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve userdata + + Retrieve device userdata :param id: Device UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Userdata, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_device_userdata_by_id_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Userdata", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _params = locals() - _all_params = [ - 'id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_device_userdata_by_id" % _key - ) - _params[_key] = _val - del _params['kwargs'] + def _find_device_userdata_by_id_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - _collection_formats = {} + _host = None - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 + _auth_settings: List[str] = [ + 'x_auth_token' + ] - _response_types_map = { - '200': "Userdata", - '401': "Error", + return self.api_client.param_serialize( + method='GET', + resource_path='/devices/{id}/userdata', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + @validate_call + def find_instance_bandwidth( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + var_from: Annotated[StrictStr, Field(description="Timestamp from range")], + until: Annotated[StrictStr, Field(description="Timestamp to range")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Retrieve an instance bandwidth + + Retrieve an instance bandwidth for a given period of time. + + :param id: Device UUID (required) + :type id: str + :param var_from: Timestamp from range (required) + :type var_from: str + :param until: Timestamp to range (required) + :type until: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_instance_bandwidth_serialize( + id=id, + var_from=var_from, + until=until, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '403': "Error", '404': "Error", - '422': "Error", } - - return self.api_client.call_api( - '/devices/{id}/userdata', 'GET', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - def find_instance_bandwidth(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], var_from : Annotated[StrictStr, Field(..., description="Timestamp from range")], until : Annotated[StrictStr, Field(..., description="Timestamp to range")], **kwargs) -> None: # noqa: E501 - """Retrieve an instance bandwidth # noqa: E501 - - Retrieve an instance bandwidth for a given period of time. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + ).data + + + @validate_call + def find_instance_bandwidth_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + var_from: Annotated[StrictStr, Field(description="Timestamp from range")], + until: Annotated[StrictStr, Field(description="Timestamp to range")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Retrieve an instance bandwidth - >>> thread = api.find_instance_bandwidth(id, var_from, until, async_req=True) - >>> result = thread.get() + Retrieve an instance bandwidth for a given period of time. :param id: Device UUID (required) :type id: str @@ -1472,32 +2793,76 @@ def find_instance_bandwidth(self, id : Annotated[StrictStr, Field(..., descripti :type var_from: str :param until: Timestamp to range (required) :type until: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_instance_bandwidth_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_instance_bandwidth_with_http_info(id, var_from, until, **kwargs) # noqa: E501 + """ # noqa: E501 + + _param = self._find_instance_bandwidth_serialize( + id=id, + var_from=var_from, + until=until, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - @validate_arguments - def find_instance_bandwidth_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], var_from : Annotated[StrictStr, Field(..., description="Timestamp from range")], until : Annotated[StrictStr, Field(..., description="Timestamp to range")], **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve an instance bandwidth # noqa: E501 - Retrieve an instance bandwidth for a given period of time. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_instance_bandwidth_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + var_from: Annotated[StrictStr, Field(description="Timestamp from range")], + until: Annotated[StrictStr, Field(description="Timestamp to range")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve an instance bandwidth - >>> thread = api.find_instance_bandwidth_with_http_info(id, var_from, until, async_req=True) - >>> result = thread.get() + Retrieve an instance bandwidth for a given period of time. :param id: Device UUID (required) :type id: str @@ -1505,264 +2870,421 @@ def find_instance_bandwidth_with_http_info(self, id : Annotated[StrictStr, Field :type var_from: str :param until: Timestamp to range (required) :type until: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() + """ # noqa: E501 + + _param = self._find_instance_bandwidth_serialize( + id=id, + var_from=var_from, + until=until, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _all_params = [ - 'id', - 'var_from', - 'until' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_instance_bandwidth" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_instance_bandwidth_serialize( + self, + id, + var_from, + until, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('var_from') is not None: # noqa: E501 - _query_params.append(('from', _params['var_from'])) + _collection_formats: Dict[str, str] = { + } - if _params.get('until') is not None: # noqa: E501 - _query_params.append(('until', _params['until'])) + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if var_from is not None: + + _query_params.append(('from', var_from)) + + if until is not None: + + _query_params.append(('until', until)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/devices/{id}/bandwidth', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/devices/{id}/bandwidth', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_ip_assignment_customdata(self, instance_id : Annotated[StrictStr, Field(..., description="Instance UUID")], id : Annotated[StrictStr, Field(..., description="Ip Assignment UUID")], **kwargs) -> None: # noqa: E501 - """Retrieve the custom metadata of an IP Assignment # noqa: E501 - Provides the custom metadata stored for this IP Assignment in json format # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_ip_assignment_customdata( + self, + instance_id: Annotated[StrictStr, Field(description="Instance UUID")], + id: Annotated[StrictStr, Field(description="Ip Assignment UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Retrieve the custom metadata of an IP Assignment - >>> thread = api.find_ip_assignment_customdata(instance_id, id, async_req=True) - >>> result = thread.get() + Provides the custom metadata stored for this IP Assignment in json format :param instance_id: Instance UUID (required) :type instance_id: str :param id: Ip Assignment UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_ip_assignment_customdata_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_ip_assignment_customdata_with_http_info(instance_id, id, **kwargs) # noqa: E501 + """ # noqa: E501 + + _param = self._find_ip_assignment_customdata_serialize( + instance_id=instance_id, + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - @validate_arguments - def find_ip_assignment_customdata_with_http_info(self, instance_id : Annotated[StrictStr, Field(..., description="Instance UUID")], id : Annotated[StrictStr, Field(..., description="Ip Assignment UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve the custom metadata of an IP Assignment # noqa: E501 + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_ip_assignment_customdata_with_http_info( + self, + instance_id: Annotated[StrictStr, Field(description="Instance UUID")], + id: Annotated[StrictStr, Field(description="Ip Assignment UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Retrieve the custom metadata of an IP Assignment - Provides the custom metadata stored for this IP Assignment in json format # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + Provides the custom metadata stored for this IP Assignment in json format + + :param instance_id: Instance UUID (required) + :type instance_id: str + :param id: Ip Assignment UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_ip_assignment_customdata_serialize( + instance_id=instance_id, + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - >>> thread = api.find_ip_assignment_customdata_with_http_info(instance_id, id, async_req=True) - >>> result = thread.get() + + @validate_call + def find_ip_assignment_customdata_without_preload_content( + self, + instance_id: Annotated[StrictStr, Field(description="Instance UUID")], + id: Annotated[StrictStr, Field(description="Ip Assignment UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve the custom metadata of an IP Assignment + + Provides the custom metadata stored for this IP Assignment in json format :param instance_id: Instance UUID (required) :type instance_id: str :param id: Ip Assignment UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 + + _param = self._find_ip_assignment_customdata_serialize( + instance_id=instance_id, + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _all_params = [ - 'instance_id', - 'id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_ip_assignment_customdata" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + def _find_ip_assignment_customdata_serialize( + self, + instance_id, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the path parameters - _path_params = {} - if _params['instance_id']: - _path_params['instance_id'] = _params['instance_id'] + _host = None - if _params['id']: - _path_params['id'] = _params['id'] + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if instance_id is not None: + _path_params['instance_id'] = instance_id + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/devices/{instance_id}/ips/{id}/customdata', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/devices/{instance_id}/ips/{id}/customdata', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_ip_assignments(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> IPAssignmentList: # noqa: E501 - """Retrieve all ip assignments # noqa: E501 - Returns all ip assignments for a device. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_ip_assignments( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> IPAssignmentList: + """Retrieve all ip assignments - >>> thread = api.find_ip_assignments(id, include, exclude, async_req=True) - >>> result = thread.get() + Returns all ip assignments for a device. :param id: Device UUID (required) :type id: str @@ -1770,32 +3292,76 @@ def find_ip_assignments(self, id : Annotated[StrictStr, Field(..., description=" :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: IPAssignmentList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_ip_assignments_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_ip_assignments_with_http_info(id, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def find_ip_assignments_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve all ip assignments # noqa: E501 + """ # noqa: E501 + + _param = self._find_ip_assignments_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Returns all ip assignments for a device. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "IPAssignmentList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_ip_assignments_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[IPAssignmentList]: + """Retrieve all ip assignments - >>> thread = api.find_ip_assignments_with_http_info(id, include, exclude, async_req=True) - >>> result = thread.get() + Returns all ip assignments for a device. :param id: Device UUID (required) :type id: str @@ -1803,117 +3369,200 @@ def find_ip_assignments_with_http_info(self, id : Annotated[StrictStr, Field(... :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(IPAssignmentList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_ip_assignments_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "IPAssignmentList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_ip_assignments" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + @validate_call + def find_ip_assignments_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all ip assignments + + Returns all ip assignments for a device. - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + :param id: Device UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_ip_assignments_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + _response_types_map: Dict[str, Optional[str]] = { + '200': "IPAssignmentList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + def _find_ip_assignments_serialize( + self, + id, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "IPAssignmentList", - '401': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/devices/{id}/ips', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/devices/{id}/ips', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_organization_devices_all_pages(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], search : Annotated[Optional[StrictStr], Field(description="Search by hostname, description, short_id, reservation short_id, tags, plan name, plan slug, facility code, facility name, operating system name, operating system slug, IP addresses.")] = None, categories : Annotated[Optional[conlist(StrictStr)], Field(description="Filter by plan category")] = None, facility : Annotated[Optional[StrictStr], Field(description="Filter by device facility")] = None, hostname : Annotated[Optional[StrictStr], Field(description="Filter by partial hostname")] = None, reserved : Annotated[Optional[StrictBool], Field(description="Filter only reserved instances. When set to true, only include reserved instances. When set to false, only include on-demand instances.")] = None, tag : Annotated[Optional[StrictStr], Field(description="Filter by device tag")] = None, type : Annotated[Optional[StrictStr], Field(description="Filter by instance type (ondemand,spot,reserved)")] = None, has_termination_time : Annotated[Optional[StrictBool], Field(description="Filter only instances marked for termination. When set to true, only include instances that have a termination time. When set to false, only include instances that do not have a termination time.")] = None, mac_address : Annotated[Optional[StrictStr], Field(description="Filter by MAC address")] = None, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> DeviceList: # noqa: E501 + + @validate_call + def find_organization_devices_all_pages(self, id : Annotated[StrictStr, Field(description="Organization UUID")], search : Annotated[Optional[StrictStr], Field(description="Search by hostname, description, short_id, reservation short_id, tags, plan name, plan slug, facility code, facility name, operating system name, operating system slug, IP addresses.")] = None, categories : Annotated[Optional[List[StrictStr]], Field(description="Filter by plan category")] = None, facility : Annotated[Optional[StrictStr], Field(description="Filter by device facility")] = None, hostname : Annotated[Optional[StrictStr], Field(description="Filter by partial hostname")] = None, reserved : Annotated[Optional[StrictBool], Field(description="Filter only reserved instances. When set to true, only include reserved instances. When set to false, only include on-demand instances.")] = None, tag : Annotated[Optional[StrictStr], Field(description="Filter by device tag")] = None, type : Annotated[Optional[StrictStr], Field(description="Filter by instance type (ondemand,spot,reserved)")] = None, has_termination_time : Annotated[Optional[StrictBool], Field(description="Filter only instances marked for termination. When set to true, only include instances that have a termination time. When set to false, only include instances that do not have a termination time.")] = None, mac_address : Annotated[Optional[StrictStr], Field(description="Filter by MAC address")] = None, include : Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, per_page : Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, **kwargs) -> DeviceList: # noqa: E501 """Retrieve all devices of an organization # noqa: E501 This method is the same as find_organization_devices, but fetches resources from all the pages. @@ -1991,19 +3640,164 @@ def find_organization_devices_all_pages(self, id : Annotated[StrictStr, Field(.. if page_response.meta.next is None: break page += 1 - + return all_pages - @validate_arguments - def find_organization_devices(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], search : Annotated[Optional[StrictStr], Field(description="Search by hostname, description, short_id, reservation short_id, tags, plan name, plan slug, facility code, facility name, operating system name, operating system slug, IP addresses.")] = None, categories : Annotated[Optional[conlist(StrictStr)], Field(description="Filter by plan category")] = None, facility : Annotated[Optional[StrictStr], Field(description="Filter by device facility")] = None, hostname : Annotated[Optional[StrictStr], Field(description="Filter by partial hostname")] = None, reserved : Annotated[Optional[StrictBool], Field(description="Filter only reserved instances. When set to true, only include reserved instances. When set to false, only include on-demand instances.")] = None, tag : Annotated[Optional[StrictStr], Field(description="Filter by device tag")] = None, type : Annotated[Optional[StrictStr], Field(description="Filter by instance type (ondemand,spot,reserved)")] = None, has_termination_time : Annotated[Optional[StrictBool], Field(description="Filter only instances marked for termination. When set to true, only include instances that have a termination time. When set to false, only include instances that do not have a termination time.")] = None, mac_address : Annotated[Optional[StrictStr], Field(description="Filter by MAC address")] = None, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> DeviceList: # noqa: E501 - """Retrieve all devices of an organization # noqa: E501 + @validate_call + def find_organization_devices( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + search: Annotated[Optional[StrictStr], Field(description="Search by hostname, description, short_id, reservation short_id, tags, plan name, plan slug, facility code, facility name, operating system name, operating system slug, IP addresses.")] = None, + categories: Annotated[Optional[List[StrictStr]], Field(description="Filter by plan category")] = None, + facility: Annotated[Optional[StrictStr], Field(description="Filter by device facility")] = None, + hostname: Annotated[Optional[StrictStr], Field(description="Filter by partial hostname")] = None, + reserved: Annotated[Optional[StrictBool], Field(description="Filter only reserved instances. When set to true, only include reserved instances. When set to false, only include on-demand instances.")] = None, + tag: Annotated[Optional[StrictStr], Field(description="Filter by device tag")] = None, + type: Annotated[Optional[StrictStr], Field(description="Filter by instance type (ondemand,spot,reserved)")] = None, + has_termination_time: Annotated[Optional[StrictBool], Field(description="Filter only instances marked for termination. When set to true, only include instances that have a termination time. When set to false, only include instances that do not have a termination time.")] = None, + mac_address: Annotated[Optional[StrictStr], Field(description="Filter by MAC address")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DeviceList: + """Retrieve all devices of an organization + + Provides a collection of devices for a given organization. + + :param id: Organization UUID (required) + :type id: str + :param search: Search by hostname, description, short_id, reservation short_id, tags, plan name, plan slug, facility code, facility name, operating system name, operating system slug, IP addresses. + :type search: str + :param categories: Filter by plan category + :type categories: List[str] + :param facility: Filter by device facility + :type facility: str + :param hostname: Filter by partial hostname + :type hostname: str + :param reserved: Filter only reserved instances. When set to true, only include reserved instances. When set to false, only include on-demand instances. + :type reserved: bool + :param tag: Filter by device tag + :type tag: str + :param type: Filter by instance type (ondemand,spot,reserved) + :type type: str + :param has_termination_time: Filter only instances marked for termination. When set to true, only include instances that have a termination time. When set to false, only include instances that do not have a termination time. + :type has_termination_time: bool + :param mac_address: Filter by MAC address + :type mac_address: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param page: Page to return + :type page: int + :param per_page: Items returned per page + :type per_page: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_organization_devices_serialize( + id=id, + search=search, + categories=categories, + facility=facility, + hostname=hostname, + reserved=reserved, + tag=tag, + type=type, + has_termination_time=has_termination_time, + mac_address=mac_address, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Provides a collection of devices for a given organization. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "DeviceList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_organization_devices_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + search: Annotated[Optional[StrictStr], Field(description="Search by hostname, description, short_id, reservation short_id, tags, plan name, plan slug, facility code, facility name, operating system name, operating system slug, IP addresses.")] = None, + categories: Annotated[Optional[List[StrictStr]], Field(description="Filter by plan category")] = None, + facility: Annotated[Optional[StrictStr], Field(description="Filter by device facility")] = None, + hostname: Annotated[Optional[StrictStr], Field(description="Filter by partial hostname")] = None, + reserved: Annotated[Optional[StrictBool], Field(description="Filter only reserved instances. When set to true, only include reserved instances. When set to false, only include on-demand instances.")] = None, + tag: Annotated[Optional[StrictStr], Field(description="Filter by device tag")] = None, + type: Annotated[Optional[StrictStr], Field(description="Filter by instance type (ondemand,spot,reserved)")] = None, + has_termination_time: Annotated[Optional[StrictBool], Field(description="Filter only instances marked for termination. When set to true, only include instances that have a termination time. When set to false, only include instances that do not have a termination time.")] = None, + mac_address: Annotated[Optional[StrictStr], Field(description="Filter by MAC address")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DeviceList]: + """Retrieve all devices of an organization - >>> thread = api.find_organization_devices(id, search, categories, facility, hostname, reserved, tag, type, has_termination_time, mac_address, include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + Provides a collection of devices for a given organization. :param id: Organization UUID (required) :type id: str @@ -2033,32 +3827,99 @@ def find_organization_devices(self, id : Annotated[StrictStr, Field(..., descrip :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: DeviceList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_organization_devices_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_organization_devices_with_http_info(id, search, categories, facility, hostname, reserved, tag, type, has_termination_time, mac_address, include, exclude, page, per_page, **kwargs) # noqa: E501 + """ # noqa: E501 + + _param = self._find_organization_devices_serialize( + id=id, + search=search, + categories=categories, + facility=facility, + hostname=hostname, + reserved=reserved, + tag=tag, + type=type, + has_termination_time=has_termination_time, + mac_address=mac_address, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - @validate_arguments - def find_organization_devices_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], search : Annotated[Optional[StrictStr], Field(description="Search by hostname, description, short_id, reservation short_id, tags, plan name, plan slug, facility code, facility name, operating system name, operating system slug, IP addresses.")] = None, categories : Annotated[Optional[conlist(StrictStr)], Field(description="Filter by plan category")] = None, facility : Annotated[Optional[StrictStr], Field(description="Filter by device facility")] = None, hostname : Annotated[Optional[StrictStr], Field(description="Filter by partial hostname")] = None, reserved : Annotated[Optional[StrictBool], Field(description="Filter only reserved instances. When set to true, only include reserved instances. When set to false, only include on-demand instances.")] = None, tag : Annotated[Optional[StrictStr], Field(description="Filter by device tag")] = None, type : Annotated[Optional[StrictStr], Field(description="Filter by instance type (ondemand,spot,reserved)")] = None, has_termination_time : Annotated[Optional[StrictBool], Field(description="Filter only instances marked for termination. When set to true, only include instances that have a termination time. When set to false, only include instances that do not have a termination time.")] = None, mac_address : Annotated[Optional[StrictStr], Field(description="Filter by MAC address")] = None, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve all devices of an organization # noqa: E501 + _response_types_map: Dict[str, Optional[str]] = { + '200': "DeviceList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - Provides a collection of devices for a given organization. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.find_organization_devices_with_http_info(id, search, categories, facility, hostname, reserved, tag, type, has_termination_time, mac_address, include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + @validate_call + def find_organization_devices_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + search: Annotated[Optional[StrictStr], Field(description="Search by hostname, description, short_id, reservation short_id, tags, plan name, plan slug, facility code, facility name, operating system name, operating system slug, IP addresses.")] = None, + categories: Annotated[Optional[List[StrictStr]], Field(description="Filter by plan category")] = None, + facility: Annotated[Optional[StrictStr], Field(description="Filter by device facility")] = None, + hostname: Annotated[Optional[StrictStr], Field(description="Filter by partial hostname")] = None, + reserved: Annotated[Optional[StrictBool], Field(description="Filter only reserved instances. When set to true, only include reserved instances. When set to false, only include on-demand instances.")] = None, + tag: Annotated[Optional[StrictStr], Field(description="Filter by device tag")] = None, + type: Annotated[Optional[StrictStr], Field(description="Filter by instance type (ondemand,spot,reserved)")] = None, + has_termination_time: Annotated[Optional[StrictBool], Field(description="Filter only instances marked for termination. When set to true, only include instances that have a termination time. When set to false, only include instances that do not have a termination time.")] = None, + mac_address: Annotated[Optional[StrictStr], Field(description="Filter by MAC address")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all devices of an organization + + Provides a collection of devices for a given organization. :param id: Organization UUID (required) :type id: str @@ -2088,163 +3949,191 @@ def find_organization_devices_with_http_info(self, id : Annotated[StrictStr, Fie :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(DeviceList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_organization_devices_serialize( + id=id, + search=search, + categories=categories, + facility=facility, + hostname=hostname, + reserved=reserved, + tag=tag, + type=type, + has_termination_time=has_termination_time, + mac_address=mac_address, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() - - _all_params = [ - 'id', - 'search', - 'categories', - 'facility', - 'hostname', - 'reserved', - 'tag', - 'type', - 'has_termination_time', - 'mac_address', - 'include', - 'exclude', - 'page', - 'per_page' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_organization_devices" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "DeviceList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _find_organization_devices_serialize( + self, + id, + search, + categories, + facility, + hostname, + reserved, + tag, + type, + has_termination_time, + mac_address, + include, + exclude, + page, + per_page, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'categories': 'multi', + 'include': 'csv', + 'exclude': 'csv', + } - _collection_formats = {} + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] - - + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] - if _params.get('search') is not None: # noqa: E501 - _query_params.append(('search', _params['search'])) - - if _params.get('categories') is not None: # noqa: E501 - _query_params.append(('categories', _params['categories'])) - _collection_formats['categories'] = 'multi' - - if _params.get('facility') is not None: # noqa: E501 - _query_params.append(('facility', _params['facility'])) - - if _params.get('hostname') is not None: # noqa: E501 - _query_params.append(('hostname', _params['hostname'])) - - if _params.get('reserved') is not None: # noqa: E501 - _query_params.append(('reserved', _params['reserved'])) - - if _params.get('tag') is not None: # noqa: E501 - _query_params.append(('tag', _params['tag'])) - - if _params.get('type') is not None: # noqa: E501 - _query_params.append(('type', _params['type'])) - - if _params.get('has_termination_time') is not None: # noqa: E501 - _query_params.append(('has_termination_time', _params['has_termination_time'])) - - if _params.get('mac_address') is not None: # noqa: E501 - _query_params.append(('mac_address', _params['mac_address'])) - - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' - - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' - - if _params.get('page') is not None: # noqa: E501 - _query_params.append(('page', _params['page'])) - - if _params.get('per_page') is not None: # noqa: E501 - _query_params.append(('per_page', _params['per_page'])) - + if search is not None: + + _query_params.append(('search', search)) + + if categories is not None: + + _query_params.append(('categories', categories)) + + if facility is not None: + + _query_params.append(('facility', facility)) + + if hostname is not None: + + _query_params.append(('hostname', hostname)) + + if reserved is not None: + + _query_params.append(('reserved', reserved)) + + if tag is not None: + + _query_params.append(('tag', tag)) + + if type is not None: + + _query_params.append(('type', type)) + + if has_termination_time is not None: + + _query_params.append(('has_termination_time', has_termination_time)) + + if mac_address is not None: + + _query_params.append(('mac_address', mac_address)) + + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + + if page is not None: + + _query_params.append(('page', page)) + + if per_page is not None: + + _query_params.append(('per_page', per_page)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "DeviceList", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/organizations/{id}/devices', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/organizations/{id}/devices', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + - @validate_arguments - def find_project_devices_all_pages(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], search : Annotated[Optional[StrictStr], Field(description="Search by hostname, description, short_id, reservation short_id, tags, plan name, plan slug, facility code, facility name, operating system name, operating system slug, IP addresses.")] = None, categories : Annotated[Optional[conlist(StrictStr)], Field(description="Filter by plan category")] = None, facility : Annotated[Optional[StrictStr], Field(description="Filter by device facility")] = None, metro : Annotated[Optional[StrictStr], Field(description="Filter by device metro")] = None, hostname : Annotated[Optional[StrictStr], Field(description="Filter by partial hostname")] = None, reserved : Annotated[Optional[StrictBool], Field(description="Filter only reserved instances. When set to true, only include reserved instances. When set to false, only include on-demand instances.")] = None, tag : Annotated[Optional[StrictStr], Field(description="Filter by device tag")] = None, type : Annotated[Optional[StrictStr], Field(description="Filter by instance type (ondemand,spot,reserved)")] = None, has_termination_time : Annotated[Optional[StrictBool], Field(description="Filter only instances marked for termination. When set to true, only include instances that have a termination time. When set to false, only include instances that do not have a termination time.")] = None, mac_address : Annotated[Optional[StrictStr], Field(description="Filter by MAC address")] = None, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> DeviceList: # noqa: E501 + @validate_call + def find_project_devices_all_pages(self, id : Annotated[StrictStr, Field(description="Project UUID")], search : Annotated[Optional[StrictStr], Field(description="Search by hostname, description, short_id, reservation short_id, tags, plan name, plan slug, facility code, facility name, operating system name, operating system slug, IP addresses.")] = None, categories : Annotated[Optional[List[StrictStr]], Field(description="Filter by plan category")] = None, facility : Annotated[Optional[StrictStr], Field(description="Filter by device facility")] = None, metro : Annotated[Optional[StrictStr], Field(description="Filter by device metro")] = None, hostname : Annotated[Optional[StrictStr], Field(description="Filter by partial hostname")] = None, reserved : Annotated[Optional[StrictBool], Field(description="Filter only reserved instances. When set to true, only include reserved instances. When set to false, only include on-demand instances.")] = None, tag : Annotated[Optional[StrictStr], Field(description="Filter by device tag")] = None, type : Annotated[Optional[StrictStr], Field(description="Filter by instance type (ondemand,spot,reserved)")] = None, has_termination_time : Annotated[Optional[StrictBool], Field(description="Filter only instances marked for termination. When set to true, only include instances that have a termination time. When set to false, only include instances that do not have a termination time.")] = None, mac_address : Annotated[Optional[StrictStr], Field(description="Filter by MAC address")] = None, include : Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, per_page : Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, **kwargs) -> DeviceList: # noqa: E501 """Retrieve all devices of a project # noqa: E501 This method is the same as find_project_devices, but fetches resources from all the pages. @@ -2325,19 +4214,43 @@ def find_project_devices_all_pages(self, id : Annotated[StrictStr, Field(..., de if page_response.meta.next is None: break page += 1 - - return all_pages - @validate_arguments - def find_project_devices(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], search : Annotated[Optional[StrictStr], Field(description="Search by hostname, description, short_id, reservation short_id, tags, plan name, plan slug, facility code, facility name, operating system name, operating system slug, IP addresses.")] = None, categories : Annotated[Optional[conlist(StrictStr)], Field(description="Filter by plan category")] = None, facility : Annotated[Optional[StrictStr], Field(description="Filter by device facility")] = None, metro : Annotated[Optional[StrictStr], Field(description="Filter by device metro")] = None, hostname : Annotated[Optional[StrictStr], Field(description="Filter by partial hostname")] = None, reserved : Annotated[Optional[StrictBool], Field(description="Filter only reserved instances. When set to true, only include reserved instances. When set to false, only include on-demand instances.")] = None, tag : Annotated[Optional[StrictStr], Field(description="Filter by device tag")] = None, type : Annotated[Optional[StrictStr], Field(description="Filter by instance type (ondemand,spot,reserved)")] = None, has_termination_time : Annotated[Optional[StrictBool], Field(description="Filter only instances marked for termination. When set to true, only include instances that have a termination time. When set to false, only include instances that do not have a termination time.")] = None, mac_address : Annotated[Optional[StrictStr], Field(description="Filter by MAC address")] = None, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> DeviceList: # noqa: E501 - """Retrieve all devices of a project # noqa: E501 + return all_pages - Provides a collection of devices for a given project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_project_devices( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + search: Annotated[Optional[StrictStr], Field(description="Search by hostname, description, short_id, reservation short_id, tags, plan name, plan slug, facility code, facility name, operating system name, operating system slug, IP addresses.")] = None, + categories: Annotated[Optional[List[StrictStr]], Field(description="Filter by plan category")] = None, + facility: Annotated[Optional[StrictStr], Field(description="Filter by device facility")] = None, + metro: Annotated[Optional[StrictStr], Field(description="Filter by device metro")] = None, + hostname: Annotated[Optional[StrictStr], Field(description="Filter by partial hostname")] = None, + reserved: Annotated[Optional[StrictBool], Field(description="Filter only reserved instances. When set to true, only include reserved instances. When set to false, only include on-demand instances.")] = None, + tag: Annotated[Optional[StrictStr], Field(description="Filter by device tag")] = None, + type: Annotated[Optional[StrictStr], Field(description="Filter by instance type (ondemand,spot,reserved)")] = None, + has_termination_time: Annotated[Optional[StrictBool], Field(description="Filter only instances marked for termination. When set to true, only include instances that have a termination time. When set to false, only include instances that do not have a termination time.")] = None, + mac_address: Annotated[Optional[StrictStr], Field(description="Filter by MAC address")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DeviceList: + """Retrieve all devices of a project - >>> thread = api.find_project_devices(id, search, categories, facility, metro, hostname, reserved, tag, type, has_termination_time, mac_address, include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + Provides a collection of devices for a given project. :param id: Project UUID (required) :type id: str @@ -2369,32 +4282,101 @@ def find_project_devices(self, id : Annotated[StrictStr, Field(..., description= :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: DeviceList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_project_devices_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_project_devices_with_http_info(id, search, categories, facility, metro, hostname, reserved, tag, type, has_termination_time, mac_address, include, exclude, page, per_page, **kwargs) # noqa: E501 - - @validate_arguments - def find_project_devices_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], search : Annotated[Optional[StrictStr], Field(description="Search by hostname, description, short_id, reservation short_id, tags, plan name, plan slug, facility code, facility name, operating system name, operating system slug, IP addresses.")] = None, categories : Annotated[Optional[conlist(StrictStr)], Field(description="Filter by plan category")] = None, facility : Annotated[Optional[StrictStr], Field(description="Filter by device facility")] = None, metro : Annotated[Optional[StrictStr], Field(description="Filter by device metro")] = None, hostname : Annotated[Optional[StrictStr], Field(description="Filter by partial hostname")] = None, reserved : Annotated[Optional[StrictBool], Field(description="Filter only reserved instances. When set to true, only include reserved instances. When set to false, only include on-demand instances.")] = None, tag : Annotated[Optional[StrictStr], Field(description="Filter by device tag")] = None, type : Annotated[Optional[StrictStr], Field(description="Filter by instance type (ondemand,spot,reserved)")] = None, has_termination_time : Annotated[Optional[StrictBool], Field(description="Filter only instances marked for termination. When set to true, only include instances that have a termination time. When set to false, only include instances that do not have a termination time.")] = None, mac_address : Annotated[Optional[StrictStr], Field(description="Filter by MAC address")] = None, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve all devices of a project # noqa: E501 + """ # noqa: E501 + + _param = self._find_project_devices_serialize( + id=id, + search=search, + categories=categories, + facility=facility, + metro=metro, + hostname=hostname, + reserved=reserved, + tag=tag, + type=type, + has_termination_time=has_termination_time, + mac_address=mac_address, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Provides a collection of devices for a given project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "DeviceList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_project_devices_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + search: Annotated[Optional[StrictStr], Field(description="Search by hostname, description, short_id, reservation short_id, tags, plan name, plan slug, facility code, facility name, operating system name, operating system slug, IP addresses.")] = None, + categories: Annotated[Optional[List[StrictStr]], Field(description="Filter by plan category")] = None, + facility: Annotated[Optional[StrictStr], Field(description="Filter by device facility")] = None, + metro: Annotated[Optional[StrictStr], Field(description="Filter by device metro")] = None, + hostname: Annotated[Optional[StrictStr], Field(description="Filter by partial hostname")] = None, + reserved: Annotated[Optional[StrictBool], Field(description="Filter only reserved instances. When set to true, only include reserved instances. When set to false, only include on-demand instances.")] = None, + tag: Annotated[Optional[StrictStr], Field(description="Filter by device tag")] = None, + type: Annotated[Optional[StrictStr], Field(description="Filter by instance type (ondemand,spot,reserved)")] = None, + has_termination_time: Annotated[Optional[StrictBool], Field(description="Filter only instances marked for termination. When set to true, only include instances that have a termination time. When set to false, only include instances that do not have a termination time.")] = None, + mac_address: Annotated[Optional[StrictStr], Field(description="Filter by MAC address")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DeviceList]: + """Retrieve all devices of a project - >>> thread = api.find_project_devices_with_http_info(id, search, categories, facility, metro, hostname, reserved, tag, type, has_termination_time, mac_address, include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + Provides a collection of devices for a given project. :param id: Project UUID (required) :type id: str @@ -2426,175 +4408,345 @@ def find_project_devices_with_http_info(self, id : Annotated[StrictStr, Field(.. :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(DeviceList, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'id', - 'search', - 'categories', - 'facility', - 'metro', - 'hostname', - 'reserved', - 'tag', - 'type', - 'has_termination_time', - 'mac_address', - 'include', - 'exclude', - 'page', - 'per_page' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_project_devices" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] - - - # process the query parameters - _query_params = [] - if _params.get('search') is not None: # noqa: E501 - _query_params.append(('search', _params['search'])) - - if _params.get('categories') is not None: # noqa: E501 - _query_params.append(('categories', _params['categories'])) - _collection_formats['categories'] = 'multi' - - if _params.get('facility') is not None: # noqa: E501 - _query_params.append(('facility', _params['facility'])) - - if _params.get('metro') is not None: # noqa: E501 - _query_params.append(('metro', _params['metro'])) - - if _params.get('hostname') is not None: # noqa: E501 - _query_params.append(('hostname', _params['hostname'])) - - if _params.get('reserved') is not None: # noqa: E501 - _query_params.append(('reserved', _params['reserved'])) - - if _params.get('tag') is not None: # noqa: E501 - _query_params.append(('tag', _params['tag'])) + """ # noqa: E501 + + _param = self._find_project_devices_serialize( + id=id, + search=search, + categories=categories, + facility=facility, + metro=metro, + hostname=hostname, + reserved=reserved, + tag=tag, + type=type, + has_termination_time=has_termination_time, + mac_address=mac_address, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - if _params.get('type') is not None: # noqa: E501 - _query_params.append(('type', _params['type'])) + _response_types_map: Dict[str, Optional[str]] = { + '200': "DeviceList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - if _params.get('has_termination_time') is not None: # noqa: E501 - _query_params.append(('has_termination_time', _params['has_termination_time'])) - if _params.get('mac_address') is not None: # noqa: E501 - _query_params.append(('mac_address', _params['mac_address'])) + @validate_call + def find_project_devices_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + search: Annotated[Optional[StrictStr], Field(description="Search by hostname, description, short_id, reservation short_id, tags, plan name, plan slug, facility code, facility name, operating system name, operating system slug, IP addresses.")] = None, + categories: Annotated[Optional[List[StrictStr]], Field(description="Filter by plan category")] = None, + facility: Annotated[Optional[StrictStr], Field(description="Filter by device facility")] = None, + metro: Annotated[Optional[StrictStr], Field(description="Filter by device metro")] = None, + hostname: Annotated[Optional[StrictStr], Field(description="Filter by partial hostname")] = None, + reserved: Annotated[Optional[StrictBool], Field(description="Filter only reserved instances. When set to true, only include reserved instances. When set to false, only include on-demand instances.")] = None, + tag: Annotated[Optional[StrictStr], Field(description="Filter by device tag")] = None, + type: Annotated[Optional[StrictStr], Field(description="Filter by instance type (ondemand,spot,reserved)")] = None, + has_termination_time: Annotated[Optional[StrictBool], Field(description="Filter only instances marked for termination. When set to true, only include instances that have a termination time. When set to false, only include instances that do not have a termination time.")] = None, + mac_address: Annotated[Optional[StrictStr], Field(description="Filter by MAC address")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all devices of a project - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + Provides a collection of devices for a given project. - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + :param id: Project UUID (required) + :type id: str + :param search: Search by hostname, description, short_id, reservation short_id, tags, plan name, plan slug, facility code, facility name, operating system name, operating system slug, IP addresses. + :type search: str + :param categories: Filter by plan category + :type categories: List[str] + :param facility: Filter by device facility + :type facility: str + :param metro: Filter by device metro + :type metro: str + :param hostname: Filter by partial hostname + :type hostname: str + :param reserved: Filter only reserved instances. When set to true, only include reserved instances. When set to false, only include on-demand instances. + :type reserved: bool + :param tag: Filter by device tag + :type tag: str + :param type: Filter by instance type (ondemand,spot,reserved) + :type type: str + :param has_termination_time: Filter only instances marked for termination. When set to true, only include instances that have a termination time. When set to false, only include instances that do not have a termination time. + :type has_termination_time: bool + :param mac_address: Filter by MAC address + :type mac_address: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param page: Page to return + :type page: int + :param per_page: Items returned per page + :type per_page: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_project_devices_serialize( + id=id, + search=search, + categories=categories, + facility=facility, + metro=metro, + hostname=hostname, + reserved=reserved, + tag=tag, + type=type, + has_termination_time=has_termination_time, + mac_address=mac_address, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - if _params.get('page') is not None: # noqa: E501 - _query_params.append(('page', _params['page'])) + _response_types_map: Dict[str, Optional[str]] = { + '200': "DeviceList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _find_project_devices_serialize( + self, + id, + search, + categories, + facility, + metro, + hostname, + reserved, + tag, + type, + has_termination_time, + mac_address, + include, + exclude, + page, + per_page, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'categories': 'multi', + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('per_page') is not None: # noqa: E501 - _query_params.append(('per_page', _params['per_page'])) + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if search is not None: + + _query_params.append(('search', search)) + + if categories is not None: + + _query_params.append(('categories', categories)) + + if facility is not None: + + _query_params.append(('facility', facility)) + + if metro is not None: + + _query_params.append(('metro', metro)) + + if hostname is not None: + + _query_params.append(('hostname', hostname)) + + if reserved is not None: + + _query_params.append(('reserved', reserved)) + + if tag is not None: + + _query_params.append(('tag', tag)) + + if type is not None: + + _query_params.append(('type', type)) + + if has_termination_time is not None: + + _query_params.append(('has_termination_time', has_termination_time)) + + if mac_address is not None: + + _query_params.append(('mac_address', mac_address)) + + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + + if page is not None: + + _query_params.append(('page', page)) + + if per_page is not None: + + _query_params.append(('per_page', per_page)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "DeviceList", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{id}/devices', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/projects/{id}/devices', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_traffic(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], direction : Annotated[StrictStr, Field(..., description="Traffic direction")], interval : Annotated[Optional[StrictStr], Field(description="Traffic interval")] = None, bucket : Annotated[Optional[StrictStr], Field(description="Traffic bucket")] = None, timeframe : Optional[FindTrafficTimeframeParameter] = None, **kwargs) -> None: # noqa: E501 - """Retrieve device traffic # noqa: E501 - Returns traffic for a specific device. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_traffic( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + direction: Annotated[StrictStr, Field(description="Traffic direction")], + interval: Annotated[Optional[StrictStr], Field(description="Traffic interval")] = None, + bucket: Annotated[Optional[StrictStr], Field(description="Traffic bucket")] = None, + timeframe: Optional[FindTrafficTimeframeParameter] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Retrieve device traffic - >>> thread = api.find_traffic(id, direction, interval, bucket, timeframe, async_req=True) - >>> result = thread.get() + Returns traffic for a specific device. :param id: Device UUID (required) :type id: str @@ -2606,32 +4758,81 @@ def find_traffic(self, id : Annotated[StrictStr, Field(..., description="Device :type bucket: str :param timeframe: :type timeframe: FindTrafficTimeframeParameter - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_traffic_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_traffic_with_http_info(id, direction, interval, bucket, timeframe, **kwargs) # noqa: E501 - - @validate_arguments - def find_traffic_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], direction : Annotated[StrictStr, Field(..., description="Traffic direction")], interval : Annotated[Optional[StrictStr], Field(description="Traffic interval")] = None, bucket : Annotated[Optional[StrictStr], Field(description="Traffic bucket")] = None, timeframe : Optional[FindTrafficTimeframeParameter] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve device traffic # noqa: E501 + """ # noqa: E501 + + _param = self._find_traffic_serialize( + id=id, + direction=direction, + interval=interval, + bucket=bucket, + timeframe=timeframe, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Returns traffic for a specific device. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_traffic_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + direction: Annotated[StrictStr, Field(description="Traffic direction")], + interval: Annotated[Optional[StrictStr], Field(description="Traffic interval")] = None, + bucket: Annotated[Optional[StrictStr], Field(description="Traffic bucket")] = None, + timeframe: Optional[FindTrafficTimeframeParameter] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Retrieve device traffic - >>> thread = api.find_traffic_with_http_info(id, direction, interval, bucket, timeframe, async_req=True) - >>> result = thread.get() + Returns traffic for a specific device. :param id: Device UUID (required) :type id: str @@ -2643,714 +4844,1347 @@ def find_traffic_with_http_info(self, id : Annotated[StrictStr, Field(..., descr :type bucket: str :param timeframe: :type timeframe: FindTrafficTimeframeParameter - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 + + _param = self._find_traffic_serialize( + id=id, + direction=direction, + interval=interval, + bucket=bucket, + timeframe=timeframe, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id', - 'direction', - 'interval', - 'bucket', - 'timeframe' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_traffic" % _key - ) - _params[_key] = _val - del _params['kwargs'] + @validate_call + def find_traffic_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + direction: Annotated[StrictStr, Field(description="Traffic direction")], + interval: Annotated[Optional[StrictStr], Field(description="Traffic interval")] = None, + bucket: Annotated[Optional[StrictStr], Field(description="Traffic bucket")] = None, + timeframe: Optional[FindTrafficTimeframeParameter] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve device traffic - _collection_formats = {} + Returns traffic for a specific device. - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + :param id: Device UUID (required) + :type id: str + :param direction: Traffic direction (required) + :type direction: str + :param interval: Traffic interval + :type interval: str + :param bucket: Traffic bucket + :type bucket: str + :param timeframe: + :type timeframe: FindTrafficTimeframeParameter + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_traffic_serialize( + id=id, + direction=direction, + interval=interval, + bucket=bucket, + timeframe=timeframe, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - # process the query parameters - _query_params = [] - if _params.get('direction') is not None: # noqa: E501 - _query_params.append(('direction', _params['direction'])) + def _find_traffic_serialize( + self, + id, + direction, + interval, + bucket, + timeframe, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - if _params.get('interval') is not None: # noqa: E501 - _query_params.append(('interval', _params['interval'])) + _host = None - if _params.get('bucket') is not None: # noqa: E501 - _query_params.append(('bucket', _params['bucket'])) + _collection_formats: Dict[str, str] = { + } - if _params.get('timeframe') is not None: # noqa: E501 - _query_params.append(('timeframe', _params['timeframe'])) + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if direction is not None: + + _query_params.append(('direction', direction)) + + if interval is not None: + + _query_params.append(('interval', interval)) + + if bucket is not None: + + _query_params.append(('bucket', bucket)) + + if timeframe is not None: + + _query_params.append(('timeframe', timeframe)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/devices/{id}/traffic', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/devices/{id}/traffic', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def get_bgp_neighbor_data(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> BgpSessionNeighbors: # noqa: E501 - """Retrieve BGP neighbor data for this device # noqa: E501 - Provides a summary of the BGP neighbor data associated to the BGP sessions for this device. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def get_bgp_neighbor_data( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> BgpSessionNeighbors: + """Retrieve BGP neighbor data for this device - >>> thread = api.get_bgp_neighbor_data(id, include, async_req=True) - >>> result = thread.get() + Provides a summary of the BGP neighbor data associated to the BGP sessions for this device. :param id: Device UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: BgpSessionNeighbors - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the get_bgp_neighbor_data_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.get_bgp_neighbor_data_with_http_info(id, include, **kwargs) # noqa: E501 + """ # noqa: E501 + + _param = self._get_bgp_neighbor_data_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - @validate_arguments - def get_bgp_neighbor_data_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve BGP neighbor data for this device # noqa: E501 + _response_types_map: Dict[str, Optional[str]] = { + '200': "BgpSessionNeighbors", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_bgp_neighbor_data_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[BgpSessionNeighbors]: + """Retrieve BGP neighbor data for this device - Provides a summary of the BGP neighbor data associated to the BGP sessions for this device. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + Provides a summary of the BGP neighbor data associated to the BGP sessions for this device. - >>> thread = api.get_bgp_neighbor_data_with_http_info(id, include, async_req=True) - >>> result = thread.get() + :param id: Device UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_bgp_neighbor_data_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BgpSessionNeighbors", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_bgp_neighbor_data_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve BGP neighbor data for this device + + Provides a summary of the BGP neighbor data associated to the BGP sessions for this device. :param id: Device UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(BgpSessionNeighbors, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._get_bgp_neighbor_data_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BgpSessionNeighbors", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _params = locals() - _all_params = [ - 'id', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_bgp_neighbor_data" % _key - ) - _params[_key] = _val - del _params['kwargs'] + def _get_bgp_neighbor_data_serialize( + self, + id, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - _collection_formats = {} + _host = None - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' - + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "BgpSessionNeighbors", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/devices/{id}/bgp/neighbors', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/devices/{id}/bgp/neighbors', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def get_device_firmware_sets(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], **kwargs) -> FirmwareSetResponse: # noqa: E501 - """Get Device's associated Firmware Set # noqa: E501 - Returns the firmware set associated with the device. If a custom firmware set is associated with the device, then it is returned. Otherwise, if a default firmware set is available it is returned. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def get_device_firmware_sets( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> FirmwareSetResponse: + """Get Device's associated Firmware Set - >>> thread = api.get_device_firmware_sets(id, async_req=True) - >>> result = thread.get() + Returns the firmware set associated with the device. If a custom firmware set is associated with the device, then it is returned. Otherwise, if a default firmware set is available it is returned. :param id: Device UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: FirmwareSetResponse - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the get_device_firmware_sets_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.get_device_firmware_sets_with_http_info(id, **kwargs) # noqa: E501 + """ # noqa: E501 + + _param = self._get_device_firmware_sets_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - @validate_arguments - def get_device_firmware_sets_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """Get Device's associated Firmware Set # noqa: E501 + _response_types_map: Dict[str, Optional[str]] = { + '200': "FirmwareSetResponse", + '401': None, + '404': None, + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_device_firmware_sets_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[FirmwareSetResponse]: + """Get Device's associated Firmware Set - Returns the firmware set associated with the device. If a custom firmware set is associated with the device, then it is returned. Otherwise, if a default firmware set is available it is returned. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + Returns the firmware set associated with the device. If a custom firmware set is associated with the device, then it is returned. Otherwise, if a default firmware set is available it is returned. - >>> thread = api.get_device_firmware_sets_with_http_info(id, async_req=True) - >>> result = thread.get() + :param id: Device UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_device_firmware_sets_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "FirmwareSetResponse", + '401': None, + '404': None, + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_device_firmware_sets_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Device's associated Firmware Set + + Returns the firmware set associated with the device. If a custom firmware set is associated with the device, then it is returned. Otherwise, if a default firmware set is available it is returned. :param id: Device UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(FirmwareSetResponse, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._get_device_firmware_sets_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "FirmwareSetResponse", + '401': None, + '404': None, + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _params = locals() - _all_params = [ - 'id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_device_firmware_sets" % _key - ) - _params[_key] = _val - del _params['kwargs'] + def _get_device_firmware_sets_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - _collection_formats = {} + _host = None - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "FirmwareSetResponse", - '401': None, - '404': None, - '500': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/devices/{id}/firmware-sets', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/devices/{id}/firmware-sets', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def get_device_health_rollup(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], **kwargs) -> DeviceHealthRollup: # noqa: E501 - """Get Device's Health Status # noqa: E501 - Returns the health rollup status of the device. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def get_device_health_rollup( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DeviceHealthRollup: + """Get Device's Health Status - >>> thread = api.get_device_health_rollup(id, async_req=True) - >>> result = thread.get() + Returns the health rollup status of the device. :param id: Device UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: DeviceHealthRollup - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the get_device_health_rollup_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.get_device_health_rollup_with_http_info(id, **kwargs) # noqa: E501 + """ # noqa: E501 + + _param = self._get_device_health_rollup_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - @validate_arguments - def get_device_health_rollup_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """Get Device's Health Status # noqa: E501 + _response_types_map: Dict[str, Optional[str]] = { + '200': "DeviceHealthRollup", + '401': None, + '404': None, + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_device_health_rollup_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DeviceHealthRollup]: + """Get Device's Health Status - Returns the health rollup status of the device. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + Returns the health rollup status of the device. - >>> thread = api.get_device_health_rollup_with_http_info(id, async_req=True) - >>> result = thread.get() + :param id: Device UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_device_health_rollup_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DeviceHealthRollup", + '401': None, + '404': None, + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_device_health_rollup_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Device's Health Status + + Returns the health rollup status of the device. :param id: Device UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(DeviceHealthRollup, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._get_device_health_rollup_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DeviceHealthRollup", + '401': None, + '404': None, + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _params = locals() - _all_params = [ - 'id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_device_health_rollup" % _key - ) - _params[_key] = _val - del _params['kwargs'] + def _get_device_health_rollup_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - _collection_formats = {} + _host = None - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "DeviceHealthRollup", - '401': None, - '404': None, - '500': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/devices/{id}/diagnostics/health/rollup', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/devices/{id}/diagnostics/health/rollup', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def perform_action(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], device_action_input : Annotated[DeviceActionInput, Field(..., description="Action to perform")], **kwargs) -> None: # noqa: E501 - """Perform an action # noqa: E501 - Performs an action for the given device. Possible actions include: power_on, power_off, reboot, reinstall, and rescue (reboot the device into rescue OS.) # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def perform_action( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + device_action_input: Annotated[DeviceActionInput, Field(description="Action to perform")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Perform an action - >>> thread = api.perform_action(id, device_action_input, async_req=True) - >>> result = thread.get() + Performs an action for the given device. Possible actions include: power_on, power_off, reboot, reinstall, and rescue (reboot the device into rescue OS.) :param id: Device UUID (required) :type id: str :param device_action_input: Action to perform (required) :type device_action_input: DeviceActionInput - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the perform_action_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.perform_action_with_http_info(id, device_action_input, **kwargs) # noqa: E501 + """ # noqa: E501 + + _param = self._perform_action_serialize( + id=id, + device_action_input=device_action_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - @validate_arguments - def perform_action_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], device_action_input : Annotated[DeviceActionInput, Field(..., description="Action to perform")], **kwargs) -> ApiResponse: # noqa: E501 - """Perform an action # noqa: E501 + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def perform_action_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + device_action_input: Annotated[DeviceActionInput, Field(description="Action to perform")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Perform an action - Performs an action for the given device. Possible actions include: power_on, power_off, reboot, reinstall, and rescue (reboot the device into rescue OS.) # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + Performs an action for the given device. Possible actions include: power_on, power_off, reboot, reinstall, and rescue (reboot the device into rescue OS.) - >>> thread = api.perform_action_with_http_info(id, device_action_input, async_req=True) - >>> result = thread.get() + :param id: Device UUID (required) + :type id: str + :param device_action_input: Action to perform (required) + :type device_action_input: DeviceActionInput + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._perform_action_serialize( + id=id, + device_action_input=device_action_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def perform_action_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + device_action_input: Annotated[DeviceActionInput, Field(description="Action to perform")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Perform an action + + Performs an action for the given device. Possible actions include: power_on, power_off, reboot, reinstall, and rescue (reboot the device into rescue OS.) :param id: Device UUID (required) :type id: str :param device_action_input: Action to perform (required) :type device_action_input: DeviceActionInput - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 + + _param = self._perform_action_serialize( + id=id, + device_action_input=device_action_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _params = locals() - _all_params = [ - 'id', - 'device_action_input' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method perform_action" % _key - ) - _params[_key] = _val - del _params['kwargs'] + def _perform_action_serialize( + self, + id, + device_action_input, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - _collection_formats = {} + _host = None - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['device_action_input'] is not None: - _body_params = _params['device_action_input'] + if device_action_input is not None: + _body_params = device_action_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = {} + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/devices/{id}/actions', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/devices/{id}/actions', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def update_device(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], device_update_input : Annotated[DeviceUpdateInput, Field(..., description="Device to update")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> Device: # noqa: E501 - """Update the device # noqa: E501 - Updates the device. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def update_device( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + device_update_input: Annotated[DeviceUpdateInput, Field(description="Device to update")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Device: + """Update the device - >>> thread = api.update_device(id, device_update_input, include, exclude, async_req=True) - >>> result = thread.get() + Updates the device. :param id: Device UUID (required) :type id: str @@ -3360,32 +6194,80 @@ def update_device(self, id : Annotated[StrictStr, Field(..., description="Device :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Device - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the update_device_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.update_device_with_http_info(id, device_update_input, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def update_device_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], device_update_input : Annotated[DeviceUpdateInput, Field(..., description="Device to update")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Update the device # noqa: E501 + """ # noqa: E501 + + _param = self._update_device_serialize( + id=id, + device_update_input=device_update_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Updates the device. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "Device", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_device_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + device_update_input: Annotated[DeviceUpdateInput, Field(description="Device to update")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Device]: + """Update the device - >>> thread = api.update_device_with_http_info(id, device_update_input, include, exclude, async_req=True) - >>> result = thread.get() + Updates the device. :param id: Device UUID (required) :type id: str @@ -3395,124 +6277,220 @@ def update_device_with_http_info(self, id : Annotated[StrictStr, Field(..., desc :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Device, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._update_device_serialize( + id=id, + device_update_input=device_update_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "Device", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id', - 'device_update_input', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method update_device" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + @validate_call + def update_device_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + device_update_input: Annotated[DeviceUpdateInput, Field(description="Device to update")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update the device - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + Updates the device. + :param id: Device UUID (required) + :type id: str + :param device_update_input: Device to update (required) + :type device_update_input: DeviceUpdateInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_device_serialize( + id=id, + device_update_input=device_update_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _response_types_map: Dict[str, Optional[str]] = { + '200': "Device", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_device_serialize( + self, + id, + device_update_input, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['device_update_input'] is not None: - _body_params = _params['device_update_input'] + if device_update_input is not None: + _body_params = device_update_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '200': "Device", - '401': "Error", - '403': "Error", - '404': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/devices/{id}', 'PUT', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='PUT', + resource_path='/devices/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/emails_api.py b/equinix_metal/equinix_metal/api/emails_api.py index 3187d624..d4d771e4 100644 --- a/equinix_metal/equinix_metal/api/emails_api.py +++ b/equinix_metal/equinix_metal/api/emails_api.py @@ -12,621 +12,1131 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated from pydantic import Field, StrictStr - +from typing_extensions import Annotated from equinix_metal.models.create_email_input import CreateEmailInput from equinix_metal.models.email import Email from equinix_metal.models.update_email_input import UpdateEmailInput -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class EmailsApi(object): +class EmailsApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def create_email( + self, + create_email_input: Annotated[CreateEmailInput, Field(description="Email to create")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Email: + """Create an email - @validate_arguments - def create_email(self, create_email_input : Annotated[CreateEmailInput, Field(..., description="Email to create")], **kwargs) -> Email: # noqa: E501 - """Create an email # noqa: E501 - - Add a new email address to the current user. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_email(create_email_input, async_req=True) - >>> result = thread.get() + Add a new email address to the current user. :param create_email_input: Email to create (required) :type create_email_input: CreateEmailInput - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Email - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the create_email_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.create_email_with_http_info(create_email_input, **kwargs) # noqa: E501 - - @validate_arguments - def create_email_with_http_info(self, create_email_input : Annotated[CreateEmailInput, Field(..., description="Email to create")], **kwargs) -> ApiResponse: # noqa: E501 - """Create an email # noqa: E501 - - Add a new email address to the current user. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_email_with_http_info(create_email_input, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._create_email_serialize( + create_email_input=create_email_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "Email", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_email_with_http_info( + self, + create_email_input: Annotated[CreateEmailInput, Field(description="Email to create")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Email]: + """Create an email + + Add a new email address to the current user. :param create_email_input: Email to create (required) :type create_email_input: CreateEmailInput - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Email, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._create_email_serialize( + create_email_input=create_email_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "Email", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'create_email_input' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def create_email_without_preload_content( + self, + create_email_input: Annotated[CreateEmailInput, Field(description="Email to create")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create an email + + Add a new email address to the current user. + + :param create_email_input: Email to create (required) + :type create_email_input: CreateEmailInput + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_email_serialize( + create_email_input=create_email_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_email" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '201': "Email", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} + def _create_email_serialize( + self, + create_email_input, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['create_email_input'] is not None: - _body_params = _params['create_email_input'] + if create_email_input is not None: + _body_params = create_email_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '201': "Email", - '401': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/emails', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/emails', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def delete_email(self, id : Annotated[StrictStr, Field(..., description="Email UUID")], **kwargs) -> None: # noqa: E501 - """Delete the email # noqa: E501 - Deletes the email. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def delete_email( + self, + id: Annotated[StrictStr, Field(description="Email UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete the email - >>> thread = api.delete_email(id, async_req=True) - >>> result = thread.get() + Deletes the email. :param id: Email UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the delete_email_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.delete_email_with_http_info(id, **kwargs) # noqa: E501 - - @validate_arguments - def delete_email_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Email UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """Delete the email # noqa: E501 - - Deletes the email. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_email_with_http_info(id, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._delete_email_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_email_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Email UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete the email + + Deletes the email. :param id: Email UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 + + _param = self._delete_email_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def delete_email_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Email UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete the email + + Deletes the email. + + :param id: Email UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_email_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_email" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _delete_email_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/emails/{id}', 'DELETE', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='DELETE', + resource_path='/emails/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_email_by_id(self, id : Annotated[StrictStr, Field(..., description="Email UUID")], **kwargs) -> Email: # noqa: E501 - """Retrieve an email # noqa: E501 - Provides one of the user’s emails. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_email_by_id( + self, + id: Annotated[StrictStr, Field(description="Email UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Email: + """Retrieve an email - >>> thread = api.find_email_by_id(id, async_req=True) - >>> result = thread.get() + Provides one of the user’s emails. :param id: Email UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Email - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_email_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_email_by_id_with_http_info(id, **kwargs) # noqa: E501 - - @validate_arguments - def find_email_by_id_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Email UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve an email # noqa: E501 - - Provides one of the user’s emails. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_email_by_id_with_http_info(id, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_email_by_id_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Email", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_email_by_id_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Email UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Email]: + """Retrieve an email + + Provides one of the user’s emails. :param id: Email UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Email, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_email_by_id_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Email", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def find_email_by_id_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Email UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve an email + + Provides one of the user’s emails. + + :param id: Email UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_email_by_id_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_email_by_id" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "Email", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_email_by_id_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "Email", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/emails/{id}', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/emails/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def update_email(self, id : Annotated[StrictStr, Field(..., description="Email UUID")], update_email_input : Annotated[UpdateEmailInput, Field(..., description="email to update")], **kwargs) -> Email: # noqa: E501 - """Update the email # noqa: E501 - Updates the email. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def update_email( + self, + id: Annotated[StrictStr, Field(description="Email UUID")], + update_email_input: Annotated[UpdateEmailInput, Field(description="email to update")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Email: + """Update the email - >>> thread = api.update_email(id, update_email_input, async_req=True) - >>> result = thread.get() + Updates the email. :param id: Email UUID (required) :type id: str :param update_email_input: email to update (required) :type update_email_input: UpdateEmailInput - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Email - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the update_email_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.update_email_with_http_info(id, update_email_input, **kwargs) # noqa: E501 - - @validate_arguments - def update_email_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Email UUID")], update_email_input : Annotated[UpdateEmailInput, Field(..., description="email to update")], **kwargs) -> ApiResponse: # noqa: E501 - """Update the email # noqa: E501 - - Updates the email. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.update_email_with_http_info(id, update_email_input, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._update_email_serialize( + id=id, + update_email_input=update_email_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Email", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_email_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Email UUID")], + update_email_input: Annotated[UpdateEmailInput, Field(description="email to update")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Email]: + """Update the email + + Updates the email. :param id: Email UUID (required) :type id: str :param update_email_input: email to update (required) :type update_email_input: UpdateEmailInput - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Email, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._update_email_serialize( + id=id, + update_email_input=update_email_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Email", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id', - 'update_email_input' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def update_email_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Email UUID")], + update_email_input: Annotated[UpdateEmailInput, Field(description="email to update")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update the email + + Updates the email. + + :param id: Email UUID (required) + :type id: str + :param update_email_input: email to update (required) + :type update_email_input: UpdateEmailInput + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_email_serialize( + id=id, + update_email_input=update_email_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method update_email" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "Email", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _update_email_serialize( + self, + id, + update_email_input, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['update_email_input'] is not None: - _body_params = _params['update_email_input'] + if update_email_input is not None: + _body_params = update_email_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '200': "Email", - '401': "Error", - '403': "Error", - '404': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/emails/{id}', 'PUT', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='PUT', + resource_path='/emails/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/events_api.py b/equinix_metal/equinix_metal/api/events_api.py index a4456eca..e55fe3c0 100644 --- a/equinix_metal/equinix_metal/api/events_api.py +++ b/equinix_metal/equinix_metal/api/events_api.py @@ -12,43 +12,35 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictStr, conint, conlist - -from typing import Optional - +from pydantic import Field, StrictStr +from typing import List, Optional +from typing_extensions import Annotated from equinix_metal.models.event import Event from equinix_metal.models.event_list import EventList -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class EventsApi(object): +class EventsApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client - - @validate_arguments - def find_device_events_all_pages(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> EventList: # noqa: E501 + @validate_call + def find_device_events_all_pages(self, id : Annotated[StrictStr, Field(description="Device UUID")], include : Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, per_page : Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, **kwargs) -> EventList: # noqa: E501 """Retrieve device's events # noqa: E501 This method is the same as find_device_events, but fetches resources from all the pages. @@ -99,19 +91,33 @@ def find_device_events_all_pages(self, id : Annotated[StrictStr, Field(..., desc if page_response.meta.next is None: break page += 1 - - return all_pages - @validate_arguments - def find_device_events(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> EventList: # noqa: E501 - """Retrieve device's events # noqa: E501 + return all_pages - Returns a list of events pertaining to a specific device # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_device_events( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> EventList: + """Retrieve device's events - >>> thread = api.find_device_events(id, include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + Returns a list of events pertaining to a specific device :param id: Device UUID (required) :type id: str @@ -123,32 +129,81 @@ def find_device_events(self, id : Annotated[StrictStr, Field(..., description="D :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: EventList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_device_events_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_device_events_with_http_info(id, include, exclude, page, per_page, **kwargs) # noqa: E501 - - @validate_arguments - def find_device_events_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve device's events # noqa: E501 + """ # noqa: E501 + + _param = self._find_device_events_serialize( + id=id, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Returns a list of events pertaining to a specific device # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "EventList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_device_events_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[EventList]: + """Retrieve device's events - >>> thread = api.find_device_events_with_http_info(id, include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + Returns a list of events pertaining to a specific device :param id: Device UUID (required) :type id: str @@ -160,134 +215,242 @@ def find_device_events_with_http_info(self, id : Annotated[StrictStr, Field(..., :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(EventList, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'id', - 'include', - 'exclude', - 'page', - 'per_page' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + """ # noqa: E501 + + _param = self._find_device_events_serialize( + id=id, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_device_events" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} + _response_types_map: Dict[str, Optional[str]] = { + '200': "EventList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + @validate_call + def find_device_events_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve device's events - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + Returns a list of events pertaining to a specific device - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + :param id: Device UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param page: Page to return + :type page: int + :param per_page: Items returned per page + :type per_page: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_device_events_serialize( + id=id, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - if _params.get('page') is not None: # noqa: E501 - _query_params.append(('page', _params['page'])) + _response_types_map: Dict[str, Optional[str]] = { + '200': "EventList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _find_device_events_serialize( + self, + id, + include, + exclude, + page, + per_page, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('per_page') is not None: # noqa: E501 - _query_params.append(('per_page', _params['per_page'])) + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + + if page is not None: + + _query_params.append(('page', page)) + + if per_page is not None: + + _query_params.append(('per_page', per_page)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "EventList", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/devices/{id}/events', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/devices/{id}/events', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_event_by_id(self, id : Annotated[StrictStr, Field(..., description="Event UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> Event: # noqa: E501 - """Retrieve an event # noqa: E501 - Returns a single event if the user has access # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_event_by_id( + self, + id: Annotated[StrictStr, Field(description="Event UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Event: + """Retrieve an event - >>> thread = api.find_event_by_id(id, include, exclude, async_req=True) - >>> result = thread.get() + Returns a single event if the user has access :param id: Event UUID (required) :type id: str @@ -295,32 +458,77 @@ def find_event_by_id(self, id : Annotated[StrictStr, Field(..., description="Eve :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Event - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_event_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_event_by_id_with_http_info(id, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def find_event_by_id_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Event UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve an event # noqa: E501 + """ # noqa: E501 + + _param = self._find_event_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Returns a single event if the user has access # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "Event", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_event_by_id_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Event UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Event]: + """Retrieve an event - >>> thread = api.find_event_by_id_with_http_info(id, include, exclude, async_req=True) - >>> result = thread.get() + Returns a single event if the user has access :param id: Event UUID (required) :type id: str @@ -328,118 +536,202 @@ def find_event_by_id_with_http_info(self, id : Annotated[StrictStr, Field(..., d :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Event, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_event_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Event", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def find_event_by_id_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Event UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve an event + + Returns a single event if the user has access + + :param id: Event UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_event_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_event_by_id" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "Event", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_event_by_id_serialize( + self, + id, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "Event", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/events/{id}', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/events/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_events_all_pages(self, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> EventList: # noqa: E501 + + @validate_call + def find_events_all_pages(self, include : Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, per_page : Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, **kwargs) -> EventList: # noqa: E501 """Retrieve current user's events # noqa: E501 This method is the same as find_events, but fetches resources from all the pages. @@ -487,19 +779,32 @@ def find_events_all_pages(self, include : Annotated[Optional[conlist(StrictStr)] if page_response.meta.next is None: break page += 1 - - return all_pages - @validate_arguments - def find_events(self, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> EventList: # noqa: E501 - """Retrieve current user's events # noqa: E501 + return all_pages - Returns a list of the current user’s events # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_events( + self, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> EventList: + """Retrieve current user's events - >>> thread = api.find_events(include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + Returns a list of the current user’s events :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] @@ -509,32 +814,77 @@ def find_events(self, include : Annotated[Optional[conlist(StrictStr)], Field(de :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: EventList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_events_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_events_with_http_info(include, exclude, page, per_page, **kwargs) # noqa: E501 - - @validate_arguments - def find_events_with_http_info(self, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve current user's events # noqa: E501 + """ # noqa: E501 + + _param = self._find_events_serialize( + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Returns a list of the current user’s events # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "EventList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_events_with_http_info( + self, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[EventList]: + """Retrieve current user's events - >>> thread = api.find_events_with_http_info(include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + Returns a list of the current user’s events :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] @@ -544,120 +894,210 @@ def find_events_with_http_info(self, include : Annotated[Optional[conlist(Strict :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(EventList, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'include', - 'exclude', - 'page', - 'per_page' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + """ # noqa: E501 + + _param = self._find_events_serialize( + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_events" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' - - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' - - if _params.get('page') is not None: # noqa: E501 - _query_params.append(('page', _params['page'])) - - if _params.get('per_page') is not None: # noqa: E501 - _query_params.append(('per_page', _params['per_page'])) - - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { + _response_types_map: Dict[str, Optional[str]] = { '200': "EventList", '401': "Error", } - - return self.api_client.call_api( - '/events', 'GET', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), + ) + + + @validate_call + def find_events_without_preload_content( + self, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve current user's events + + Returns a list of the current user’s events + + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param page: Page to return + :type page: int + :param per_page: Items returned per page + :type per_page: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_events_serialize( + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EventList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _find_events_serialize( + self, + include, + exclude, + page, + per_page, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + + if page is not None: + + _query_params.append(('page', page)) + + if per_page is not None: + + _query_params.append(('per_page', per_page)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/events', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_interconnection_events_all_pages(self, connection_id : Annotated[StrictStr, Field(..., description="Interconnection UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> EventList: # noqa: E501 + + @validate_call + def find_interconnection_events_all_pages(self, connection_id : Annotated[StrictStr, Field(description="Interconnection UUID")], include : Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, per_page : Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, **kwargs) -> EventList: # noqa: E501 """Retrieve interconnection events # noqa: E501 This method is the same as find_interconnection_events, but fetches resources from all the pages. @@ -708,19 +1148,33 @@ def find_interconnection_events_all_pages(self, connection_id : Annotated[Strict if page_response.meta.next is None: break page += 1 - - return all_pages - @validate_arguments - def find_interconnection_events(self, connection_id : Annotated[StrictStr, Field(..., description="Interconnection UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> EventList: # noqa: E501 - """Retrieve interconnection events # noqa: E501 + return all_pages - Returns a list of the interconnection events # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_interconnection_events( + self, + connection_id: Annotated[StrictStr, Field(description="Interconnection UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> EventList: + """Retrieve interconnection events - >>> thread = api.find_interconnection_events(connection_id, include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + Returns a list of the interconnection events :param connection_id: Interconnection UUID (required) :type connection_id: str @@ -732,32 +1186,81 @@ def find_interconnection_events(self, connection_id : Annotated[StrictStr, Field :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: EventList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_interconnection_events_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_interconnection_events_with_http_info(connection_id, include, exclude, page, per_page, **kwargs) # noqa: E501 - - @validate_arguments - def find_interconnection_events_with_http_info(self, connection_id : Annotated[StrictStr, Field(..., description="Interconnection UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve interconnection events # noqa: E501 + """ # noqa: E501 + + _param = self._find_interconnection_events_serialize( + connection_id=connection_id, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Returns a list of the interconnection events # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "EventList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_interconnection_events_with_http_info( + self, + connection_id: Annotated[StrictStr, Field(description="Interconnection UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[EventList]: + """Retrieve interconnection events - >>> thread = api.find_interconnection_events_with_http_info(connection_id, include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + Returns a list of the interconnection events :param connection_id: Interconnection UUID (required) :type connection_id: str @@ -769,134 +1272,245 @@ def find_interconnection_events_with_http_info(self, connection_id : Annotated[S :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(EventList, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'connection_id', - 'include', - 'exclude', - 'page', - 'per_page' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + """ # noqa: E501 + + _param = self._find_interconnection_events_serialize( + connection_id=connection_id, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_interconnection_events" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} + _response_types_map: Dict[str, Optional[str]] = { + '200': "EventList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - # process the path parameters - _path_params = {} - if _params['connection_id']: - _path_params['connection_id'] = _params['connection_id'] + @validate_call + def find_interconnection_events_without_preload_content( + self, + connection_id: Annotated[StrictStr, Field(description="Interconnection UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve interconnection events - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + Returns a list of the interconnection events - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + :param connection_id: Interconnection UUID (required) + :type connection_id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param page: Page to return + :type page: int + :param per_page: Items returned per page + :type per_page: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_interconnection_events_serialize( + connection_id=connection_id, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - if _params.get('page') is not None: # noqa: E501 - _query_params.append(('page', _params['page'])) + _response_types_map: Dict[str, Optional[str]] = { + '200': "EventList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _find_interconnection_events_serialize( + self, + connection_id, + include, + exclude, + page, + per_page, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('per_page') is not None: # noqa: E501 - _query_params.append(('per_page', _params['per_page'])) + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if connection_id is not None: + _path_params['connection_id'] = connection_id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + + if page is not None: + + _query_params.append(('page', page)) + + if per_page is not None: + + _query_params.append(('per_page', per_page)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "EventList", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/connections/{connection_id}/events', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/connections/{connection_id}/events', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_interconnection_port_events(self, connection_id : Annotated[StrictStr, Field(..., description="Interconnection UUID")], id : Annotated[StrictStr, Field(..., description="Interconnection Port UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> Event: # noqa: E501 - """Retrieve interconnection port events # noqa: E501 - Returns a list of the interconnection port events # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_interconnection_port_events( + self, + connection_id: Annotated[StrictStr, Field(description="Interconnection UUID")], + id: Annotated[StrictStr, Field(description="Interconnection Port UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Event: + """Retrieve interconnection port events - >>> thread = api.find_interconnection_port_events(connection_id, id, include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + Returns a list of the interconnection port events :param connection_id: Interconnection UUID (required) :type connection_id: str @@ -910,32 +1524,83 @@ def find_interconnection_port_events(self, connection_id : Annotated[StrictStr, :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Event - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_interconnection_port_events_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_interconnection_port_events_with_http_info(connection_id, id, include, exclude, page, per_page, **kwargs) # noqa: E501 - - @validate_arguments - def find_interconnection_port_events_with_http_info(self, connection_id : Annotated[StrictStr, Field(..., description="Interconnection UUID")], id : Annotated[StrictStr, Field(..., description="Interconnection Port UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve interconnection port events # noqa: E501 + """ # noqa: E501 + + _param = self._find_interconnection_port_events_serialize( + connection_id=connection_id, + id=id, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Returns a list of the interconnection port events # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "Event", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_interconnection_port_events_with_http_info( + self, + connection_id: Annotated[StrictStr, Field(description="Interconnection UUID")], + id: Annotated[StrictStr, Field(description="Interconnection Port UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Event]: + """Retrieve interconnection port events - >>> thread = api.find_interconnection_port_events_with_http_info(connection_id, id, include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + Returns a list of the interconnection port events :param connection_id: Interconnection UUID (required) :type connection_id: str @@ -949,161 +1614,261 @@ def find_interconnection_port_events_with_http_info(self, connection_id : Annota :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Event, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'connection_id', - 'id', - 'include', - 'exclude', - 'page', - 'per_page' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + """ # noqa: E501 + + _param = self._find_interconnection_port_events_serialize( + connection_id=connection_id, + id=id, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_interconnection_port_events" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params['connection_id']: - _path_params['connection_id'] = _params['connection_id'] - - if _params['id']: - _path_params['id'] = _params['id'] - - - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' - - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' - - if _params.get('page') is not None: # noqa: E501 - _query_params.append(('page', _params['page'])) - - if _params.get('per_page') is not None: # noqa: E501 - _query_params.append(('per_page', _params['per_page'])) - - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { + _response_types_map: Dict[str, Optional[str]] = { '200': "Event", '401': "Error", '403': "Error", '404': "Error", } - - return self.api_client.call_api( - '/connections/{connection_id}/ports/{id}/events', 'GET', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - def find_organization_events_all_pages(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> EventList: # noqa: E501 - """Retrieve organization's events # noqa: E501 + ) - This method is the same as find_organization_events, but fetches resources from all the pages. - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_interconnection_port_events_without_preload_content( + self, + connection_id: Annotated[StrictStr, Field(description="Interconnection UUID")], + id: Annotated[StrictStr, Field(description="Interconnection Port UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve interconnection port events - >>> thread = api.find_organization_events(}id, , }include, , }exclude, , }, }per_page, , async_req=True) - >>> result = thread.get() + Returns a list of the interconnection port events - - :param id: Organization UUID (required) + :param connection_id: Interconnection UUID (required) + :type connection_id: str + :param id: Interconnection Port UUID (required) :type id: str - :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - + :param page: Page to return + :type page: int :param per_page: Items returned per page :type per_page: int - - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for a single page request. - If one number provided, it will be single - page request timeout. It can also be a pair - (tuple) of (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, + """ # noqa: E501 + + _param = self._find_interconnection_port_events_serialize( + connection_id=connection_id, + id=id, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Event", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _find_interconnection_port_events_serialize( + self, + connection_id, + id, + include, + exclude, + page, + per_page, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if connection_id is not None: + _path_params['connection_id'] = connection_id + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + + if page is not None: + + _query_params.append(('page', page)) + + if per_page is not None: + + _query_params.append(('per_page', per_page)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/connections/{connection_id}/ports/{id}/events', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + @validate_call + def find_organization_events_all_pages(self, id : Annotated[StrictStr, Field(description="Organization UUID")], include : Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, per_page : Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, **kwargs) -> EventList: # noqa: E501 + """Retrieve organization's events # noqa: E501 + + This method is the same as find_organization_events, but fetches resources from all the pages. + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.find_organization_events(}id, , }include, , }exclude, , }, }per_page, , async_req=True) + >>> result = thread.get() + + + :param id: Organization UUID (required) + :type id: str + + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + + :param per_page: Items returned per page + :type per_page: int + + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for a single page request. + If one number provided, it will be single + page request timeout. It can also be a pair + (tuple) of (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, returns the request thread. :rtype: EventList @@ -1123,19 +1888,33 @@ def find_organization_events_all_pages(self, id : Annotated[StrictStr, Field(... if page_response.meta.next is None: break page += 1 - - return all_pages - @validate_arguments - def find_organization_events(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> EventList: # noqa: E501 - """Retrieve organization's events # noqa: E501 + return all_pages - Returns a list of events for a single organization # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_organization_events( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> EventList: + """Retrieve organization's events - >>> thread = api.find_organization_events(id, include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + Returns a list of events for a single organization :param id: Organization UUID (required) :type id: str @@ -1147,32 +1926,81 @@ def find_organization_events(self, id : Annotated[StrictStr, Field(..., descript :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: EventList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_organization_events_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_organization_events_with_http_info(id, include, exclude, page, per_page, **kwargs) # noqa: E501 - - @validate_arguments - def find_organization_events_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve organization's events # noqa: E501 + """ # noqa: E501 + + _param = self._find_organization_events_serialize( + id=id, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Returns a list of events for a single organization # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "EventList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_organization_events_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[EventList]: + """Retrieve organization's events - >>> thread = api.find_organization_events_with_http_info(id, include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + Returns a list of events for a single organization :param id: Organization UUID (required) :type id: str @@ -1184,126 +2012,222 @@ def find_organization_events_with_http_info(self, id : Annotated[StrictStr, Fiel :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(EventList, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'id', - 'include', - 'exclude', - 'page', - 'per_page' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + """ # noqa: E501 + + _param = self._find_organization_events_serialize( + id=id, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_organization_events" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} + _response_types_map: Dict[str, Optional[str]] = { + '200': "EventList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + @validate_call + def find_organization_events_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve organization's events - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + Returns a list of events for a single organization - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + :param id: Organization UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param page: Page to return + :type page: int + :param per_page: Items returned per page + :type per_page: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_organization_events_serialize( + id=id, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - if _params.get('page') is not None: # noqa: E501 - _query_params.append(('page', _params['page'])) + _response_types_map: Dict[str, Optional[str]] = { + '200': "EventList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _find_organization_events_serialize( + self, + id, + include, + exclude, + page, + per_page, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('per_page') is not None: # noqa: E501 - _query_params.append(('per_page', _params['per_page'])) + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + + if page is not None: + + _query_params.append(('page', page)) + + if per_page is not None: + + _query_params.append(('per_page', per_page)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "EventList", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/organizations/{id}/events', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/organizations/{id}/events', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + - @validate_arguments - def find_project_events_all_pages(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> EventList: # noqa: E501 + @validate_call + def find_project_events_all_pages(self, id : Annotated[StrictStr, Field(description="Project UUID")], include : Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, per_page : Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, **kwargs) -> EventList: # noqa: E501 """Retrieve project's events # noqa: E501 This method is the same as find_project_events, but fetches resources from all the pages. @@ -1354,19 +2278,33 @@ def find_project_events_all_pages(self, id : Annotated[StrictStr, Field(..., des if page_response.meta.next is None: break page += 1 - - return all_pages - @validate_arguments - def find_project_events(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> EventList: # noqa: E501 - """Retrieve project's events # noqa: E501 + return all_pages - Returns a list of events for a single project # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_project_events( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> EventList: + """Retrieve project's events - >>> thread = api.find_project_events(id, include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + Returns a list of events for a single project :param id: Project UUID (required) :type id: str @@ -1378,32 +2316,81 @@ def find_project_events(self, id : Annotated[StrictStr, Field(..., description=" :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: EventList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_project_events_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_project_events_with_http_info(id, include, exclude, page, per_page, **kwargs) # noqa: E501 - - @validate_arguments - def find_project_events_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve project's events # noqa: E501 + """ # noqa: E501 + + _param = self._find_project_events_serialize( + id=id, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Returns a list of events for a single project # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "EventList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_project_events_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[EventList]: + """Retrieve project's events - >>> thread = api.find_project_events_with_http_info(id, include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + Returns a list of events for a single project :param id: Project UUID (required) :type id: str @@ -1415,134 +2402,244 @@ def find_project_events_with_http_info(self, id : Annotated[StrictStr, Field(... :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(EventList, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'id', - 'include', - 'exclude', - 'page', - 'per_page' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + """ # noqa: E501 + + _param = self._find_project_events_serialize( + id=id, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_project_events" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} + _response_types_map: Dict[str, Optional[str]] = { + '200': "EventList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + @validate_call + def find_project_events_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve project's events - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + Returns a list of events for a single project - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + :param id: Project UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param page: Page to return + :type page: int + :param per_page: Items returned per page + :type per_page: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_project_events_serialize( + id=id, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - if _params.get('page') is not None: # noqa: E501 - _query_params.append(('page', _params['page'])) + _response_types_map: Dict[str, Optional[str]] = { + '200': "EventList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _find_project_events_serialize( + self, + id, + include, + exclude, + page, + per_page, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('per_page') is not None: # noqa: E501 - _query_params.append(('per_page', _params['per_page'])) + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + + if page is not None: + + _query_params.append(('page', page)) + + if per_page is not None: + + _query_params.append(('per_page', per_page)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "EventList", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{id}/events', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/projects/{id}/events', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_virtual_circuit_events(self, id : Annotated[StrictStr, Field(..., description="Virtual Circuit UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> Event: # noqa: E501 - """Retrieve virtual circuit events # noqa: E501 - Returns a list of the virtual circuit events # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_virtual_circuit_events( + self, + id: Annotated[StrictStr, Field(description="Virtual Circuit UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Event: + """Retrieve virtual circuit events - >>> thread = api.find_virtual_circuit_events(id, include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + Returns a list of the virtual circuit events :param id: Virtual Circuit UUID (required) :type id: str @@ -1554,32 +2651,81 @@ def find_virtual_circuit_events(self, id : Annotated[StrictStr, Field(..., descr :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Event - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_virtual_circuit_events_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_virtual_circuit_events_with_http_info(id, include, exclude, page, per_page, **kwargs) # noqa: E501 - - @validate_arguments - def find_virtual_circuit_events_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Virtual Circuit UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve virtual circuit events # noqa: E501 + """ # noqa: E501 + + _param = self._find_virtual_circuit_events_serialize( + id=id, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Returns a list of the virtual circuit events # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "Event", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_virtual_circuit_events_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Virtual Circuit UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Event]: + """Retrieve virtual circuit events - >>> thread = api.find_virtual_circuit_events_with_http_info(id, include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + Returns a list of the virtual circuit events :param id: Virtual Circuit UUID (required) :type id: str @@ -1591,134 +2737,244 @@ def find_virtual_circuit_events_with_http_info(self, id : Annotated[StrictStr, F :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Event, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'id', - 'include', - 'exclude', - 'page', - 'per_page' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + """ # noqa: E501 + + _param = self._find_virtual_circuit_events_serialize( + id=id, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_virtual_circuit_events" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} + _response_types_map: Dict[str, Optional[str]] = { + '200': "Event", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + @validate_call + def find_virtual_circuit_events_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Virtual Circuit UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve virtual circuit events - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + Returns a list of the virtual circuit events - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + :param id: Virtual Circuit UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param page: Page to return + :type page: int + :param per_page: Items returned per page + :type per_page: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_virtual_circuit_events_serialize( + id=id, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - if _params.get('page') is not None: # noqa: E501 - _query_params.append(('page', _params['page'])) + _response_types_map: Dict[str, Optional[str]] = { + '200': "Event", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _find_virtual_circuit_events_serialize( + self, + id, + include, + exclude, + page, + per_page, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('per_page') is not None: # noqa: E501 - _query_params.append(('per_page', _params['per_page'])) + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + + if page is not None: + + _query_params.append(('page', page)) + + if per_page is not None: + + _query_params.append(('per_page', per_page)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "Event", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/virtual-circuits/{id}/events', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/virtual-circuits/{id}/events', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_vrf_route_events(self, id : Annotated[StrictStr, Field(..., description="VRF Route UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> Event: # noqa: E501 - """Retrieve VRF route events # noqa: E501 - Returns a list of the VRF route events # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_vrf_route_events( + self, + id: Annotated[StrictStr, Field(description="VRF Route UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Event: + """Retrieve VRF route events - >>> thread = api.find_vrf_route_events(id, include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + Returns a list of the VRF route events :param id: VRF Route UUID (required) :type id: str @@ -1730,32 +2986,81 @@ def find_vrf_route_events(self, id : Annotated[StrictStr, Field(..., description :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Event - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_vrf_route_events_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_vrf_route_events_with_http_info(id, include, exclude, page, per_page, **kwargs) # noqa: E501 - - @validate_arguments - def find_vrf_route_events_with_http_info(self, id : Annotated[StrictStr, Field(..., description="VRF Route UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve VRF route events # noqa: E501 + """ # noqa: E501 + + _param = self._find_vrf_route_events_serialize( + id=id, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Returns a list of the VRF route events # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "Event", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_vrf_route_events_with_http_info( + self, + id: Annotated[StrictStr, Field(description="VRF Route UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Event]: + """Retrieve VRF route events - >>> thread = api.find_vrf_route_events_with_http_info(id, include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + Returns a list of the VRF route events :param id: VRF Route UUID (required) :type id: str @@ -1767,120 +3072,217 @@ def find_vrf_route_events_with_http_info(self, id : Annotated[StrictStr, Field(. :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Event, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'id', - 'include', - 'exclude', - 'page', - 'per_page' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + """ # noqa: E501 + + _param = self._find_vrf_route_events_serialize( + id=id, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_vrf_route_events" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} + _response_types_map: Dict[str, Optional[str]] = { + '200': "Event", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + @validate_call + def find_vrf_route_events_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="VRF Route UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve VRF route events - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + Returns a list of the VRF route events - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + :param id: VRF Route UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param page: Page to return + :type page: int + :param per_page: Items returned per page + :type per_page: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_vrf_route_events_serialize( + id=id, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - if _params.get('page') is not None: # noqa: E501 - _query_params.append(('page', _params['page'])) + _response_types_map: Dict[str, Optional[str]] = { + '200': "Event", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _find_vrf_route_events_serialize( + self, + id, + include, + exclude, + page, + per_page, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('per_page') is not None: # noqa: E501 - _query_params.append(('per_page', _params['per_page'])) + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + + if page is not None: + + _query_params.append(('page', page)) + + if per_page is not None: + + _query_params.append(('per_page', per_page)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "Event", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/routes/{id}/events', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/routes/{id}/events', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/facilities_api.py b/equinix_metal/equinix_metal/api/facilities_api.py index be1b0246..84495d83 100644 --- a/equinix_metal/equinix_metal/api/facilities_api.py +++ b/equinix_metal/equinix_metal/api/facilities_api.py @@ -12,202 +12,337 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictStr, conlist, validator - -from typing import Optional - +from pydantic import Field, StrictStr, field_validator +from typing import List, Optional +from typing_extensions import Annotated from equinix_metal.models.facility_list import FacilityList -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class FacilitiesApi(object): +class FacilitiesApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def find_facilities( + self, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> FacilityList: + """(Deprecated) Retrieve all facilities + + Provides a listing of available datacenters where you can provision Packet devices. + + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("GET /facilities is deprecated.", DeprecationWarning) - @validate_arguments - def find_facilities(self, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> FacilityList: # noqa: E501 - """(Deprecated) Retrieve all facilities # noqa: E501 + _param = self._find_facilities_serialize( + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Provides a listing of available datacenters where you can provision Packet devices. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "FacilityList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_facilities_with_http_info( + self, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[FacilityList]: + """(Deprecated) Retrieve all facilities - >>> thread = api.find_facilities(include, exclude, async_req=True) - >>> result = thread.get() + Provides a listing of available datacenters where you can provision Packet devices. :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: FacilityList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_facilities_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_facilities_with_http_info(include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def find_facilities_with_http_info(self, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """(Deprecated) Retrieve all facilities # noqa: E501 - - Provides a listing of available datacenters where you can provision Packet devices. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_facilities_with_http_info(include, exclude, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + warnings.warn("GET /facilities is deprecated.", DeprecationWarning) + + _param = self._find_facilities_serialize( + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "FacilityList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def find_facilities_without_preload_content( + self, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """(Deprecated) Retrieve all facilities + + Provides a listing of available datacenters where you can provision Packet devices. :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(FacilityList, status_code(int), headers(HTTPHeaderDict)) - """ - + """ # noqa: E501 warnings.warn("GET /facilities is deprecated.", DeprecationWarning) - _params = locals() + _param = self._find_facilities_serialize( + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _all_params = [ - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + _response_types_map: Dict[str, Optional[str]] = { + '200': "FacilityList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) + return response_data.response - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_facilities" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + def _find_facilities_serialize( + self, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the path parameters - _path_params = {} + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'multi' + _collection_formats: Dict[str, str] = { + 'include': 'multi', + 'exclude': 'multi', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'multi' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "FacilityList", - '401': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/facilities', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/facilities', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_facilities_by_organization(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> FacilityList: # noqa: E501 - """(Deprecated) Retrieve all facilities visible by the organization # noqa: E501 - Returns a listing of available datacenters for the given organization # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_facilities_by_organization( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> FacilityList: + """(Deprecated) Retrieve all facilities visible by the organization - >>> thread = api.find_facilities_by_organization(id, include, exclude, async_req=True) - >>> result = thread.get() + Returns a listing of available datacenters for the given organization :param id: Organization UUID (required) :type id: str @@ -215,32 +350,78 @@ def find_facilities_by_organization(self, id : Annotated[StrictStr, Field(..., d :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: FacilityList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_facilities_by_organization_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_facilities_by_organization_with_http_info(id, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def find_facilities_by_organization_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """(Deprecated) Retrieve all facilities visible by the organization # noqa: E501 - - Returns a listing of available datacenters for the given organization # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_facilities_by_organization_with_http_info(id, include, exclude, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + warnings.warn("GET /organizations/{id}/facilities is deprecated.", DeprecationWarning) + + _param = self._find_facilities_by_organization_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "FacilityList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_facilities_by_organization_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[FacilityList]: + """(Deprecated) Retrieve all facilities visible by the organization + + Returns a listing of available datacenters for the given organization :param id: Organization UUID (required) :type id: str @@ -248,128 +429,224 @@ def find_facilities_by_organization_with_http_info(self, id : Annotated[StrictSt :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(FacilityList, status_code(int), headers(HTTPHeaderDict)) - """ - + """ # noqa: E501 warnings.warn("GET /organizations/{id}/facilities is deprecated.", DeprecationWarning) - _params = locals() + _param = self._find_facilities_by_organization_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _all_params = [ - 'id', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + _response_types_map: Dict[str, Optional[str]] = { + '200': "FacilityList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def find_facilities_by_organization_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """(Deprecated) Retrieve all facilities visible by the organization + + Returns a listing of available datacenters for the given organization + + :param id: Organization UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("GET /organizations/{id}/facilities is deprecated.", DeprecationWarning) + + _param = self._find_facilities_by_organization_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_facilities_by_organization" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "FacilityList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_facilities_by_organization_serialize( + self, + id, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "FacilityList", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/organizations/{id}/facilities', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/organizations/{id}/facilities', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_facilities_by_project(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> FacilityList: # noqa: E501 - """(Deprecated) Retrieve all facilities visible by the project # noqa: E501 - Returns a listing of available datacenters for the given project # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_facilities_by_project( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> FacilityList: + """(Deprecated) Retrieve all facilities visible by the project - >>> thread = api.find_facilities_by_project(id, include, exclude, async_req=True) - >>> result = thread.get() + Returns a listing of available datacenters for the given project :param id: Project UUID (required) :type id: str @@ -377,32 +654,78 @@ def find_facilities_by_project(self, id : Annotated[StrictStr, Field(..., descri :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: FacilityList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_facilities_by_project_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_facilities_by_project_with_http_info(id, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def find_facilities_by_project_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """(Deprecated) Retrieve all facilities visible by the project # noqa: E501 - - Returns a listing of available datacenters for the given project # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_facilities_by_project_with_http_info(id, include, exclude, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + warnings.warn("GET /projects/{id}/facilities is deprecated.", DeprecationWarning) + + _param = self._find_facilities_by_project_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "FacilityList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_facilities_by_project_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[FacilityList]: + """(Deprecated) Retrieve all facilities visible by the project + + Returns a listing of available datacenters for the given project :param id: Project UUID (required) :type id: str @@ -410,114 +733,199 @@ def find_facilities_by_project_with_http_info(self, id : Annotated[StrictStr, Fi :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(FacilityList, status_code(int), headers(HTTPHeaderDict)) - """ - + """ # noqa: E501 warnings.warn("GET /projects/{id}/facilities is deprecated.", DeprecationWarning) - _params = locals() + _param = self._find_facilities_by_project_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _all_params = [ - 'id', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + _response_types_map: Dict[str, Optional[str]] = { + '200': "FacilityList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def find_facilities_by_project_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """(Deprecated) Retrieve all facilities visible by the project + + Returns a listing of available datacenters for the given project + + :param id: Project UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("GET /projects/{id}/facilities is deprecated.", DeprecationWarning) + + _param = self._find_facilities_by_project_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_facilities_by_project" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "FacilityList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_facilities_by_project_serialize( + self, + id, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "FacilityList", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{id}/facilities', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/projects/{id}/facilities', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/firmware_sets_api.py b/equinix_metal/equinix_metal/api/firmware_sets_api.py index 46553f50..e6f3f2f7 100644 --- a/equinix_metal/equinix_metal/api/firmware_sets_api.py +++ b/equinix_metal/equinix_metal/api/firmware_sets_api.py @@ -12,50 +12,54 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated from pydantic import Field, StrictInt, StrictStr - from typing import Optional - +from typing_extensions import Annotated from equinix_metal.models.firmware_set_list_response import FirmwareSetListResponse -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class FirmwareSetsApi(object): +class FirmwareSetsApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def get_organization_firmware_sets( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + page: Annotated[Optional[StrictInt], Field(description="page number to return")] = None, + per_page: Annotated[Optional[StrictInt], Field(description="items returned per page.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> FirmwareSetListResponse: + """Get Organization's Firmware Sets - @validate_arguments - def get_organization_firmware_sets(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], page : Annotated[Optional[StrictInt], Field(description="page number to return")] = None, per_page : Annotated[Optional[StrictInt], Field(description="items returned per page.")] = None, **kwargs) -> FirmwareSetListResponse: # noqa: E501 - """Get Organization's Firmware Sets # noqa: E501 - - Returns all firmware sets associated with the organization. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.get_organization_firmware_sets(id, page, per_page, async_req=True) - >>> result = thread.get() + Returns all firmware sets associated with the organization. :param id: Organization UUID (required) :type id: str @@ -63,32 +67,77 @@ def get_organization_firmware_sets(self, id : Annotated[StrictStr, Field(..., de :type page: int :param per_page: items returned per page. :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: FirmwareSetListResponse - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the get_organization_firmware_sets_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.get_organization_firmware_sets_with_http_info(id, page, per_page, **kwargs) # noqa: E501 - - @validate_arguments - def get_organization_firmware_sets_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], page : Annotated[Optional[StrictInt], Field(description="page number to return")] = None, per_page : Annotated[Optional[StrictInt], Field(description="items returned per page.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Get Organization's Firmware Sets # noqa: E501 - - Returns all firmware sets associated with the organization. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.get_organization_firmware_sets_with_http_info(id, page, per_page, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._get_organization_firmware_sets_serialize( + id=id, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "FirmwareSetListResponse", + '401': None, + '404': None, + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_organization_firmware_sets_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + page: Annotated[Optional[StrictInt], Field(description="page number to return")] = None, + per_page: Annotated[Optional[StrictInt], Field(description="items returned per page.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[FirmwareSetListResponse]: + """Get Organization's Firmware Sets + + Returns all firmware sets associated with the organization. :param id: Organization UUID (required) :type id: str @@ -96,124 +145,220 @@ def get_organization_firmware_sets_with_http_info(self, id : Annotated[StrictStr :type page: int :param per_page: items returned per page. :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(FirmwareSetListResponse, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._get_organization_firmware_sets_serialize( + id=id, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "FirmwareSetListResponse", + '401': None, + '404': None, + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id', - 'page', - 'per_page' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def get_organization_firmware_sets_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + page: Annotated[Optional[StrictInt], Field(description="page number to return")] = None, + per_page: Annotated[Optional[StrictInt], Field(description="items returned per page.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Organization's Firmware Sets + + Returns all firmware sets associated with the organization. + + :param id: Organization UUID (required) + :type id: str + :param page: page number to return + :type page: int + :param per_page: items returned per page. + :type per_page: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_organization_firmware_sets_serialize( + id=id, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_organization_firmware_sets" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "FirmwareSetListResponse", + '401': None, + '404': None, + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _get_organization_firmware_sets_serialize( + self, + id, + page, + per_page, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('page') is not None: # noqa: E501 - _query_params.append(('page', _params['page'])) + _collection_formats: Dict[str, str] = { + } - if _params.get('per_page') is not None: # noqa: E501 - _query_params.append(('per_page', _params['per_page'])) + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if page is not None: + + _query_params.append(('page', page)) + + if per_page is not None: + + _query_params.append(('per_page', per_page)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "FirmwareSetListResponse", - '401': None, - '404': None, - '500': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/organizations/{id}/firmware-sets', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/organizations/{id}/firmware-sets', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def get_project_firmware_sets(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], page : Annotated[Optional[StrictInt], Field(description="page number to return")] = None, per_page : Annotated[Optional[StrictInt], Field(description="items returned per page.")] = None, **kwargs) -> FirmwareSetListResponse: # noqa: E501 - """Get Project's Firmware Sets # noqa: E501 - Returns all firmware sets associated with the project or organization. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def get_project_firmware_sets( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + page: Annotated[Optional[StrictInt], Field(description="page number to return")] = None, + per_page: Annotated[Optional[StrictInt], Field(description="items returned per page.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> FirmwareSetListResponse: + """Get Project's Firmware Sets - >>> thread = api.get_project_firmware_sets(id, page, per_page, async_req=True) - >>> result = thread.get() + Returns all firmware sets associated with the project or organization. :param id: Project UUID (required) :type id: str @@ -221,32 +366,77 @@ def get_project_firmware_sets(self, id : Annotated[StrictStr, Field(..., descrip :type page: int :param per_page: items returned per page. :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: FirmwareSetListResponse - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the get_project_firmware_sets_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.get_project_firmware_sets_with_http_info(id, page, per_page, **kwargs) # noqa: E501 - - @validate_arguments - def get_project_firmware_sets_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], page : Annotated[Optional[StrictInt], Field(description="page number to return")] = None, per_page : Annotated[Optional[StrictInt], Field(description="items returned per page.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Get Project's Firmware Sets # noqa: E501 - - Returns all firmware sets associated with the project or organization. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.get_project_firmware_sets_with_http_info(id, page, per_page, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._get_project_firmware_sets_serialize( + id=id, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "FirmwareSetListResponse", + '401': None, + '404': None, + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_project_firmware_sets_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + page: Annotated[Optional[StrictInt], Field(description="page number to return")] = None, + per_page: Annotated[Optional[StrictInt], Field(description="items returned per page.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[FirmwareSetListResponse]: + """Get Project's Firmware Sets + + Returns all firmware sets associated with the project or organization. :param id: Project UUID (required) :type id: str @@ -254,110 +444,195 @@ def get_project_firmware_sets_with_http_info(self, id : Annotated[StrictStr, Fie :type page: int :param per_page: items returned per page. :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(FirmwareSetListResponse, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._get_project_firmware_sets_serialize( + id=id, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "FirmwareSetListResponse", + '401': None, + '404': None, + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id', - 'page', - 'per_page' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def get_project_firmware_sets_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + page: Annotated[Optional[StrictInt], Field(description="page number to return")] = None, + per_page: Annotated[Optional[StrictInt], Field(description="items returned per page.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Project's Firmware Sets + + Returns all firmware sets associated with the project or organization. + + :param id: Project UUID (required) + :type id: str + :param page: page number to return + :type page: int + :param per_page: items returned per page. + :type per_page: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_project_firmware_sets_serialize( + id=id, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_project_firmware_sets" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "FirmwareSetListResponse", + '401': None, + '404': None, + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _get_project_firmware_sets_serialize( + self, + id, + page, + per_page, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('page') is not None: # noqa: E501 - _query_params.append(('page', _params['page'])) + _collection_formats: Dict[str, str] = { + } - if _params.get('per_page') is not None: # noqa: E501 - _query_params.append(('per_page', _params['per_page'])) + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if page is not None: + + _query_params.append(('page', page)) + + if per_page is not None: + + _query_params.append(('per_page', per_page)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "FirmwareSetListResponse", - '401': None, - '404': None, - '500': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{id}/firmware-sets', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/projects/{id}/firmware-sets', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/hardware_reservations_api.py b/equinix_metal/equinix_metal/api/hardware_reservations_api.py index 4a1ff6dd..5f147393 100644 --- a/equinix_metal/equinix_metal/api/hardware_reservations_api.py +++ b/equinix_metal/equinix_metal/api/hardware_reservations_api.py @@ -12,53 +12,58 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictStr, conint, conlist - -from typing import Optional - +from pydantic import Field, StrictStr, field_validator +from typing import List, Optional +from typing_extensions import Annotated from equinix_metal.models.activate_hardware_reservation_request import ActivateHardwareReservationRequest from equinix_metal.models.hardware_reservation import HardwareReservation from equinix_metal.models.hardware_reservation_list import HardwareReservationList from equinix_metal.models.move_hardware_reservation_request import MoveHardwareReservationRequest -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class HardwareReservationsApi(object): +class HardwareReservationsApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def activate_hardware_reservation( + self, + id: Annotated[StrictStr, Field(description="Hardware Reservation UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + activate_hardware_reservation_request: Annotated[Optional[ActivateHardwareReservationRequest], Field(description="Note to attach to the reservation")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> HardwareReservation: + """Activate a spare hardware reservation - @validate_arguments - def activate_hardware_reservation(self, id : Annotated[StrictStr, Field(..., description="Hardware Reservation UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, activate_hardware_reservation_request : Annotated[Optional[ActivateHardwareReservationRequest], Field(description="Note to attach to the reservation")] = None, **kwargs) -> HardwareReservation: # noqa: E501 - """Activate a spare hardware reservation # noqa: E501 - - Activate a spare hardware reservation # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.activate_hardware_reservation(id, include, exclude, activate_hardware_reservation_request, async_req=True) - >>> result = thread.get() + Activate a spare hardware reservation :param id: Hardware Reservation UUID (required) :type id: str @@ -68,32 +73,79 @@ def activate_hardware_reservation(self, id : Annotated[StrictStr, Field(..., des :type exclude: List[str] :param activate_hardware_reservation_request: Note to attach to the reservation :type activate_hardware_reservation_request: ActivateHardwareReservationRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: HardwareReservation - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the activate_hardware_reservation_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.activate_hardware_reservation_with_http_info(id, include, exclude, activate_hardware_reservation_request, **kwargs) # noqa: E501 - - @validate_arguments - def activate_hardware_reservation_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Hardware Reservation UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, activate_hardware_reservation_request : Annotated[Optional[ActivateHardwareReservationRequest], Field(description="Note to attach to the reservation")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Activate a spare hardware reservation # noqa: E501 + """ # noqa: E501 + + _param = self._activate_hardware_reservation_serialize( + id=id, + include=include, + exclude=exclude, + activate_hardware_reservation_request=activate_hardware_reservation_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Activate a spare hardware reservation # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '201': "HardwareReservation", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def activate_hardware_reservation_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Hardware Reservation UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + activate_hardware_reservation_request: Annotated[Optional[ActivateHardwareReservationRequest], Field(description="Note to attach to the reservation")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[HardwareReservation]: + """Activate a spare hardware reservation - >>> thread = api.activate_hardware_reservation_with_http_info(id, include, exclude, activate_hardware_reservation_request, async_req=True) - >>> result = thread.get() + Activate a spare hardware reservation :param id: Hardware Reservation UUID (required) :type id: str @@ -103,137 +155,243 @@ def activate_hardware_reservation_with_http_info(self, id : Annotated[StrictStr, :type exclude: List[str] :param activate_hardware_reservation_request: Note to attach to the reservation :type activate_hardware_reservation_request: ActivateHardwareReservationRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(HardwareReservation, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() + """ # noqa: E501 + + _param = self._activate_hardware_reservation_serialize( + id=id, + include=include, + exclude=exclude, + activate_hardware_reservation_request=activate_hardware_reservation_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _all_params = [ - 'id', - 'include', - 'exclude', - 'activate_hardware_reservation_request' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + _response_types_map: Dict[str, Optional[str]] = { + '201': "HardwareReservation", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method activate_hardware_reservation" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + @validate_call + def activate_hardware_reservation_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Hardware Reservation UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + activate_hardware_reservation_request: Annotated[Optional[ActivateHardwareReservationRequest], Field(description="Note to attach to the reservation")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Activate a spare hardware reservation - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + Activate a spare hardware reservation + :param id: Hardware Reservation UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param activate_hardware_reservation_request: Note to attach to the reservation + :type activate_hardware_reservation_request: ActivateHardwareReservationRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._activate_hardware_reservation_serialize( + id=id, + include=include, + exclude=exclude, + activate_hardware_reservation_request=activate_hardware_reservation_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _response_types_map: Dict[str, Optional[str]] = { + '201': "HardwareReservation", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _activate_hardware_reservation_serialize( + self, + id, + include, + exclude, + activate_hardware_reservation_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['activate_hardware_reservation_request'] is not None: - _body_params = _params['activate_hardware_reservation_request'] + if activate_hardware_reservation_request is not None: + _body_params = activate_hardware_reservation_request + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '201': "HardwareReservation", - '401': "Error", - '403': "Error", - '404': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/hardware-reservations/{id}/activate', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/hardware-reservations/{id}/activate', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_hardware_reservation_by_id(self, id : Annotated[StrictStr, Field(..., description="HardwareReservation UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> HardwareReservation: # noqa: E501 - """Retrieve a hardware reservation # noqa: E501 - Returns a single hardware reservation # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_hardware_reservation_by_id( + self, + id: Annotated[StrictStr, Field(description="HardwareReservation UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> HardwareReservation: + """Retrieve a hardware reservation - >>> thread = api.find_hardware_reservation_by_id(id, include, exclude, async_req=True) - >>> result = thread.get() + Returns a single hardware reservation :param id: HardwareReservation UUID (required) :type id: str @@ -241,32 +399,77 @@ def find_hardware_reservation_by_id(self, id : Annotated[StrictStr, Field(..., d :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: HardwareReservation - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_hardware_reservation_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_hardware_reservation_by_id_with_http_info(id, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def find_hardware_reservation_by_id_with_http_info(self, id : Annotated[StrictStr, Field(..., description="HardwareReservation UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve a hardware reservation # noqa: E501 + """ # noqa: E501 + + _param = self._find_hardware_reservation_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Returns a single hardware reservation # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "HardwareReservation", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_hardware_reservation_by_id_with_http_info( + self, + id: Annotated[StrictStr, Field(description="HardwareReservation UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[HardwareReservation]: + """Retrieve a hardware reservation - >>> thread = api.find_hardware_reservation_by_id_with_http_info(id, include, exclude, async_req=True) - >>> result = thread.get() + Returns a single hardware reservation :param id: HardwareReservation UUID (required) :type id: str @@ -274,118 +477,202 @@ def find_hardware_reservation_by_id_with_http_info(self, id : Annotated[StrictSt :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(HardwareReservation, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_hardware_reservation_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "HardwareReservation", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def find_hardware_reservation_by_id_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="HardwareReservation UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve a hardware reservation + + Returns a single hardware reservation + + :param id: HardwareReservation UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_hardware_reservation_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_hardware_reservation_by_id" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "HardwareReservation", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_hardware_reservation_by_id_serialize( + self, + id, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "HardwareReservation", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/hardware-reservations/{id}', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/hardware-reservations/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + - @validate_arguments - def find_project_hardware_reservations_all_pages(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], query : Annotated[Optional[StrictStr], Field(description="Search by facility code, plan name, project name, reservation short ID or device hostname")] = None, state : Annotated[Optional[StrictStr], Field(description="Filter by hardware reservation state")] = None, provisionable : Annotated[Optional[StrictStr], Field(description="Filter hardware reservation that is provisionable")] = None, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> HardwareReservationList: # noqa: E501 + @validate_call + def find_project_hardware_reservations_all_pages(self, id : Annotated[StrictStr, Field(description="Project UUID")], query : Annotated[Optional[StrictStr], Field(description="Search by facility code, plan name, project name, reservation short ID or device hostname")] = None, state : Annotated[Optional[StrictStr], Field(description="Filter by hardware reservation state")] = None, provisionable : Annotated[Optional[StrictStr], Field(description="Filter hardware reservation that is provisionable")] = None, include : Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, per_page : Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, **kwargs) -> HardwareReservationList: # noqa: E501 """Retrieve all hardware reservations for a given project # noqa: E501 This method is the same as find_project_hardware_reservations, but fetches resources from all the pages. @@ -445,19 +732,36 @@ def find_project_hardware_reservations_all_pages(self, id : Annotated[StrictStr, if page_response.meta.next is None: break page += 1 - - return all_pages - @validate_arguments - def find_project_hardware_reservations(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], query : Annotated[Optional[StrictStr], Field(description="Search by facility code, plan name, project name, reservation short ID or device hostname")] = None, state : Annotated[Optional[StrictStr], Field(description="Filter by hardware reservation state")] = None, provisionable : Annotated[Optional[StrictStr], Field(description="Filter hardware reservation that is provisionable")] = None, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> HardwareReservationList: # noqa: E501 - """Retrieve all hardware reservations for a given project # noqa: E501 + return all_pages - Provides a collection of hardware reservations for a given project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_project_hardware_reservations( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + query: Annotated[Optional[StrictStr], Field(description="Search by facility code, plan name, project name, reservation short ID or device hostname")] = None, + state: Annotated[Optional[StrictStr], Field(description="Filter by hardware reservation state")] = None, + provisionable: Annotated[Optional[StrictStr], Field(description="Filter hardware reservation that is provisionable")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> HardwareReservationList: + """Retrieve all hardware reservations for a given project - >>> thread = api.find_project_hardware_reservations(id, query, state, provisionable, include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + Provides a collection of hardware reservations for a given project. :param id: Project UUID (required) :type id: str @@ -475,32 +779,87 @@ def find_project_hardware_reservations(self, id : Annotated[StrictStr, Field(... :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: HardwareReservationList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_project_hardware_reservations_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_project_hardware_reservations_with_http_info(id, query, state, provisionable, include, exclude, page, per_page, **kwargs) # noqa: E501 - - @validate_arguments - def find_project_hardware_reservations_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], query : Annotated[Optional[StrictStr], Field(description="Search by facility code, plan name, project name, reservation short ID or device hostname")] = None, state : Annotated[Optional[StrictStr], Field(description="Filter by hardware reservation state")] = None, provisionable : Annotated[Optional[StrictStr], Field(description="Filter hardware reservation that is provisionable")] = None, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve all hardware reservations for a given project # noqa: E501 + """ # noqa: E501 + + _param = self._find_project_hardware_reservations_serialize( + id=id, + query=query, + state=state, + provisionable=provisionable, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Provides a collection of hardware reservations for a given project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "HardwareReservationList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_project_hardware_reservations_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + query: Annotated[Optional[StrictStr], Field(description="Search by facility code, plan name, project name, reservation short ID or device hostname")] = None, + state: Annotated[Optional[StrictStr], Field(description="Filter by hardware reservation state")] = None, + provisionable: Annotated[Optional[StrictStr], Field(description="Filter hardware reservation that is provisionable")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[HardwareReservationList]: + """Retrieve all hardware reservations for a given project - >>> thread = api.find_project_hardware_reservations_with_http_info(id, query, state, provisionable, include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + Provides a collection of hardware reservations for a given project. :param id: Project UUID (required) :type id: str @@ -518,146 +877,273 @@ def find_project_hardware_reservations_with_http_info(self, id : Annotated[Stric :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(HardwareReservationList, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'id', - 'query', - 'state', - 'provisionable', - 'include', - 'exclude', - 'page', - 'per_page' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + """ # noqa: E501 + + _param = self._find_project_hardware_reservations_serialize( + id=id, + query=query, + state=state, + provisionable=provisionable, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_project_hardware_reservations" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] - - - # process the query parameters - _query_params = [] - if _params.get('query') is not None: # noqa: E501 - _query_params.append(('query', _params['query'])) + _response_types_map: Dict[str, Optional[str]] = { + '200': "HardwareReservationList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - if _params.get('state') is not None: # noqa: E501 - _query_params.append(('state', _params['state'])) - if _params.get('provisionable') is not None: # noqa: E501 - _query_params.append(('provisionable', _params['provisionable'])) + @validate_call + def find_project_hardware_reservations_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + query: Annotated[Optional[StrictStr], Field(description="Search by facility code, plan name, project name, reservation short ID or device hostname")] = None, + state: Annotated[Optional[StrictStr], Field(description="Filter by hardware reservation state")] = None, + provisionable: Annotated[Optional[StrictStr], Field(description="Filter hardware reservation that is provisionable")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all hardware reservations for a given project - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + Provides a collection of hardware reservations for a given project. - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + :param id: Project UUID (required) + :type id: str + :param query: Search by facility code, plan name, project name, reservation short ID or device hostname + :type query: str + :param state: Filter by hardware reservation state + :type state: str + :param provisionable: Filter hardware reservation that is provisionable + :type provisionable: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param page: Page to return + :type page: int + :param per_page: Items returned per page + :type per_page: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_project_hardware_reservations_serialize( + id=id, + query=query, + state=state, + provisionable=provisionable, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - if _params.get('page') is not None: # noqa: E501 - _query_params.append(('page', _params['page'])) + _response_types_map: Dict[str, Optional[str]] = { + '200': "HardwareReservationList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _find_project_hardware_reservations_serialize( + self, + id, + query, + state, + provisionable, + include, + exclude, + page, + per_page, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('per_page') is not None: # noqa: E501 - _query_params.append(('per_page', _params['per_page'])) + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if query is not None: + + _query_params.append(('query', query)) + + if state is not None: + + _query_params.append(('state', state)) + + if provisionable is not None: + + _query_params.append(('provisionable', provisionable)) + + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + + if page is not None: + + _query_params.append(('page', page)) + + if per_page is not None: + + _query_params.append(('per_page', per_page)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "HardwareReservationList", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{id}/hardware-reservations', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/projects/{id}/hardware-reservations', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def move_hardware_reservation(self, id : Annotated[StrictStr, Field(..., description="Hardware Reservation UUID")], move_hardware_reservation_request : Annotated[MoveHardwareReservationRequest, Field(..., description="Destination Project UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> HardwareReservation: # noqa: E501 - """Move a hardware reservation # noqa: E501 - Move a hardware reservation to another project # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def move_hardware_reservation( + self, + id: Annotated[StrictStr, Field(description="Hardware Reservation UUID")], + move_hardware_reservation_request: Annotated[MoveHardwareReservationRequest, Field(description="Destination Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> HardwareReservation: + """Move a hardware reservation - >>> thread = api.move_hardware_reservation(id, move_hardware_reservation_request, include, exclude, async_req=True) - >>> result = thread.get() + Move a hardware reservation to another project :param id: Hardware Reservation UUID (required) :type id: str @@ -667,32 +1153,79 @@ def move_hardware_reservation(self, id : Annotated[StrictStr, Field(..., descrip :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: HardwareReservation - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the move_hardware_reservation_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.move_hardware_reservation_with_http_info(id, move_hardware_reservation_request, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def move_hardware_reservation_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Hardware Reservation UUID")], move_hardware_reservation_request : Annotated[MoveHardwareReservationRequest, Field(..., description="Destination Project UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Move a hardware reservation # noqa: E501 + """ # noqa: E501 + + _param = self._move_hardware_reservation_serialize( + id=id, + move_hardware_reservation_request=move_hardware_reservation_request, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Move a hardware reservation to another project # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '201': "HardwareReservation", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def move_hardware_reservation_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Hardware Reservation UUID")], + move_hardware_reservation_request: Annotated[MoveHardwareReservationRequest, Field(description="Destination Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[HardwareReservation]: + """Move a hardware reservation - >>> thread = api.move_hardware_reservation_with_http_info(id, move_hardware_reservation_request, include, exclude, async_req=True) - >>> result = thread.get() + Move a hardware reservation to another project :param id: Hardware Reservation UUID (required) :type id: str @@ -702,123 +1235,218 @@ def move_hardware_reservation_with_http_info(self, id : Annotated[StrictStr, Fie :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(HardwareReservation, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() + """ # noqa: E501 + + _param = self._move_hardware_reservation_serialize( + id=id, + move_hardware_reservation_request=move_hardware_reservation_request, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _all_params = [ - 'id', - 'move_hardware_reservation_request', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + _response_types_map: Dict[str, Optional[str]] = { + '201': "HardwareReservation", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method move_hardware_reservation" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + @validate_call + def move_hardware_reservation_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Hardware Reservation UUID")], + move_hardware_reservation_request: Annotated[MoveHardwareReservationRequest, Field(description="Destination Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Move a hardware reservation - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + Move a hardware reservation to another project + :param id: Hardware Reservation UUID (required) + :type id: str + :param move_hardware_reservation_request: Destination Project UUID (required) + :type move_hardware_reservation_request: MoveHardwareReservationRequest + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._move_hardware_reservation_serialize( + id=id, + move_hardware_reservation_request=move_hardware_reservation_request, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _response_types_map: Dict[str, Optional[str]] = { + '201': "HardwareReservation", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _move_hardware_reservation_serialize( + self, + id, + move_hardware_reservation_request, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['move_hardware_reservation_request'] is not None: - _body_params = _params['move_hardware_reservation_request'] + if move_hardware_reservation_request is not None: + _body_params = move_hardware_reservation_request + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '201': "HardwareReservation", - '401': "Error", - '403': "Error", - '404': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/hardware-reservations/{id}/move', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/hardware-reservations/{id}/move', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/incidents_api.py b/equinix_metal/equinix_metal/api/incidents_api.py index 334acc16..ac3071fa 100644 --- a/equinix_metal/equinix_metal/api/incidents_api.py +++ b/equinix_metal/equinix_metal/api/incidents_api.py @@ -12,182 +12,308 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictStr, conlist - -from typing import Optional - +from pydantic import Field, StrictStr +from typing import List, Optional +from typing_extensions import Annotated -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class IncidentsApi(object): +class IncidentsApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def find_incidents( + self, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Retrieve the number of incidents - @validate_arguments - def find_incidents(self, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> None: # noqa: E501 - """Retrieve the number of incidents # noqa: E501 - - Retrieve the number of incidents. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_incidents(include, exclude, async_req=True) - >>> result = thread.get() + Retrieve the number of incidents. :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_incidents_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_incidents_with_http_info(include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def find_incidents_with_http_info(self, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve the number of incidents # noqa: E501 - - Retrieve the number of incidents. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_incidents_with_http_info(include, exclude, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_incidents_serialize( + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_incidents_with_http_info( + self, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Retrieve the number of incidents + + Retrieve the number of incidents. :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 + + _param = self._find_incidents_serialize( + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def find_incidents_without_preload_content( + self, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve the number of incidents + + Retrieve the number of incidents. + + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_incidents_serialize( + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_incidents" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} + def _find_incidents_serialize( + self, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/incidents', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/incidents', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/interconnections_api.py b/equinix_metal/equinix_metal/api/interconnections_api.py index 8f430229..85e987d1 100644 --- a/equinix_metal/equinix_metal/api/interconnections_api.py +++ b/equinix_metal/equinix_metal/api/interconnections_api.py @@ -12,18 +12,14 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictStr, conint, conlist - -from typing import Optional - +from pydantic import Field, StrictStr +from typing import List, Optional +from typing_extensions import Annotated from equinix_metal.models.create_organization_interconnection_request import CreateOrganizationInterconnectionRequest from equinix_metal.models.interconnection import Interconnection from equinix_metal.models.interconnection_list import InterconnectionList @@ -37,36 +33,121 @@ from equinix_metal.models.virtual_circuit_list import VirtualCircuitList from equinix_metal.models.virtual_circuit_update_input import VirtualCircuitUpdateInput -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class InterconnectionsApi(object): +class InterconnectionsApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def create_interconnection_port_virtual_circuit( + self, + connection_id: Annotated[StrictStr, Field(description="UUID of the interconnection")], + port_id: Annotated[StrictStr, Field(description="UUID of the interconnection port")], + virtual_circuit_create_input: Annotated[VirtualCircuitCreateInput, Field(description="Virtual Circuit details")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VirtualCircuit: + """Create a new Virtual Circuit - @validate_arguments - def create_interconnection_port_virtual_circuit(self, connection_id : Annotated[StrictStr, Field(..., description="UUID of the interconnection")], port_id : Annotated[StrictStr, Field(..., description="UUID of the interconnection port")], virtual_circuit_create_input : Annotated[VirtualCircuitCreateInput, Field(..., description="Virtual Circuit details")], **kwargs) -> VirtualCircuit: # noqa: E501 - """Create a new Virtual Circuit # noqa: E501 + Create a new Virtual Circuit on a Dedicated Port. To create a regular Virtual Circuit, specify a Virtual Network record and an NNI VLAN value. To create a VRF-based Virtual Circuit, specify the VRF ID and subnet, along with the NNI VLAN value. - Create a new Virtual Circuit on a Dedicated Port. To create a regular Virtual Circuit, specify a Virtual Network record and an NNI VLAN value. To create a VRF-based Virtual Circuit, specify the VRF ID and subnet, along with the NNI VLAN value. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + :param connection_id: UUID of the interconnection (required) + :type connection_id: str + :param port_id: UUID of the interconnection port (required) + :type port_id: str + :param virtual_circuit_create_input: Virtual Circuit details (required) + :type virtual_circuit_create_input: VirtualCircuitCreateInput + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_interconnection_port_virtual_circuit_serialize( + connection_id=connection_id, + port_id=port_id, + virtual_circuit_create_input=virtual_circuit_create_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - >>> thread = api.create_interconnection_port_virtual_circuit(connection_id, port_id, virtual_circuit_create_input, async_req=True) - >>> result = thread.get() + _response_types_map: Dict[str, Optional[str]] = { + '201': "VirtualCircuit", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_interconnection_port_virtual_circuit_with_http_info( + self, + connection_id: Annotated[StrictStr, Field(description="UUID of the interconnection")], + port_id: Annotated[StrictStr, Field(description="UUID of the interconnection port")], + virtual_circuit_create_input: Annotated[VirtualCircuitCreateInput, Field(description="Virtual Circuit details")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VirtualCircuit]: + """Create a new Virtual Circuit + + Create a new Virtual Circuit on a Dedicated Port. To create a regular Virtual Circuit, specify a Virtual Network record and an NNI VLAN value. To create a VRF-based Virtual Circuit, specify the VRF ID and subnet, along with the NNI VLAN value. :param connection_id: UUID of the interconnection (required) :type connection_id: str @@ -74,32 +155,76 @@ def create_interconnection_port_virtual_circuit(self, connection_id : Annotated[ :type port_id: str :param virtual_circuit_create_input: Virtual Circuit details (required) :type virtual_circuit_create_input: VirtualCircuitCreateInput - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: VirtualCircuit - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the create_interconnection_port_virtual_circuit_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.create_interconnection_port_virtual_circuit_with_http_info(connection_id, port_id, virtual_circuit_create_input, **kwargs) # noqa: E501 + """ # noqa: E501 + + _param = self._create_interconnection_port_virtual_circuit_serialize( + connection_id=connection_id, + port_id=port_id, + virtual_circuit_create_input=virtual_circuit_create_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - @validate_arguments - def create_interconnection_port_virtual_circuit_with_http_info(self, connection_id : Annotated[StrictStr, Field(..., description="UUID of the interconnection")], port_id : Annotated[StrictStr, Field(..., description="UUID of the interconnection port")], virtual_circuit_create_input : Annotated[VirtualCircuitCreateInput, Field(..., description="Virtual Circuit details")], **kwargs) -> ApiResponse: # noqa: E501 - """Create a new Virtual Circuit # noqa: E501 + _response_types_map: Dict[str, Optional[str]] = { + '201': "VirtualCircuit", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - Create a new Virtual Circuit on a Dedicated Port. To create a regular Virtual Circuit, specify a Virtual Network record and an NNI VLAN value. To create a VRF-based Virtual Circuit, specify the VRF ID and subnet, along with the NNI VLAN value. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_interconnection_port_virtual_circuit_with_http_info(connection_id, port_id, virtual_circuit_create_input, async_req=True) - >>> result = thread.get() + @validate_call + def create_interconnection_port_virtual_circuit_without_preload_content( + self, + connection_id: Annotated[StrictStr, Field(description="UUID of the interconnection")], + port_id: Annotated[StrictStr, Field(description="UUID of the interconnection port")], + virtual_circuit_create_input: Annotated[VirtualCircuitCreateInput, Field(description="Virtual Circuit details")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a new Virtual Circuit + + Create a new Virtual Circuit on a Dedicated Port. To create a regular Virtual Circuit, specify a Virtual Network record and an NNI VLAN value. To create a VRF-based Virtual Circuit, specify the VRF ID and subnet, along with the NNI VLAN value. :param connection_id: UUID of the interconnection (required) :type connection_id: str @@ -107,130 +232,151 @@ def create_interconnection_port_virtual_circuit_with_http_info(self, connection_ :type port_id: str :param virtual_circuit_create_input: Virtual Circuit details (required) :type virtual_circuit_create_input: VirtualCircuitCreateInput - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(VirtualCircuit, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._create_interconnection_port_virtual_circuit_serialize( + connection_id=connection_id, + port_id=port_id, + virtual_circuit_create_input=virtual_circuit_create_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '201': "VirtualCircuit", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _all_params = [ - 'connection_id', - 'port_id', - 'virtual_circuit_create_input' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_interconnection_port_virtual_circuit" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + def _create_interconnection_port_virtual_circuit_serialize( + self, + connection_id, + port_id, + virtual_circuit_create_input, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the path parameters - _path_params = {} - if _params['connection_id']: - _path_params['connection_id'] = _params['connection_id'] + _host = None - if _params['port_id']: - _path_params['port_id'] = _params['port_id'] + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if connection_id is not None: + _path_params['connection_id'] = connection_id + if port_id is not None: + _path_params['port_id'] = port_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['virtual_circuit_create_input'] is not None: - _body_params = _params['virtual_circuit_create_input'] + if virtual_circuit_create_input is not None: + _body_params = virtual_circuit_create_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '201': "VirtualCircuit", - '403': "Error", - '404': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/connections/{connection_id}/ports/{port_id}/virtual-circuits', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/connections/{connection_id}/ports/{port_id}/virtual-circuits', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def create_organization_interconnection(self, organization_id : Annotated[StrictStr, Field(..., description="UUID of the organization")], create_organization_interconnection_request : Annotated[CreateOrganizationInterconnectionRequest, Field(..., description="Dedicated port or shared interconnection (also known as Fabric VC) creation request. Shared interconnections can be created with the following request types: * `VlanCSPConnectionCreateInput` creates a layer 2 interconnection directly to your Cloud Service Provider. * `SharedPortVCVlanCreateInput` creates a layer 2 interconnection that you can finish configuration in Fabric. For new connections, this type is preferred to `VlanFabricVCCreateInput`. * `VlanFabricVCCreateInput` creates a layer 2 interconnection that you can connect through Fabric with a service token. * `VrfFabricVCCreateInput` creates a layer 3 interconnection that you can connect through Fabric with a service token. ")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> Interconnection: # noqa: E501 - """Request a new interconnection for the organization # noqa: E501 - Creates a new interconnection request. A Project ID must be specified in the request body for connections on shared ports. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def create_organization_interconnection( + self, + organization_id: Annotated[StrictStr, Field(description="UUID of the organization")], + create_organization_interconnection_request: Annotated[CreateOrganizationInterconnectionRequest, Field(description="Dedicated port or shared interconnection (also known as Fabric VC) creation request. Shared interconnections can be created with the following request types: * `VlanCSPConnectionCreateInput` creates a layer 2 interconnection directly to your Cloud Service Provider. * `SharedPortVCVlanCreateInput` creates a layer 2 interconnection that you can finish configuration in Fabric. For new connections, this type is preferred to `VlanFabricVCCreateInput`. * `VlanFabricVCCreateInput` creates a layer 2 interconnection that you can connect through Fabric with a service token. * `VrfFabricVCCreateInput` creates a layer 3 interconnection that you can connect through Fabric with a service token. ")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Interconnection: + """Request a new interconnection for the organization - >>> thread = api.create_organization_interconnection(organization_id, create_organization_interconnection_request, include, exclude, async_req=True) - >>> result = thread.get() + Creates a new interconnection request. A Project ID must be specified in the request body for connections on shared ports. :param organization_id: UUID of the organization (required) :type organization_id: str @@ -240,32 +386,79 @@ def create_organization_interconnection(self, organization_id : Annotated[Strict :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Interconnection - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the create_organization_interconnection_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.create_organization_interconnection_with_http_info(organization_id, create_organization_interconnection_request, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def create_organization_interconnection_with_http_info(self, organization_id : Annotated[StrictStr, Field(..., description="UUID of the organization")], create_organization_interconnection_request : Annotated[CreateOrganizationInterconnectionRequest, Field(..., description="Dedicated port or shared interconnection (also known as Fabric VC) creation request. Shared interconnections can be created with the following request types: * `VlanCSPConnectionCreateInput` creates a layer 2 interconnection directly to your Cloud Service Provider. * `SharedPortVCVlanCreateInput` creates a layer 2 interconnection that you can finish configuration in Fabric. For new connections, this type is preferred to `VlanFabricVCCreateInput`. * `VlanFabricVCCreateInput` creates a layer 2 interconnection that you can connect through Fabric with a service token. * `VrfFabricVCCreateInput` creates a layer 3 interconnection that you can connect through Fabric with a service token. ")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Request a new interconnection for the organization # noqa: E501 + """ # noqa: E501 + + _param = self._create_organization_interconnection_serialize( + organization_id=organization_id, + create_organization_interconnection_request=create_organization_interconnection_request, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Creates a new interconnection request. A Project ID must be specified in the request body for connections on shared ports. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '201': "Interconnection", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_organization_interconnection_with_http_info( + self, + organization_id: Annotated[StrictStr, Field(description="UUID of the organization")], + create_organization_interconnection_request: Annotated[CreateOrganizationInterconnectionRequest, Field(description="Dedicated port or shared interconnection (also known as Fabric VC) creation request. Shared interconnections can be created with the following request types: * `VlanCSPConnectionCreateInput` creates a layer 2 interconnection directly to your Cloud Service Provider. * `SharedPortVCVlanCreateInput` creates a layer 2 interconnection that you can finish configuration in Fabric. For new connections, this type is preferred to `VlanFabricVCCreateInput`. * `VlanFabricVCCreateInput` creates a layer 2 interconnection that you can connect through Fabric with a service token. * `VrfFabricVCCreateInput` creates a layer 3 interconnection that you can connect through Fabric with a service token. ")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Interconnection]: + """Request a new interconnection for the organization - >>> thread = api.create_organization_interconnection_with_http_info(organization_id, create_organization_interconnection_request, include, exclude, async_req=True) - >>> result = thread.get() + Creates a new interconnection request. A Project ID must be specified in the request body for connections on shared ports. :param organization_id: UUID of the organization (required) :type organization_id: str @@ -275,137 +468,244 @@ def create_organization_interconnection_with_http_info(self, organization_id : A :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Interconnection, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._create_organization_interconnection_serialize( + organization_id=organization_id, + create_organization_interconnection_request=create_organization_interconnection_request, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '201': "Interconnection", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'organization_id', - 'create_organization_interconnection_request', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_organization_interconnection" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + @validate_call + def create_organization_interconnection_without_preload_content( + self, + organization_id: Annotated[StrictStr, Field(description="UUID of the organization")], + create_organization_interconnection_request: Annotated[CreateOrganizationInterconnectionRequest, Field(description="Dedicated port or shared interconnection (also known as Fabric VC) creation request. Shared interconnections can be created with the following request types: * `VlanCSPConnectionCreateInput` creates a layer 2 interconnection directly to your Cloud Service Provider. * `SharedPortVCVlanCreateInput` creates a layer 2 interconnection that you can finish configuration in Fabric. For new connections, this type is preferred to `VlanFabricVCCreateInput`. * `VlanFabricVCCreateInput` creates a layer 2 interconnection that you can connect through Fabric with a service token. * `VrfFabricVCCreateInput` creates a layer 3 interconnection that you can connect through Fabric with a service token. ")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Request a new interconnection for the organization - # process the path parameters - _path_params = {} - if _params['organization_id']: - _path_params['organization_id'] = _params['organization_id'] + Creates a new interconnection request. A Project ID must be specified in the request body for connections on shared ports. + :param organization_id: UUID of the organization (required) + :type organization_id: str + :param create_organization_interconnection_request: Dedicated port or shared interconnection (also known as Fabric VC) creation request. Shared interconnections can be created with the following request types: * `VlanCSPConnectionCreateInput` creates a layer 2 interconnection directly to your Cloud Service Provider. * `SharedPortVCVlanCreateInput` creates a layer 2 interconnection that you can finish configuration in Fabric. For new connections, this type is preferred to `VlanFabricVCCreateInput`. * `VlanFabricVCCreateInput` creates a layer 2 interconnection that you can connect through Fabric with a service token. * `VrfFabricVCCreateInput` creates a layer 3 interconnection that you can connect through Fabric with a service token. (required) + :type create_organization_interconnection_request: CreateOrganizationInterconnectionRequest + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_organization_interconnection_serialize( + organization_id=organization_id, + create_organization_interconnection_request=create_organization_interconnection_request, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _response_types_map: Dict[str, Optional[str]] = { + '201': "Interconnection", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_organization_interconnection_serialize( + self, + organization_id, + create_organization_interconnection_request, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if organization_id is not None: + _path_params['organization_id'] = organization_id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['create_organization_interconnection_request'] is not None: - _body_params = _params['create_organization_interconnection_request'] + if create_organization_interconnection_request is not None: + _body_params = create_organization_interconnection_request + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '201': "Interconnection", - '403': "Error", - '404': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/organizations/{organization_id}/connections', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/organizations/{organization_id}/connections', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def create_project_interconnection(self, project_id : Annotated[StrictStr, Field(..., description="UUID of the project")], create_organization_interconnection_request : Annotated[CreateOrganizationInterconnectionRequest, Field(..., description="Dedicated port or shared interconnection (also known as Fabric VC) creation request. Shared interconnections can be created with the following request types: * `VlanCSPConnectionCreateInput` creates a layer 2 interconnection directly to your Cloud Service Provider. * `SharedPortVCVlanCreateInput` creates a layer 2 interconnection that you can finish configuration in Fabric. For new connections, this type is preferred to `VlanFabricVCCreateInput`. * `VlanFabricVCCreateInput` creates a layer 2 interconnection that you can connect through Fabric with a service token. * `VrfFabricVCCreateInput` creates a layer 3 interconnection that you can connect through Fabric with a service token. ")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> Interconnection: # noqa: E501 - """Request a new interconnection for the project's organization # noqa: E501 - Creates a new interconnection request # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def create_project_interconnection( + self, + project_id: Annotated[StrictStr, Field(description="UUID of the project")], + create_organization_interconnection_request: Annotated[CreateOrganizationInterconnectionRequest, Field(description="Dedicated port or shared interconnection (also known as Fabric VC) creation request. Shared interconnections can be created with the following request types: * `VlanCSPConnectionCreateInput` creates a layer 2 interconnection directly to your Cloud Service Provider. * `SharedPortVCVlanCreateInput` creates a layer 2 interconnection that you can finish configuration in Fabric. For new connections, this type is preferred to `VlanFabricVCCreateInput`. * `VlanFabricVCCreateInput` creates a layer 2 interconnection that you can connect through Fabric with a service token. * `VrfFabricVCCreateInput` creates a layer 3 interconnection that you can connect through Fabric with a service token. ")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Interconnection: + """Request a new interconnection for the project's organization - >>> thread = api.create_project_interconnection(project_id, create_organization_interconnection_request, include, exclude, async_req=True) - >>> result = thread.get() + Creates a new interconnection request :param project_id: UUID of the project (required) :type project_id: str @@ -415,32 +715,78 @@ def create_project_interconnection(self, project_id : Annotated[StrictStr, Field :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Interconnection - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the create_project_interconnection_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.create_project_interconnection_with_http_info(project_id, create_organization_interconnection_request, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def create_project_interconnection_with_http_info(self, project_id : Annotated[StrictStr, Field(..., description="UUID of the project")], create_organization_interconnection_request : Annotated[CreateOrganizationInterconnectionRequest, Field(..., description="Dedicated port or shared interconnection (also known as Fabric VC) creation request. Shared interconnections can be created with the following request types: * `VlanCSPConnectionCreateInput` creates a layer 2 interconnection directly to your Cloud Service Provider. * `SharedPortVCVlanCreateInput` creates a layer 2 interconnection that you can finish configuration in Fabric. For new connections, this type is preferred to `VlanFabricVCCreateInput`. * `VlanFabricVCCreateInput` creates a layer 2 interconnection that you can connect through Fabric with a service token. * `VrfFabricVCCreateInput` creates a layer 3 interconnection that you can connect through Fabric with a service token. ")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Request a new interconnection for the project's organization # noqa: E501 + """ # noqa: E501 + + _param = self._create_project_interconnection_serialize( + project_id=project_id, + create_organization_interconnection_request=create_organization_interconnection_request, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Creates a new interconnection request # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '201': "Interconnection", + '403': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_project_interconnection_with_http_info( + self, + project_id: Annotated[StrictStr, Field(description="UUID of the project")], + create_organization_interconnection_request: Annotated[CreateOrganizationInterconnectionRequest, Field(description="Dedicated port or shared interconnection (also known as Fabric VC) creation request. Shared interconnections can be created with the following request types: * `VlanCSPConnectionCreateInput` creates a layer 2 interconnection directly to your Cloud Service Provider. * `SharedPortVCVlanCreateInput` creates a layer 2 interconnection that you can finish configuration in Fabric. For new connections, this type is preferred to `VlanFabricVCCreateInput`. * `VlanFabricVCCreateInput` creates a layer 2 interconnection that you can connect through Fabric with a service token. * `VrfFabricVCCreateInput` creates a layer 3 interconnection that you can connect through Fabric with a service token. ")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Interconnection]: + """Request a new interconnection for the project's organization - >>> thread = api.create_project_interconnection_with_http_info(project_id, create_organization_interconnection_request, include, exclude, async_req=True) - >>> result = thread.get() + Creates a new interconnection request :param project_id: UUID of the project (required) :type project_id: str @@ -450,136 +796,241 @@ def create_project_interconnection_with_http_info(self, project_id : Annotated[S :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Interconnection, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._create_project_interconnection_serialize( + project_id=project_id, + create_organization_interconnection_request=create_organization_interconnection_request, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '201': "Interconnection", + '403': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'project_id', - 'create_organization_interconnection_request', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_project_interconnection" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + @validate_call + def create_project_interconnection_without_preload_content( + self, + project_id: Annotated[StrictStr, Field(description="UUID of the project")], + create_organization_interconnection_request: Annotated[CreateOrganizationInterconnectionRequest, Field(description="Dedicated port or shared interconnection (also known as Fabric VC) creation request. Shared interconnections can be created with the following request types: * `VlanCSPConnectionCreateInput` creates a layer 2 interconnection directly to your Cloud Service Provider. * `SharedPortVCVlanCreateInput` creates a layer 2 interconnection that you can finish configuration in Fabric. For new connections, this type is preferred to `VlanFabricVCCreateInput`. * `VlanFabricVCCreateInput` creates a layer 2 interconnection that you can connect through Fabric with a service token. * `VrfFabricVCCreateInput` creates a layer 3 interconnection that you can connect through Fabric with a service token. ")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Request a new interconnection for the project's organization - # process the path parameters - _path_params = {} - if _params['project_id']: - _path_params['project_id'] = _params['project_id'] + Creates a new interconnection request + :param project_id: UUID of the project (required) + :type project_id: str + :param create_organization_interconnection_request: Dedicated port or shared interconnection (also known as Fabric VC) creation request. Shared interconnections can be created with the following request types: * `VlanCSPConnectionCreateInput` creates a layer 2 interconnection directly to your Cloud Service Provider. * `SharedPortVCVlanCreateInput` creates a layer 2 interconnection that you can finish configuration in Fabric. For new connections, this type is preferred to `VlanFabricVCCreateInput`. * `VlanFabricVCCreateInput` creates a layer 2 interconnection that you can connect through Fabric with a service token. * `VrfFabricVCCreateInput` creates a layer 3 interconnection that you can connect through Fabric with a service token. (required) + :type create_organization_interconnection_request: CreateOrganizationInterconnectionRequest + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_project_interconnection_serialize( + project_id=project_id, + create_organization_interconnection_request=create_organization_interconnection_request, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _response_types_map: Dict[str, Optional[str]] = { + '201': "Interconnection", + '403': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_project_interconnection_serialize( + self, + project_id, + create_organization_interconnection_request, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if project_id is not None: + _path_params['project_id'] = project_id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['create_organization_interconnection_request'] is not None: - _body_params = _params['create_organization_interconnection_request'] + if create_organization_interconnection_request is not None: + _body_params = create_organization_interconnection_request + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '201': "Interconnection", - '403': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{project_id}/connections', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/projects/{project_id}/connections', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def delete_interconnection(self, connection_id : Annotated[StrictStr, Field(..., description="Interconnection UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> Interconnection: # noqa: E501 - """Delete interconnection # noqa: E501 - Delete a interconnection, its associated ports and virtual circuits. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def delete_interconnection( + self, + connection_id: Annotated[StrictStr, Field(description="Interconnection UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Interconnection: + """Delete interconnection - >>> thread = api.delete_interconnection(connection_id, include, exclude, async_req=True) - >>> result = thread.get() + Delete a interconnection, its associated ports and virtual circuits. :param connection_id: Interconnection UUID (required) :type connection_id: str @@ -587,32 +1038,76 @@ def delete_interconnection(self, connection_id : Annotated[StrictStr, Field(..., :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Interconnection - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the delete_interconnection_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.delete_interconnection_with_http_info(connection_id, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def delete_interconnection_with_http_info(self, connection_id : Annotated[StrictStr, Field(..., description="Interconnection UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Delete interconnection # noqa: E501 + """ # noqa: E501 + + _param = self._delete_interconnection_serialize( + connection_id=connection_id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Delete a interconnection, its associated ports and virtual circuits. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '202': "Interconnection", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_interconnection_with_http_info( + self, + connection_id: Annotated[StrictStr, Field(description="Interconnection UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Interconnection]: + """Delete interconnection - >>> thread = api.delete_interconnection_with_http_info(connection_id, include, exclude, async_req=True) - >>> result = thread.get() + Delete a interconnection, its associated ports and virtual circuits. :param connection_id: Interconnection UUID (required) :type connection_id: str @@ -620,125 +1115,220 @@ def delete_interconnection_with_http_info(self, connection_id : Annotated[Strict :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Interconnection, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._delete_interconnection_serialize( + connection_id=connection_id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '202': "Interconnection", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'connection_id', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_interconnection" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + @validate_call + def delete_interconnection_without_preload_content( + self, + connection_id: Annotated[StrictStr, Field(description="Interconnection UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete interconnection - # process the path parameters - _path_params = {} - if _params['connection_id']: - _path_params['connection_id'] = _params['connection_id'] + Delete a interconnection, its associated ports and virtual circuits. + + :param connection_id: Interconnection UUID (required) + :type connection_id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_interconnection_serialize( + connection_id=connection_id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': "Interconnection", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + def _delete_interconnection_serialize( + self, + connection_id, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if connection_id is not None: + _path_params['connection_id'] = connection_id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '202': "Interconnection", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/connections/{connection_id}', 'DELETE', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='DELETE', + resource_path='/connections/{connection_id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def delete_virtual_circuit(self, id : Annotated[StrictStr, Field(..., description="Virtual Circuit UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> VirtualCircuit: # noqa: E501 - """Delete a virtual circuit # noqa: E501 - Delete a virtual circuit from a Dedicated Port. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def delete_virtual_circuit( + self, + id: Annotated[StrictStr, Field(description="Virtual Circuit UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VirtualCircuit: + """Delete a virtual circuit - >>> thread = api.delete_virtual_circuit(id, include, exclude, async_req=True) - >>> result = thread.get() + Delete a virtual circuit from a Dedicated Port. :param id: Virtual Circuit UUID (required) :type id: str @@ -746,32 +1336,76 @@ def delete_virtual_circuit(self, id : Annotated[StrictStr, Field(..., descriptio :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: VirtualCircuit - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the delete_virtual_circuit_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.delete_virtual_circuit_with_http_info(id, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def delete_virtual_circuit_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Virtual Circuit UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Delete a virtual circuit # noqa: E501 + """ # noqa: E501 + + _param = self._delete_virtual_circuit_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Delete a virtual circuit from a Dedicated Port. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '202': "VirtualCircuit", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_virtual_circuit_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Virtual Circuit UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VirtualCircuit]: + """Delete a virtual circuit - >>> thread = api.delete_virtual_circuit_with_http_info(id, include, exclude, async_req=True) - >>> result = thread.get() + Delete a virtual circuit from a Dedicated Port. :param id: Virtual Circuit UUID (required) :type id: str @@ -779,125 +1413,220 @@ def delete_virtual_circuit_with_http_info(self, id : Annotated[StrictStr, Field( :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(VirtualCircuit, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._delete_virtual_circuit_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': "VirtualCircuit", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_virtual_circuit" % _key - ) - _params[_key] = _val - del _params['kwargs'] + @validate_call + def delete_virtual_circuit_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Virtual Circuit UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete a virtual circuit - _collection_formats = {} + Delete a virtual circuit from a Dedicated Port. - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + :param id: Virtual Circuit UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_virtual_circuit_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': "VirtualCircuit", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + def _delete_virtual_circuit_serialize( + self, + id, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _host = None + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '202': "VirtualCircuit", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/virtual-circuits/{id}', 'DELETE', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='DELETE', + resource_path='/virtual-circuits/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def get_interconnection(self, connection_id : Annotated[StrictStr, Field(..., description="Interconnection UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> Interconnection: # noqa: E501 - """Get interconnection # noqa: E501 - Get the details of a interconnection # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def get_interconnection( + self, + connection_id: Annotated[StrictStr, Field(description="Interconnection UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Interconnection: + """Get interconnection - >>> thread = api.get_interconnection(connection_id, include, exclude, async_req=True) - >>> result = thread.get() + Get the details of a interconnection :param connection_id: Interconnection UUID (required) :type connection_id: str @@ -905,32 +1634,76 @@ def get_interconnection(self, connection_id : Annotated[StrictStr, Field(..., de :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Interconnection - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the get_interconnection_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.get_interconnection_with_http_info(connection_id, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def get_interconnection_with_http_info(self, connection_id : Annotated[StrictStr, Field(..., description="Interconnection UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Get interconnection # noqa: E501 + """ # noqa: E501 + + _param = self._get_interconnection_serialize( + connection_id=connection_id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Get the details of a interconnection # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "Interconnection", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_interconnection_with_http_info( + self, + connection_id: Annotated[StrictStr, Field(description="Interconnection UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Interconnection]: + """Get interconnection - >>> thread = api.get_interconnection_with_http_info(connection_id, include, exclude, async_req=True) - >>> result = thread.get() + Get the details of a interconnection :param connection_id: Interconnection UUID (required) :type connection_id: str @@ -938,258 +1711,468 @@ def get_interconnection_with_http_info(self, connection_id : Annotated[StrictStr :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Interconnection, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._get_interconnection_serialize( + connection_id=connection_id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "Interconnection", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'connection_id', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_interconnection" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + @validate_call + def get_interconnection_without_preload_content( + self, + connection_id: Annotated[StrictStr, Field(description="Interconnection UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get interconnection - # process the path parameters - _path_params = {} - if _params['connection_id']: - _path_params['connection_id'] = _params['connection_id'] + Get the details of a interconnection + :param connection_id: Interconnection UUID (required) + :type connection_id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_interconnection_serialize( + connection_id=connection_id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _response_types_map: Dict[str, Optional[str]] = { + '200': "Interconnection", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_interconnection_serialize( + self, + connection_id, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if connection_id is not None: + _path_params['connection_id'] = connection_id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "Interconnection", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/connections/{connection_id}', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/connections/{connection_id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def get_interconnection_metros(self, **kwargs) -> InterconnectionMetroList: # noqa: E501 - """Get connectivity to network provider by metro # noqa: E501 - Displays which providers you can connect to directly from Equinix Metal Metros. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def get_interconnection_metros( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> InterconnectionMetroList: + """Get connectivity to network provider by metro - >>> thread = api.get_interconnection_metros(async_req=True) - >>> result = thread.get() + Displays which providers you can connect to directly from Equinix Metal Metros. - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: InterconnectionMetroList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the get_interconnection_metros_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.get_interconnection_metros_with_http_info(**kwargs) # noqa: E501 + """ # noqa: E501 - @validate_arguments - def get_interconnection_metros_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 - """Get connectivity to network provider by metro # noqa: E501 + _param = self._get_interconnection_metros_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Displays which providers you can connect to directly from Equinix Metal Metros. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "InterconnectionMetroList", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_interconnection_metros_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[InterconnectionMetroList]: + """Get connectivity to network provider by metro - >>> thread = api.get_interconnection_metros_with_http_info(async_req=True) - >>> result = thread.get() + Displays which providers you can connect to directly from Equinix Metal Metros. - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(InterconnectionMetroList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 - _params = locals() + _param = self._get_interconnection_metros_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _all_params = [ - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_interconnection_metros" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "InterconnectionMetroList", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} - # process the path parameters - _path_params = {} + @validate_call + def get_interconnection_metros_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get connectivity to network provider by metro + + Displays which providers you can connect to directly from Equinix Metal Metros. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_interconnection_metros_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "InterconnectionMetroList", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_interconnection_metros_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "InterconnectionMetroList", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/connections/metros', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/connections/metros', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def get_interconnection_port(self, connection_id : Annotated[StrictStr, Field(..., description="UUID of the interconnection")], id : Annotated[StrictStr, Field(..., description="Port UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> InterconnectionPort: # noqa: E501 - """Get a interconnection port # noqa: E501 - Get the details of an interconnection port. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def get_interconnection_port( + self, + connection_id: Annotated[StrictStr, Field(description="UUID of the interconnection")], + id: Annotated[StrictStr, Field(description="Port UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> InterconnectionPort: + """Get a interconnection port - >>> thread = api.get_interconnection_port(connection_id, id, include, exclude, async_req=True) - >>> result = thread.get() + Get the details of an interconnection port. :param connection_id: UUID of the interconnection (required) :type connection_id: str @@ -1199,32 +2182,78 @@ def get_interconnection_port(self, connection_id : Annotated[StrictStr, Field(.. :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: InterconnectionPort - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the get_interconnection_port_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.get_interconnection_port_with_http_info(connection_id, id, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def get_interconnection_port_with_http_info(self, connection_id : Annotated[StrictStr, Field(..., description="UUID of the interconnection")], id : Annotated[StrictStr, Field(..., description="Port UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Get a interconnection port # noqa: E501 + """ # noqa: E501 + + _param = self._get_interconnection_port_serialize( + connection_id=connection_id, + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Get the details of an interconnection port. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "InterconnectionPort", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_interconnection_port_with_http_info( + self, + connection_id: Annotated[StrictStr, Field(description="UUID of the interconnection")], + id: Annotated[StrictStr, Field(description="Port UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[InterconnectionPort]: + """Get a interconnection port - >>> thread = api.get_interconnection_port_with_http_info(connection_id, id, include, exclude, async_req=True) - >>> result = thread.get() + Get the details of an interconnection port. :param connection_id: UUID of the interconnection (required) :type connection_id: str @@ -1234,262 +2263,475 @@ def get_interconnection_port_with_http_info(self, connection_id : Annotated[Stri :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(InterconnectionPort, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() + """ # noqa: E501 + + _param = self._get_interconnection_port_serialize( + connection_id=connection_id, + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _all_params = [ - 'connection_id', - 'id', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_interconnection_port" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "InterconnectionPort", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['connection_id']: - _path_params['connection_id'] = _params['connection_id'] + @validate_call + def get_interconnection_port_without_preload_content( + self, + connection_id: Annotated[StrictStr, Field(description="UUID of the interconnection")], + id: Annotated[StrictStr, Field(description="Port UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get a interconnection port - if _params['id']: - _path_params['id'] = _params['id'] + Get the details of an interconnection port. + :param connection_id: UUID of the interconnection (required) + :type connection_id: str + :param id: Port UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_interconnection_port_serialize( + connection_id=connection_id, + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _response_types_map: Dict[str, Optional[str]] = { + '200': "InterconnectionPort", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_interconnection_port_serialize( + self, + connection_id, + id, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if connection_id is not None: + _path_params['connection_id'] = connection_id + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "InterconnectionPort", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/connections/{connection_id}/ports/{id}', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/connections/{connection_id}/ports/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def get_interconnection_pricing(self, **kwargs) -> InterconnectionPricingList: # noqa: E501 - """Get Interconnection Pricing # noqa: E501 - Displays pricing information for connecting to networks outside of Equinix. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def get_interconnection_pricing( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> InterconnectionPricingList: + """Get Interconnection Pricing - >>> thread = api.get_interconnection_pricing(async_req=True) - >>> result = thread.get() + Displays pricing information for connecting to networks outside of Equinix. - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: InterconnectionPricingList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the get_interconnection_pricing_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.get_interconnection_pricing_with_http_info(**kwargs) # noqa: E501 + """ # noqa: E501 - @validate_arguments - def get_interconnection_pricing_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 - """Get Interconnection Pricing # noqa: E501 + _param = self._get_interconnection_pricing_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Displays pricing information for connecting to networks outside of Equinix. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "InterconnectionPricingList", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_interconnection_pricing_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[InterconnectionPricingList]: + """Get Interconnection Pricing - >>> thread = api.get_interconnection_pricing_with_http_info(async_req=True) - >>> result = thread.get() + Displays pricing information for connecting to networks outside of Equinix. - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(InterconnectionPricingList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 - _params = locals() + _param = self._get_interconnection_pricing_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _all_params = [ - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_interconnection_pricing" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "InterconnectionPricingList", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} - # process the path parameters - _path_params = {} + @validate_call + def get_interconnection_pricing_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Interconnection Pricing + + Displays pricing information for connecting to networks outside of Equinix. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_interconnection_pricing_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "InterconnectionPricingList", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_interconnection_pricing_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "InterconnectionPricingList", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/connections/prices', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/connections/prices', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def get_virtual_circuit(self, id : Annotated[StrictStr, Field(..., description="Virtual Circuit UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> VirtualCircuit: # noqa: E501 - """Get a virtual circuit # noqa: E501 - Get the details of a virtual circuit # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def get_virtual_circuit( + self, + id: Annotated[StrictStr, Field(description="Virtual Circuit UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VirtualCircuit: + """Get a virtual circuit - >>> thread = api.get_virtual_circuit(id, include, exclude, async_req=True) - >>> result = thread.get() + Get the details of a virtual circuit :param id: Virtual Circuit UUID (required) :type id: str @@ -1497,32 +2739,76 @@ def get_virtual_circuit(self, id : Annotated[StrictStr, Field(..., description=" :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: VirtualCircuit - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the get_virtual_circuit_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.get_virtual_circuit_with_http_info(id, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def get_virtual_circuit_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Virtual Circuit UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Get a virtual circuit # noqa: E501 + """ # noqa: E501 + + _param = self._get_virtual_circuit_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Get the details of a virtual circuit # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "VirtualCircuit", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_virtual_circuit_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Virtual Circuit UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VirtualCircuit]: + """Get a virtual circuit - >>> thread = api.get_virtual_circuit_with_http_info(id, include, exclude, async_req=True) - >>> result = thread.get() + Get the details of a virtual circuit :param id: Virtual Circuit UUID (required) :type id: str @@ -1530,125 +2816,221 @@ def get_virtual_circuit_with_http_info(self, id : Annotated[StrictStr, Field(... :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(VirtualCircuit, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._get_virtual_circuit_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "VirtualCircuit", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_virtual_circuit" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + @validate_call + def get_virtual_circuit_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Virtual Circuit UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get a virtual circuit - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + Get the details of a virtual circuit + :param id: Virtual Circuit UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_virtual_circuit_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _response_types_map: Dict[str, Optional[str]] = { + '200': "VirtualCircuit", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_virtual_circuit_serialize( + self, + id, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "VirtualCircuit", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/virtual-circuits/{id}', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/virtual-circuits/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def list_interconnection_port_virtual_circuits(self, connection_id : Annotated[StrictStr, Field(..., description="UUID of the interconnection")], port_id : Annotated[StrictStr, Field(..., description="UUID of the interconnection port")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> VirtualCircuitList: # noqa: E501 - """List a interconnection port's virtual circuits # noqa: E501 - List the virtual circuit record(s) associatiated with a particular interconnection port. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def list_interconnection_port_virtual_circuits( + self, + connection_id: Annotated[StrictStr, Field(description="UUID of the interconnection")], + port_id: Annotated[StrictStr, Field(description="UUID of the interconnection port")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VirtualCircuitList: + """List a interconnection port's virtual circuits - >>> thread = api.list_interconnection_port_virtual_circuits(connection_id, port_id, include, exclude, async_req=True) - >>> result = thread.get() + List the virtual circuit record(s) associatiated with a particular interconnection port. :param connection_id: UUID of the interconnection (required) :type connection_id: str @@ -1658,446 +3040,833 @@ def list_interconnection_port_virtual_circuits(self, connection_id : Annotated[S :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: VirtualCircuitList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the list_interconnection_port_virtual_circuits_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.list_interconnection_port_virtual_circuits_with_http_info(connection_id, port_id, include, exclude, **kwargs) # noqa: E501 + """ # noqa: E501 + + _param = self._list_interconnection_port_virtual_circuits_serialize( + connection_id=connection_id, + port_id=port_id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - @validate_arguments - def list_interconnection_port_virtual_circuits_with_http_info(self, connection_id : Annotated[StrictStr, Field(..., description="UUID of the interconnection")], port_id : Annotated[StrictStr, Field(..., description="UUID of the interconnection port")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """List a interconnection port's virtual circuits # noqa: E501 + _response_types_map: Dict[str, Optional[str]] = { + '200': "VirtualCircuitList", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_interconnection_port_virtual_circuits_with_http_info( + self, + connection_id: Annotated[StrictStr, Field(description="UUID of the interconnection")], + port_id: Annotated[StrictStr, Field(description="UUID of the interconnection port")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VirtualCircuitList]: + """List a interconnection port's virtual circuits - List the virtual circuit record(s) associatiated with a particular interconnection port. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + List the virtual circuit record(s) associatiated with a particular interconnection port. + + :param connection_id: UUID of the interconnection (required) + :type connection_id: str + :param port_id: UUID of the interconnection port (required) + :type port_id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_interconnection_port_virtual_circuits_serialize( + connection_id=connection_id, + port_id=port_id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "VirtualCircuitList", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_interconnection_port_virtual_circuits_without_preload_content( + self, + connection_id: Annotated[StrictStr, Field(description="UUID of the interconnection")], + port_id: Annotated[StrictStr, Field(description="UUID of the interconnection port")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List a interconnection port's virtual circuits + + List the virtual circuit record(s) associatiated with a particular interconnection port. + + :param connection_id: UUID of the interconnection (required) + :type connection_id: str + :param port_id: UUID of the interconnection port (required) + :type port_id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_interconnection_port_virtual_circuits_serialize( + connection_id=connection_id, + port_id=port_id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "VirtualCircuitList", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_interconnection_port_virtual_circuits_serialize( + self, + connection_id, + port_id, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if connection_id is not None: + _path_params['connection_id'] = connection_id + if port_id is not None: + _path_params['port_id'] = port_id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/connections/{connection_id}/ports/{port_id}/virtual-circuits', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + @validate_call + def list_interconnection_ports( + self, + connection_id: Annotated[StrictStr, Field(description="UUID of the interconnection")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> InterconnectionPortList: + """List a interconnection's ports + + List the ports associated to an interconnection. + + :param connection_id: UUID of the interconnection (required) + :type connection_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_interconnection_ports_serialize( + connection_id=connection_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "InterconnectionPortList", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_interconnection_ports_with_http_info( + self, + connection_id: Annotated[StrictStr, Field(description="UUID of the interconnection")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[InterconnectionPortList]: + """List a interconnection's ports + + List the ports associated to an interconnection. + + :param connection_id: UUID of the interconnection (required) + :type connection_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_interconnection_ports_serialize( + connection_id=connection_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "InterconnectionPortList", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_interconnection_ports_without_preload_content( + self, + connection_id: Annotated[StrictStr, Field(description="UUID of the interconnection")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List a interconnection's ports - >>> thread = api.list_interconnection_port_virtual_circuits_with_http_info(connection_id, port_id, include, exclude, async_req=True) - >>> result = thread.get() + List the ports associated to an interconnection. :param connection_id: UUID of the interconnection (required) :type connection_id: str - :param port_id: UUID of the interconnection port (required) - :type port_id: str - :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. - :type include: List[str] - :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. - :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(VirtualCircuitList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._list_interconnection_ports_serialize( + connection_id=connection_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "InterconnectionPortList", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _all_params = [ - 'connection_id', - 'port_id', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_interconnection_port_virtual_circuits" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + def _list_interconnection_ports_serialize( + self, + connection_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the path parameters - _path_params = {} - if _params['connection_id']: - _path_params['connection_id'] = _params['connection_id'] + _host = None - if _params['port_id']: - _path_params['port_id'] = _params['port_id'] + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if connection_id is not None: + _path_params['connection_id'] = connection_id # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' - - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' - # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "VirtualCircuitList", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/connections/{connection_id}/ports/{port_id}/virtual-circuits', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/connections/{connection_id}/ports', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def list_interconnection_ports(self, connection_id : Annotated[StrictStr, Field(..., description="UUID of the interconnection")], **kwargs) -> InterconnectionPortList: # noqa: E501 - """List a interconnection's ports # noqa: E501 - List the ports associated to an interconnection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def list_interconnection_virtual_circuits( + self, + connection_id: Annotated[StrictStr, Field(description="UUID of the interconnection")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VirtualCircuitList: + """List a interconnection's virtual circuits - >>> thread = api.list_interconnection_ports(connection_id, async_req=True) - >>> result = thread.get() + List the virtual circuit record(s) associated with a particular interconnection id. :param connection_id: UUID of the interconnection (required) :type connection_id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: InterconnectionPortList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the list_interconnection_ports_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.list_interconnection_ports_with_http_info(connection_id, **kwargs) # noqa: E501 - - @validate_arguments - def list_interconnection_ports_with_http_info(self, connection_id : Annotated[StrictStr, Field(..., description="UUID of the interconnection")], **kwargs) -> ApiResponse: # noqa: E501 - """List a interconnection's ports # noqa: E501 + """ # noqa: E501 + + _param = self._list_interconnection_virtual_circuits_serialize( + connection_id=connection_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - List the ports associated to an interconnection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "VirtualCircuitList", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_interconnection_virtual_circuits_with_http_info( + self, + connection_id: Annotated[StrictStr, Field(description="UUID of the interconnection")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VirtualCircuitList]: + """List a interconnection's virtual circuits - >>> thread = api.list_interconnection_ports_with_http_info(connection_id, async_req=True) - >>> result = thread.get() + List the virtual circuit record(s) associated with a particular interconnection id. :param connection_id: UUID of the interconnection (required) :type connection_id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(InterconnectionPortList, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'connection_id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_interconnection_ports" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params['connection_id']: - _path_params['connection_id'] = _params['connection_id'] - - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 + """ # noqa: E501 + + _param = self._list_interconnection_virtual_circuits_serialize( + connection_id=connection_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _response_types_map = { - '200': "InterconnectionPortList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "VirtualCircuitList", '403': "Error", '404': "Error", } - - return self.api_client.call_api( - '/connections/{connection_id}/ports', 'GET', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - def list_interconnection_virtual_circuits(self, connection_id : Annotated[StrictStr, Field(..., description="UUID of the interconnection")], **kwargs) -> VirtualCircuitList: # noqa: E501 - """List a interconnection's virtual circuits # noqa: E501 - - List the virtual circuit record(s) associated with a particular interconnection id. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.list_interconnection_virtual_circuits(connection_id, async_req=True) - >>> result = thread.get() - - :param connection_id: UUID of the interconnection (required) - :type connection_id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: VirtualCircuitList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the list_interconnection_virtual_circuits_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.list_interconnection_virtual_circuits_with_http_info(connection_id, **kwargs) # noqa: E501 + ) - @validate_arguments - def list_interconnection_virtual_circuits_with_http_info(self, connection_id : Annotated[StrictStr, Field(..., description="UUID of the interconnection")], **kwargs) -> ApiResponse: # noqa: E501 - """List a interconnection's virtual circuits # noqa: E501 - List the virtual circuit record(s) associated with a particular interconnection id. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def list_interconnection_virtual_circuits_without_preload_content( + self, + connection_id: Annotated[StrictStr, Field(description="UUID of the interconnection")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List a interconnection's virtual circuits - >>> thread = api.list_interconnection_virtual_circuits_with_http_info(connection_id, async_req=True) - >>> result = thread.get() + List the virtual circuit record(s) associated with a particular interconnection id. :param connection_id: UUID of the interconnection (required) :type connection_id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(VirtualCircuitList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._list_interconnection_virtual_circuits_serialize( + connection_id=connection_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "VirtualCircuitList", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _params = locals() - _all_params = [ - 'connection_id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_interconnection_virtual_circuits" % _key - ) - _params[_key] = _val - del _params['kwargs'] + def _list_interconnection_virtual_circuits_serialize( + self, + connection_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - _collection_formats = {} + _host = None - # process the path parameters - _path_params = {} - if _params['connection_id']: - _path_params['connection_id'] = _params['connection_id'] + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if connection_id is not None: + _path_params['connection_id'] = connection_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "VirtualCircuitList", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/connections/{connection_id}/virtual-circuits', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/connections/{connection_id}/virtual-circuits', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def organization_list_interconnections(self, organization_id : Annotated[StrictStr, Field(..., description="UUID of the organization")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> InterconnectionList: # noqa: E501 - """List organization connections # noqa: E501 - List the connections belonging to the organization # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def organization_list_interconnections( + self, + organization_id: Annotated[StrictStr, Field(description="UUID of the organization")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> InterconnectionList: + """List organization connections - >>> thread = api.organization_list_interconnections(organization_id, include, exclude, async_req=True) - >>> result = thread.get() + List the connections belonging to the organization :param organization_id: UUID of the organization (required) :type organization_id: str @@ -2105,32 +3874,76 @@ def organization_list_interconnections(self, organization_id : Annotated[StrictS :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: InterconnectionList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the organization_list_interconnections_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.organization_list_interconnections_with_http_info(organization_id, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def organization_list_interconnections_with_http_info(self, organization_id : Annotated[StrictStr, Field(..., description="UUID of the organization")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """List organization connections # noqa: E501 + """ # noqa: E501 + + _param = self._organization_list_interconnections_serialize( + organization_id=organization_id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - List the connections belonging to the organization # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "InterconnectionList", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def organization_list_interconnections_with_http_info( + self, + organization_id: Annotated[StrictStr, Field(description="UUID of the organization")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[InterconnectionList]: + """List organization connections - >>> thread = api.organization_list_interconnections_with_http_info(organization_id, include, exclude, async_req=True) - >>> result = thread.get() + List the connections belonging to the organization :param organization_id: UUID of the organization (required) :type organization_id: str @@ -2138,117 +3951,200 @@ def organization_list_interconnections_with_http_info(self, organization_id : An :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(InterconnectionList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._organization_list_interconnections_serialize( + organization_id=organization_id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "InterconnectionList", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'organization_id', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method organization_list_interconnections" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + @validate_call + def organization_list_interconnections_without_preload_content( + self, + organization_id: Annotated[StrictStr, Field(description="UUID of the organization")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List organization connections - # process the path parameters - _path_params = {} - if _params['organization_id']: - _path_params['organization_id'] = _params['organization_id'] + List the connections belonging to the organization + + :param organization_id: UUID of the organization (required) + :type organization_id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._organization_list_interconnections_serialize( + organization_id=organization_id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "InterconnectionList", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + def _organization_list_interconnections_serialize( + self, + organization_id, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _host = None + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if organization_id is not None: + _path_params['organization_id'] = organization_id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "InterconnectionList", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/organizations/{organization_id}/connections', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/organizations/{organization_id}/connections', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + - @validate_arguments - def project_list_interconnections_all_pages(self, project_id : Annotated[StrictStr, Field(..., description="UUID of the project")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> InterconnectionList: # noqa: E501 + @validate_call + def project_list_interconnections_all_pages(self, project_id : Annotated[StrictStr, Field(description="UUID of the project")], include : Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, per_page : Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, **kwargs) -> InterconnectionList: # noqa: E501 """List project connections # noqa: E501 This method is the same as project_list_interconnections, but fetches resources from all the pages. @@ -2299,19 +4195,118 @@ def project_list_interconnections_all_pages(self, project_id : Annotated[StrictS if page_response.meta.next is None: break page += 1 - + return all_pages - @validate_arguments - def project_list_interconnections(self, project_id : Annotated[StrictStr, Field(..., description="UUID of the project")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> InterconnectionList: # noqa: E501 - """List project connections # noqa: E501 + @validate_call + def project_list_interconnections( + self, + project_id: Annotated[StrictStr, Field(description="UUID of the project")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> InterconnectionList: + """List project connections + + List the connections belonging to the project + + :param project_id: UUID of the project (required) + :type project_id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param page: Page to return + :type page: int + :param per_page: Items returned per page + :type per_page: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._project_list_interconnections_serialize( + project_id=project_id, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - List the connections belonging to the project # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "InterconnectionList", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def project_list_interconnections_with_http_info( + self, + project_id: Annotated[StrictStr, Field(description="UUID of the project")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[InterconnectionList]: + """List project connections - >>> thread = api.project_list_interconnections(project_id, include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + List the connections belonging to the project :param project_id: UUID of the project (required) :type project_id: str @@ -2323,32 +4318,80 @@ def project_list_interconnections(self, project_id : Annotated[StrictStr, Field( :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: InterconnectionList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the project_list_interconnections_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.project_list_interconnections_with_http_info(project_id, include, exclude, page, per_page, **kwargs) # noqa: E501 + """ # noqa: E501 + + _param = self._project_list_interconnections_serialize( + project_id=project_id, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - @validate_arguments - def project_list_interconnections_with_http_info(self, project_id : Annotated[StrictStr, Field(..., description="UUID of the project")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """List project connections # noqa: E501 + _response_types_map: Dict[str, Optional[str]] = { + '200': "InterconnectionList", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - List the connections belonging to the project # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.project_list_interconnections_with_http_info(project_id, include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + @validate_call + def project_list_interconnections_without_preload_content( + self, + project_id: Annotated[StrictStr, Field(description="UUID of the project")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List project connections + + List the connections belonging to the project :param project_id: UUID of the project (required) :type project_id: str @@ -2360,133 +4403,156 @@ def project_list_interconnections_with_http_info(self, project_id : Annotated[St :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(InterconnectionList, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() + """ # noqa: E501 + + _param = self._project_list_interconnections_serialize( + project_id=project_id, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _all_params = [ - 'project_id', - 'include', - 'exclude', - 'page', - 'per_page' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method project_list_interconnections" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "InterconnectionList", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _project_list_interconnections_serialize( + self, + project_id, + include, + exclude, + page, + per_page, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - _collection_formats = {} + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None # process the path parameters - _path_params = {} - if _params['project_id']: - _path_params['project_id'] = _params['project_id'] - - + if project_id is not None: + _path_params['project_id'] = project_id # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' - - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' - - if _params.get('page') is not None: # noqa: E501 - _query_params.append(('page', _params['page'])) - - if _params.get('per_page') is not None: # noqa: E501 - _query_params.append(('per_page', _params['per_page'])) - + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + + if page is not None: + + _query_params.append(('page', page)) + + if per_page is not None: + + _query_params.append(('per_page', per_page)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "InterconnectionList", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{project_id}/connections', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/projects/{project_id}/connections', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def update_interconnection(self, connection_id : Annotated[StrictStr, Field(..., description="Interconnection UUID")], interconnection_update_input : Annotated[InterconnectionUpdateInput, Field(..., description="Updated interconnection details")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> Interconnection: # noqa: E501 - """Update interconnection # noqa: E501 - Update the details of a interconnection # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def update_interconnection( + self, + connection_id: Annotated[StrictStr, Field(description="Interconnection UUID")], + interconnection_update_input: Annotated[InterconnectionUpdateInput, Field(description="Updated interconnection details")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Interconnection: + """Update interconnection - >>> thread = api.update_interconnection(connection_id, interconnection_update_input, include, exclude, async_req=True) - >>> result = thread.get() + Update the details of a interconnection :param connection_id: Interconnection UUID (required) :type connection_id: str @@ -2496,32 +4562,78 @@ def update_interconnection(self, connection_id : Annotated[StrictStr, Field(..., :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Interconnection - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the update_interconnection_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.update_interconnection_with_http_info(connection_id, interconnection_update_input, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def update_interconnection_with_http_info(self, connection_id : Annotated[StrictStr, Field(..., description="Interconnection UUID")], interconnection_update_input : Annotated[InterconnectionUpdateInput, Field(..., description="Updated interconnection details")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Update interconnection # noqa: E501 + """ # noqa: E501 + + _param = self._update_interconnection_serialize( + connection_id=connection_id, + interconnection_update_input=interconnection_update_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Update the details of a interconnection # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "Interconnection", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_interconnection_with_http_info( + self, + connection_id: Annotated[StrictStr, Field(description="Interconnection UUID")], + interconnection_update_input: Annotated[InterconnectionUpdateInput, Field(description="Updated interconnection details")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Interconnection]: + """Update interconnection - >>> thread = api.update_interconnection_with_http_info(connection_id, interconnection_update_input, include, exclude, async_req=True) - >>> result = thread.get() + Update the details of a interconnection :param connection_id: Interconnection UUID (required) :type connection_id: str @@ -2531,136 +4643,242 @@ def update_interconnection_with_http_info(self, connection_id : Annotated[Strict :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Interconnection, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._update_interconnection_serialize( + connection_id=connection_id, + interconnection_update_input=interconnection_update_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "Interconnection", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'connection_id', - 'interconnection_update_input', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method update_interconnection" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + @validate_call + def update_interconnection_without_preload_content( + self, + connection_id: Annotated[StrictStr, Field(description="Interconnection UUID")], + interconnection_update_input: Annotated[InterconnectionUpdateInput, Field(description="Updated interconnection details")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update interconnection - # process the path parameters - _path_params = {} - if _params['connection_id']: - _path_params['connection_id'] = _params['connection_id'] + Update the details of a interconnection + :param connection_id: Interconnection UUID (required) + :type connection_id: str + :param interconnection_update_input: Updated interconnection details (required) + :type interconnection_update_input: InterconnectionUpdateInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_interconnection_serialize( + connection_id=connection_id, + interconnection_update_input=interconnection_update_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _response_types_map: Dict[str, Optional[str]] = { + '200': "Interconnection", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_interconnection_serialize( + self, + connection_id, + interconnection_update_input, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if connection_id is not None: + _path_params['connection_id'] = connection_id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['interconnection_update_input'] is not None: - _body_params = _params['interconnection_update_input'] + if interconnection_update_input is not None: + _body_params = interconnection_update_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '200': "Interconnection", - '403': "Error", - '404': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/connections/{connection_id}', 'PUT', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='PUT', + resource_path='/connections/{connection_id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def update_virtual_circuit(self, id : Annotated[StrictStr, Field(..., description="Virtual Circuit UUID")], virtual_circuit_update_input : Annotated[VirtualCircuitUpdateInput, Field(..., description="Updated Virtual Circuit details")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> VirtualCircuit: # noqa: E501 - """Update a virtual circuit # noqa: E501 - Update the details of a virtual circuit. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def update_virtual_circuit( + self, + id: Annotated[StrictStr, Field(description="Virtual Circuit UUID")], + virtual_circuit_update_input: Annotated[VirtualCircuitUpdateInput, Field(description="Updated Virtual Circuit details")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VirtualCircuit: + """Update a virtual circuit - >>> thread = api.update_virtual_circuit(id, virtual_circuit_update_input, include, exclude, async_req=True) - >>> result = thread.get() + Update the details of a virtual circuit. :param id: Virtual Circuit UUID (required) :type id: str @@ -2670,32 +4888,79 @@ def update_virtual_circuit(self, id : Annotated[StrictStr, Field(..., descriptio :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: VirtualCircuit - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the update_virtual_circuit_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.update_virtual_circuit_with_http_info(id, virtual_circuit_update_input, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def update_virtual_circuit_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Virtual Circuit UUID")], virtual_circuit_update_input : Annotated[VirtualCircuitUpdateInput, Field(..., description="Updated Virtual Circuit details")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Update a virtual circuit # noqa: E501 + """ # noqa: E501 + + _param = self._update_virtual_circuit_serialize( + id=id, + virtual_circuit_update_input=virtual_circuit_update_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Update the details of a virtual circuit. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "VirtualCircuit", + '202': "VirtualCircuit", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_virtual_circuit_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Virtual Circuit UUID")], + virtual_circuit_update_input: Annotated[VirtualCircuitUpdateInput, Field(description="Updated Virtual Circuit details")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VirtualCircuit]: + """Update a virtual circuit - >>> thread = api.update_virtual_circuit_with_http_info(id, virtual_circuit_update_input, include, exclude, async_req=True) - >>> result = thread.get() + Update the details of a virtual circuit. :param id: Virtual Circuit UUID (required) :type id: str @@ -2705,123 +4970,218 @@ def update_virtual_circuit_with_http_info(self, id : Annotated[StrictStr, Field( :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(VirtualCircuit, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._update_virtual_circuit_serialize( + id=id, + virtual_circuit_update_input=virtual_circuit_update_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "VirtualCircuit", + '202': "VirtualCircuit", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id', - 'virtual_circuit_update_input', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method update_virtual_circuit" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + @validate_call + def update_virtual_circuit_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Virtual Circuit UUID")], + virtual_circuit_update_input: Annotated[VirtualCircuitUpdateInput, Field(description="Updated Virtual Circuit details")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update a virtual circuit - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + Update the details of a virtual circuit. + :param id: Virtual Circuit UUID (required) + :type id: str + :param virtual_circuit_update_input: Updated Virtual Circuit details (required) + :type virtual_circuit_update_input: VirtualCircuitUpdateInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_virtual_circuit_serialize( + id=id, + virtual_circuit_update_input=virtual_circuit_update_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _response_types_map: Dict[str, Optional[str]] = { + '200': "VirtualCircuit", + '202': "VirtualCircuit", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_virtual_circuit_serialize( + self, + id, + virtual_circuit_update_input, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['virtual_circuit_update_input'] is not None: - _body_params = _params['virtual_circuit_update_input'] + if virtual_circuit_update_input is not None: + _body_params = virtual_circuit_update_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '200': "VirtualCircuit", - '202': "VirtualCircuit", - '403': "Error", - '404': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/virtual-circuits/{id}', 'PUT', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='PUT', + resource_path='/virtual-circuits/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/invitations_api.py b/equinix_metal/equinix_metal/api/invitations_api.py index 965affea..7a392c60 100644 --- a/equinix_metal/equinix_metal/api/invitations_api.py +++ b/equinix_metal/equinix_metal/api/invitations_api.py @@ -12,476 +12,861 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictStr, conlist - -from typing import Optional - +from pydantic import Field, StrictStr +from typing import List, Optional +from typing_extensions import Annotated from equinix_metal.models.invitation import Invitation from equinix_metal.models.membership import Membership -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class InvitationsApi(object): +class InvitationsApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def accept_invitation( + self, + id: Annotated[StrictStr, Field(description="Invitation UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Membership: + """Accept an invitation - @validate_arguments - def accept_invitation(self, id : Annotated[StrictStr, Field(..., description="Invitation UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> Membership: # noqa: E501 - """Accept an invitation # noqa: E501 - - Accept an invitation. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.accept_invitation(id, include, async_req=True) - >>> result = thread.get() + Accept an invitation. :param id: Invitation UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Membership - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the accept_invitation_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.accept_invitation_with_http_info(id, include, **kwargs) # noqa: E501 - - @validate_arguments - def accept_invitation_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Invitation UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Accept an invitation # noqa: E501 - - Accept an invitation. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.accept_invitation_with_http_info(id, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._accept_invitation_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Membership", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def accept_invitation_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Invitation UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Membership]: + """Accept an invitation + + Accept an invitation. :param id: Invitation UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Membership, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._accept_invitation_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "Membership", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def accept_invitation_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Invitation UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Accept an invitation + + Accept an invitation. + + :param id: Invitation UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._accept_invitation_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Membership", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) + return response_data.response - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method accept_invitation" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + def _accept_invitation_serialize( + self, + id, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + _host = None + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "Membership", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/invitations/{id}', 'PUT', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='PUT', + resource_path='/invitations/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def decline_invitation(self, id : Annotated[StrictStr, Field(..., description="Invitation UUID")], **kwargs) -> None: # noqa: E501 - """Decline an invitation # noqa: E501 - Decline an invitation. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def decline_invitation( + self, + id: Annotated[StrictStr, Field(description="Invitation UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Decline an invitation - >>> thread = api.decline_invitation(id, async_req=True) - >>> result = thread.get() + Decline an invitation. :param id: Invitation UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the decline_invitation_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.decline_invitation_with_http_info(id, **kwargs) # noqa: E501 - - @validate_arguments - def decline_invitation_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Invitation UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """Decline an invitation # noqa: E501 - - Decline an invitation. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.decline_invitation_with_http_info(id, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._decline_invitation_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def decline_invitation_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Invitation UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Decline an invitation + + Decline an invitation. :param id: Invitation UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 + + _param = self._decline_invitation_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def decline_invitation_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Invitation UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Decline an invitation + + Decline an invitation. + + :param id: Invitation UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._decline_invitation_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method decline_invitation" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _decline_invitation_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/invitations/{id}', 'DELETE', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='DELETE', + resource_path='/invitations/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_invitation_by_id(self, id : Annotated[StrictStr, Field(..., description="Invitation UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> Invitation: # noqa: E501 - """View an invitation # noqa: E501 - Returns a single invitation. (It include the `invitable` to maintain backward compatibility but will be removed soon) # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_invitation_by_id( + self, + id: Annotated[StrictStr, Field(description="Invitation UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Invitation: + """View an invitation - >>> thread = api.find_invitation_by_id(id, include, async_req=True) - >>> result = thread.get() + Returns a single invitation. (It include the `invitable` to maintain backward compatibility but will be removed soon) :param id: Invitation UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Invitation - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_invitation_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_invitation_by_id_with_http_info(id, include, **kwargs) # noqa: E501 - - @validate_arguments - def find_invitation_by_id_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Invitation UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """View an invitation # noqa: E501 - - Returns a single invitation. (It include the `invitable` to maintain backward compatibility but will be removed soon) # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_invitation_by_id_with_http_info(id, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_invitation_by_id_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Invitation", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_invitation_by_id_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Invitation UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Invitation]: + """View an invitation + + Returns a single invitation. (It include the `invitable` to maintain backward compatibility but will be removed soon) :param id: Invitation UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Invitation, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_invitation_by_id_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Invitation", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def find_invitation_by_id_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Invitation UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """View an invitation + + Returns a single invitation. (It include the `invitable` to maintain backward compatibility but will be removed soon) + + :param id: Invitation UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_invitation_by_id_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_invitation_by_id" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "Invitation", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_invitation_by_id_serialize( + self, + id, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "Invitation", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/invitations/{id}', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/invitations/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/invoices_api.py b/equinix_metal/equinix_metal/api/invoices_api.py index 130c7d8b..6724c72a 100644 --- a/equinix_metal/equinix_metal/api/invoices_api.py +++ b/equinix_metal/equinix_metal/api/invoices_api.py @@ -12,51 +12,137 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated from pydantic import Field, StrictInt, StrictStr - from typing import Optional - +from typing_extensions import Annotated from equinix_metal.models.invoice import Invoice from equinix_metal.models.invoice_list import InvoiceList -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class InvoicesApi(object): +class InvoicesApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def find_organization_invoices( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + page: Annotated[Optional[StrictInt], Field(description="page number")] = None, + per_page: Annotated[Optional[StrictInt], Field(description="per page")] = None, + status: Annotated[Optional[StrictStr], Field(description="filter by status")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> InvoiceList: + """Retrieve all invoices for an organization + + Returns all invoices for an organization - @validate_arguments - def find_organization_invoices(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], page : Annotated[Optional[StrictInt], Field(description="page number")] = None, per_page : Annotated[Optional[StrictInt], Field(description="per page")] = None, status : Annotated[Optional[StrictStr], Field(description="filter by status")] = None, **kwargs) -> InvoiceList: # noqa: E501 - """Retrieve all invoices for an organization # noqa: E501 + :param id: Organization UUID (required) + :type id: str + :param page: page number + :type page: int + :param per_page: per page + :type per_page: int + :param status: filter by status + :type status: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_organization_invoices_serialize( + id=id, + page=page, + per_page=per_page, + status=status, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Returns all invoices for an organization # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "InvoiceList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_organization_invoices_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + page: Annotated[Optional[StrictInt], Field(description="page number")] = None, + per_page: Annotated[Optional[StrictInt], Field(description="per page")] = None, + status: Annotated[Optional[StrictStr], Field(description="filter by status")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[InvoiceList]: + """Retrieve all invoices for an organization - >>> thread = api.find_organization_invoices(id, page, per_page, status, async_req=True) - >>> result = thread.get() + Returns all invoices for an organization :param id: Organization UUID (required) :type id: str @@ -66,32 +152,78 @@ def find_organization_invoices(self, id : Annotated[StrictStr, Field(..., descri :type per_page: int :param status: filter by status :type status: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: InvoiceList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_organization_invoices_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_organization_invoices_with_http_info(id, page, per_page, status, **kwargs) # noqa: E501 - - @validate_arguments - def find_organization_invoices_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], page : Annotated[Optional[StrictInt], Field(description="page number")] = None, per_page : Annotated[Optional[StrictInt], Field(description="per page")] = None, status : Annotated[Optional[StrictStr], Field(description="filter by status")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve all invoices for an organization # noqa: E501 - - Returns all invoices for an organization # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_organization_invoices_with_http_info(id, page, per_page, status, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_organization_invoices_serialize( + id=id, + page=page, + per_page=per_page, + status=status, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "InvoiceList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def find_organization_invoices_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + page: Annotated[Optional[StrictInt], Field(description="page number")] = None, + per_page: Annotated[Optional[StrictInt], Field(description="per page")] = None, + status: Annotated[Optional[StrictStr], Field(description="filter by status")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all invoices for an organization + + Returns all invoices for an organization :param id: Organization UUID (required) :type id: str @@ -101,254 +233,384 @@ def find_organization_invoices_with_http_info(self, id : Annotated[StrictStr, Fi :type per_page: int :param status: filter by status :type status: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(InvoiceList, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'id', - 'page', - 'per_page', - 'status' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + """ # noqa: E501 + + _param = self._find_organization_invoices_serialize( + id=id, + page=page, + per_page=per_page, + status=status, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_organization_invoices" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} + _response_types_map: Dict[str, Optional[str]] = { + '200': "InvoiceList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_organization_invoices_serialize( + self, + id, + page, + per_page, + status, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the query parameters - _query_params = [] - if _params.get('page') is not None: # noqa: E501 - _query_params.append(('page', _params['page'])) + _host = None - if _params.get('per_page') is not None: # noqa: E501 - _query_params.append(('per_page', _params['per_page'])) + _collection_formats: Dict[str, str] = { + } - if _params.get('status') is not None: # noqa: E501 - _query_params.append(('status', _params['status'])) + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if page is not None: + + _query_params.append(('page', page)) + + if per_page is not None: + + _query_params.append(('per_page', per_page)) + + if status is not None: + + _query_params.append(('status', status)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "InvoiceList", - '401': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/organizations/{id}/invoices', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/organizations/{id}/invoices', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def get_invoice_by_id(self, id : Annotated[StrictStr, Field(..., description="Invoice UUID")], **kwargs) -> Invoice: # noqa: E501 - """Retrieve an invoice # noqa: E501 - Returns the invoice identified by the provided id # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def get_invoice_by_id( + self, + id: Annotated[StrictStr, Field(description="Invoice UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Invoice: + """Retrieve an invoice - >>> thread = api.get_invoice_by_id(id, async_req=True) - >>> result = thread.get() + Returns the invoice identified by the provided id :param id: Invoice UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Invoice - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the get_invoice_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.get_invoice_by_id_with_http_info(id, **kwargs) # noqa: E501 - - @validate_arguments - def get_invoice_by_id_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Invoice UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve an invoice # noqa: E501 - - Returns the invoice identified by the provided id # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.get_invoice_by_id_with_http_info(id, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._get_invoice_by_id_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Invoice", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_invoice_by_id_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Invoice UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Invoice]: + """Retrieve an invoice + + Returns the invoice identified by the provided id :param id: Invoice UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Invoice, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._get_invoice_by_id_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "Invoice", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def get_invoice_by_id_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Invoice UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve an invoice + + Returns the invoice identified by the provided id + + :param id: Invoice UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_invoice_by_id_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_invoice_by_id" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "Invoice", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _get_invoice_by_id_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "Invoice", - '401': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/invoices/{id}', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/invoices/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/ip_addresses_api.py b/equinix_metal/equinix_metal/api/ip_addresses_api.py index f8882418..42c0a8e9 100644 --- a/equinix_metal/equinix_metal/api/ip_addresses_api.py +++ b/equinix_metal/equinix_metal/api/ip_addresses_api.py @@ -12,18 +12,14 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictStr, conint, conlist, validator - -from typing import Optional - +from pydantic import Field, StrictStr, field_validator +from typing import List, Optional +from typing_extensions import Annotated from equinix_metal.models.find_ip_address_by_id200_response import FindIPAddressById200Response from equinix_metal.models.ip_assignment_update_input import IPAssignmentUpdateInput from equinix_metal.models.ip_availabilities_list import IPAvailabilitiesList @@ -31,173 +27,309 @@ from equinix_metal.models.request_ip_reservation201_response import RequestIPReservation201Response from equinix_metal.models.request_ip_reservation_request import RequestIPReservationRequest -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class IPAddressesApi(object): +class IPAddressesApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def delete_ip_address( + self, + id: Annotated[StrictStr, Field(description="IP Address UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Unassign an ip address - @validate_arguments - def delete_ip_address(self, id : Annotated[StrictStr, Field(..., description="IP Address UUID")], **kwargs) -> None: # noqa: E501 - """Unassign an ip address # noqa: E501 - - This call can be used to un-assign an IP assignment or delete an IP reservation. Un-assign an IP address record. Use the assignment UUID you get after attaching the IP. This will remove the relationship between an IP and the device or metal gateway and will make the IP address available to be assigned to another device, once the IP has been un-configured from the network. Delete an IP reservation. Use the reservation UUID you get after adding the IP to the project. This will permanently delete the IP block reservation from the project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_ip_address(id, async_req=True) - >>> result = thread.get() + This call can be used to un-assign an IP assignment or delete an IP reservation. Un-assign an IP address record. Use the assignment UUID you get after attaching the IP. This will remove the relationship between an IP and the device or metal gateway and will make the IP address available to be assigned to another device, once the IP has been un-configured from the network. Delete an IP reservation. Use the reservation UUID you get after adding the IP to the project. This will permanently delete the IP block reservation from the project. :param id: IP Address UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the delete_ip_address_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.delete_ip_address_with_http_info(id, **kwargs) # noqa: E501 - - @validate_arguments - def delete_ip_address_with_http_info(self, id : Annotated[StrictStr, Field(..., description="IP Address UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """Unassign an ip address # noqa: E501 - - This call can be used to un-assign an IP assignment or delete an IP reservation. Un-assign an IP address record. Use the assignment UUID you get after attaching the IP. This will remove the relationship between an IP and the device or metal gateway and will make the IP address available to be assigned to another device, once the IP has been un-configured from the network. Delete an IP reservation. Use the reservation UUID you get after adding the IP to the project. This will permanently delete the IP block reservation from the project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_ip_address_with_http_info(id, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._delete_ip_address_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_ip_address_with_http_info( + self, + id: Annotated[StrictStr, Field(description="IP Address UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Unassign an ip address + + This call can be used to un-assign an IP assignment or delete an IP reservation. Un-assign an IP address record. Use the assignment UUID you get after attaching the IP. This will remove the relationship between an IP and the device or metal gateway and will make the IP address available to be assigned to another device, once the IP has been un-configured from the network. Delete an IP reservation. Use the reservation UUID you get after adding the IP to the project. This will permanently delete the IP block reservation from the project. :param id: IP Address UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 + + _param = self._delete_ip_address_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def delete_ip_address_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="IP Address UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Unassign an ip address + + This call can be used to un-assign an IP assignment or delete an IP reservation. Un-assign an IP address record. Use the assignment UUID you get after attaching the IP. This will remove the relationship between an IP and the device or metal gateway and will make the IP address available to be assigned to another device, once the IP has been un-configured from the network. Delete an IP reservation. Use the reservation UUID you get after adding the IP to the project. This will permanently delete the IP block reservation from the project. + + :param id: IP Address UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_ip_address_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_ip_address" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _delete_ip_address_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/ips/{id}', 'DELETE', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='DELETE', + resource_path='/ips/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_ip_address_by_id(self, id : Annotated[StrictStr, Field(..., description="IP Address UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> FindIPAddressById200Response: # noqa: E501 - """Retrieve an ip address # noqa: E501 - Returns a single ip address if the user has access. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_ip_address_by_id( + self, + id: Annotated[StrictStr, Field(description="IP Address UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> FindIPAddressById200Response: + """Retrieve an ip address - >>> thread = api.find_ip_address_by_id(id, include, exclude, async_req=True) - >>> result = thread.get() + Returns a single ip address if the user has access. :param id: IP Address UUID (required) :type id: str @@ -205,32 +337,77 @@ def find_ip_address_by_id(self, id : Annotated[StrictStr, Field(..., description :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: FindIPAddressById200Response - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_ip_address_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_ip_address_by_id_with_http_info(id, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def find_ip_address_by_id_with_http_info(self, id : Annotated[StrictStr, Field(..., description="IP Address UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve an ip address # noqa: E501 - - Returns a single ip address if the user has access. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_ip_address_by_id_with_http_info(id, include, exclude, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_ip_address_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "FindIPAddressById200Response", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_ip_address_by_id_with_http_info( + self, + id: Annotated[StrictStr, Field(description="IP Address UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[FindIPAddressById200Response]: + """Retrieve an ip address + + Returns a single ip address if the user has access. :param id: IP Address UUID (required) :type id: str @@ -238,413 +415,771 @@ def find_ip_address_by_id_with_http_info(self, id : Annotated[StrictStr, Field(. :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(FindIPAddressById200Response, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_ip_address_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "FindIPAddressById200Response", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def find_ip_address_by_id_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="IP Address UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve an ip address + + Returns a single ip address if the user has access. + + :param id: IP Address UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_ip_address_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_ip_address_by_id" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "FindIPAddressById200Response", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_ip_address_by_id_serialize( + self, + id, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "FindIPAddressById200Response", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/ips/{id}', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/ips/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_ip_address_customdata(self, id : Annotated[StrictStr, Field(..., description="Ip Reservation UUID")], **kwargs) -> None: # noqa: E501 - """Retrieve the custom metadata of an IP Reservation or IP Assignment # noqa: E501 - Provides the custom metadata stored for this IP Reservation or IP Assignment in json format # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_ip_address_customdata( + self, + id: Annotated[StrictStr, Field(description="Ip Reservation UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Retrieve the custom metadata of an IP Reservation or IP Assignment - >>> thread = api.find_ip_address_customdata(id, async_req=True) - >>> result = thread.get() + Provides the custom metadata stored for this IP Reservation or IP Assignment in json format :param id: Ip Reservation UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_ip_address_customdata_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_ip_address_customdata_with_http_info(id, **kwargs) # noqa: E501 - - @validate_arguments - def find_ip_address_customdata_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Ip Reservation UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve the custom metadata of an IP Reservation or IP Assignment # noqa: E501 - - Provides the custom metadata stored for this IP Reservation or IP Assignment in json format # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_ip_address_customdata_with_http_info(id, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_ip_address_customdata_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_ip_address_customdata_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Ip Reservation UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Retrieve the custom metadata of an IP Reservation or IP Assignment + + Provides the custom metadata stored for this IP Reservation or IP Assignment in json format :param id: Ip Reservation UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 + + _param = self._find_ip_address_customdata_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def find_ip_address_customdata_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Ip Reservation UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve the custom metadata of an IP Reservation or IP Assignment + + Provides the custom metadata stored for this IP Reservation or IP Assignment in json format + + :param id: Ip Reservation UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_ip_address_customdata_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_ip_address_customdata" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_ip_address_customdata_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/ips/{id}/customdata', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/ips/{id}/customdata', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_ip_availabilities(self, id : Annotated[StrictStr, Field(..., description="IP Reservation UUID")], cidr : Annotated[StrictStr, Field(..., description="Size of subnets in bits")], **kwargs) -> IPAvailabilitiesList: # noqa: E501 - """Retrieve all available subnets of a particular reservation # noqa: E501 - Provides a list of IP resevations for a single project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_ip_availabilities( + self, + id: Annotated[StrictStr, Field(description="IP Reservation UUID")], + cidr: Annotated[StrictStr, Field(description="Size of subnets in bits")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> IPAvailabilitiesList: + """Retrieve all available subnets of a particular reservation - >>> thread = api.find_ip_availabilities(id, cidr, async_req=True) - >>> result = thread.get() + Provides a list of IP resevations for a single project. :param id: IP Reservation UUID (required) :type id: str :param cidr: Size of subnets in bits (required) :type cidr: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: IPAvailabilitiesList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_ip_availabilities_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_ip_availabilities_with_http_info(id, cidr, **kwargs) # noqa: E501 - - @validate_arguments - def find_ip_availabilities_with_http_info(self, id : Annotated[StrictStr, Field(..., description="IP Reservation UUID")], cidr : Annotated[StrictStr, Field(..., description="Size of subnets in bits")], **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve all available subnets of a particular reservation # noqa: E501 - - Provides a list of IP resevations for a single project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_ip_availabilities_with_http_info(id, cidr, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_ip_availabilities_serialize( + id=id, + cidr=cidr, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "IPAvailabilitiesList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_ip_availabilities_with_http_info( + self, + id: Annotated[StrictStr, Field(description="IP Reservation UUID")], + cidr: Annotated[StrictStr, Field(description="Size of subnets in bits")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[IPAvailabilitiesList]: + """Retrieve all available subnets of a particular reservation + + Provides a list of IP resevations for a single project. :param id: IP Reservation UUID (required) :type id: str :param cidr: Size of subnets in bits (required) :type cidr: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(IPAvailabilitiesList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_ip_availabilities_serialize( + id=id, + cidr=cidr, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "IPAvailabilitiesList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id', - 'cidr' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def find_ip_availabilities_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="IP Reservation UUID")], + cidr: Annotated[StrictStr, Field(description="Size of subnets in bits")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all available subnets of a particular reservation + + Provides a list of IP resevations for a single project. + + :param id: IP Reservation UUID (required) + :type id: str + :param cidr: Size of subnets in bits (required) + :type cidr: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_ip_availabilities_serialize( + id=id, + cidr=cidr, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_ip_availabilities" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "IPAvailabilitiesList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_ip_availabilities_serialize( + self, + id, + cidr, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('cidr') is not None: # noqa: E501 - _query_params.append(('cidr', _params['cidr'])) + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if cidr is not None: + + _query_params.append(('cidr', cidr)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "IPAvailabilitiesList", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/ips/{id}/available', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/ips/{id}/available', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_ip_reservations(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], types : Annotated[Optional[conlist(StrictStr)], Field(description="Filter project IP reservations by reservation type")] = None, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> IPReservationList: # noqa: E501 - """Retrieve all ip reservations # noqa: E501 - Provides a paginated list of IP reservations for a single project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_ip_reservations( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + types: Annotated[Optional[List[StrictStr]], Field(description="Filter project IP reservations by reservation type")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> IPReservationList: + """Retrieve all ip reservations - >>> thread = api.find_ip_reservations(id, types, include, exclude, per_page, async_req=True) - >>> result = thread.get() + Provides a paginated list of IP reservations for a single project. :param id: Project UUID (required) :type id: str @@ -656,32 +1191,81 @@ def find_ip_reservations(self, id : Annotated[StrictStr, Field(..., description= :type exclude: List[str] :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: IPReservationList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_ip_reservations_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_ip_reservations_with_http_info(id, types, include, exclude, per_page, **kwargs) # noqa: E501 - - @validate_arguments - def find_ip_reservations_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], types : Annotated[Optional[conlist(StrictStr)], Field(description="Filter project IP reservations by reservation type")] = None, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve all ip reservations # noqa: E501 - - Provides a paginated list of IP reservations for a single project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_ip_reservations_with_http_info(id, types, include, exclude, per_page, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_ip_reservations_serialize( + id=id, + types=types, + include=include, + exclude=exclude, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "IPReservationList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_ip_reservations_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + types: Annotated[Optional[List[StrictStr]], Field(description="Filter project IP reservations by reservation type")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[IPReservationList]: + """Retrieve all ip reservations + + Provides a paginated list of IP reservations for a single project. :param id: Project UUID (required) :type id: str @@ -693,135 +1277,244 @@ def find_ip_reservations_with_http_info(self, id : Annotated[StrictStr, Field(.. :type exclude: List[str] :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(IPReservationList, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'id', - 'types', - 'include', - 'exclude', - 'per_page' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + """ # noqa: E501 + + _param = self._find_ip_reservations_serialize( + id=id, + types=types, + include=include, + exclude=exclude, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_ip_reservations" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} + _response_types_map: Dict[str, Optional[str]] = { + '200': "IPReservationList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + @validate_call + def find_ip_reservations_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + types: Annotated[Optional[List[StrictStr]], Field(description="Filter project IP reservations by reservation type")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all ip reservations - # process the query parameters - _query_params = [] - if _params.get('types') is not None: # noqa: E501 - _query_params.append(('types', _params['types'])) - _collection_formats['types'] = 'multi' + Provides a paginated list of IP reservations for a single project. - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + :param id: Project UUID (required) + :type id: str + :param types: Filter project IP reservations by reservation type + :type types: List[str] + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param per_page: Items returned per page + :type per_page: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_ip_reservations_serialize( + id=id, + types=types, + include=include, + exclude=exclude, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _response_types_map: Dict[str, Optional[str]] = { + '200': "IPReservationList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _find_ip_reservations_serialize( + self, + id, + types, + include, + exclude, + per_page, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'types': 'multi', + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('per_page') is not None: # noqa: E501 - _query_params.append(('per_page', _params['per_page'])) + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if types is not None: + + _query_params.append(('types', types)) + + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + + if per_page is not None: + + _query_params.append(('per_page', per_page)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "IPReservationList", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{id}/ips', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/projects/{id}/ips', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def request_ip_reservation(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], request_ip_reservation_request : Annotated[RequestIPReservationRequest, Field(..., description="IP Reservation Request to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> RequestIPReservation201Response: # noqa: E501 - """Requesting IP reservations # noqa: E501 - Request more IP space for a project in order to have additional IP addresses to assign to devices. If the request is within the max quota, an IP reservation will be created. If the project will exceed its IP quota, a request will be submitted for review, and will return an IP Reservation with a `state` of `pending`. You can automatically have the request fail with HTTP status 422 instead of triggering the review process by providing the `fail_on_approval_required` parameter set to `true` in the request. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def request_ip_reservation( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + request_ip_reservation_request: Annotated[RequestIPReservationRequest, Field(description="IP Reservation Request to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RequestIPReservation201Response: + """Requesting IP reservations - >>> thread = api.request_ip_reservation(id, request_ip_reservation_request, include, exclude, async_req=True) - >>> result = thread.get() + Request more IP space for a project in order to have additional IP addresses to assign to devices. If the request is within the max quota, an IP reservation will be created. If the project will exceed its IP quota, a request will be submitted for review, and will return an IP Reservation with a `state` of `pending`. You can automatically have the request fail with HTTP status 422 instead of triggering the review process by providing the `fail_on_approval_required` parameter set to `true` in the request. :param id: Project UUID (required) :type id: str @@ -831,32 +1524,80 @@ def request_ip_reservation(self, id : Annotated[StrictStr, Field(..., descriptio :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: RequestIPReservation201Response - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the request_ip_reservation_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.request_ip_reservation_with_http_info(id, request_ip_reservation_request, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def request_ip_reservation_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], request_ip_reservation_request : Annotated[RequestIPReservationRequest, Field(..., description="IP Reservation Request to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Requesting IP reservations # noqa: E501 - - Request more IP space for a project in order to have additional IP addresses to assign to devices. If the request is within the max quota, an IP reservation will be created. If the project will exceed its IP quota, a request will be submitted for review, and will return an IP Reservation with a `state` of `pending`. You can automatically have the request fail with HTTP status 422 instead of triggering the review process by providing the `fail_on_approval_required` parameter set to `true` in the request. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.request_ip_reservation_with_http_info(id, request_ip_reservation_request, include, exclude, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._request_ip_reservation_serialize( + id=id, + request_ip_reservation_request=request_ip_reservation_request, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "RequestIPReservation201Response", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def request_ip_reservation_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + request_ip_reservation_request: Annotated[RequestIPReservationRequest, Field(description="IP Reservation Request to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[RequestIPReservation201Response]: + """Requesting IP reservations + + Request more IP space for a project in order to have additional IP addresses to assign to devices. If the request is within the max quota, an IP reservation will be created. If the project will exceed its IP quota, a request will be submitted for review, and will return an IP Reservation with a `state` of `pending`. You can automatically have the request fail with HTTP status 422 instead of triggering the review process by providing the `fail_on_approval_required` parameter set to `true` in the request. :param id: Project UUID (required) :type id: str @@ -866,138 +1607,246 @@ def request_ip_reservation_with_http_info(self, id : Annotated[StrictStr, Field( :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(RequestIPReservation201Response, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'id', - 'request_ip_reservation_request', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + """ # noqa: E501 + + _param = self._request_ip_reservation_serialize( + id=id, + request_ip_reservation_request=request_ip_reservation_request, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method request_ip_reservation" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '201': "RequestIPReservation201Response", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + @validate_call + def request_ip_reservation_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + request_ip_reservation_request: Annotated[RequestIPReservationRequest, Field(description="IP Reservation Request to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Requesting IP reservations + Request more IP space for a project in order to have additional IP addresses to assign to devices. If the request is within the max quota, an IP reservation will be created. If the project will exceed its IP quota, a request will be submitted for review, and will return an IP Reservation with a `state` of `pending`. You can automatically have the request fail with HTTP status 422 instead of triggering the review process by providing the `fail_on_approval_required` parameter set to `true` in the request. - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + :param id: Project UUID (required) + :type id: str + :param request_ip_reservation_request: IP Reservation Request to create (required) + :type request_ip_reservation_request: RequestIPReservationRequest + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._request_ip_reservation_serialize( + id=id, + request_ip_reservation_request=request_ip_reservation_request, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _response_types_map: Dict[str, Optional[str]] = { + '201': "RequestIPReservation201Response", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _request_ip_reservation_serialize( + self, + id, + request_ip_reservation_request, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['request_ip_reservation_request'] is not None: - _body_params = _params['request_ip_reservation_request'] + if request_ip_reservation_request is not None: + _body_params = request_ip_reservation_request + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '201': "RequestIPReservation201Response", - '401': "Error", - '403': "Error", - '404': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{id}/ips', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/projects/{id}/ips', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def update_ip_address(self, id : Annotated[StrictStr, Field(..., description="IP Address UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, ip_assignment_update_input : Optional[IPAssignmentUpdateInput] = None, **kwargs) -> FindIPAddressById200Response: # noqa: E501 - """Update an ip address # noqa: E501 - Update details about an ip address # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def update_ip_address( + self, + id: Annotated[StrictStr, Field(description="IP Address UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + ip_assignment_update_input: Optional[IPAssignmentUpdateInput] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> FindIPAddressById200Response: + """Update an ip address - >>> thread = api.update_ip_address(id, include, exclude, ip_assignment_update_input, async_req=True) - >>> result = thread.get() + Update details about an ip address :param id: IP Address UUID (required) :type id: str @@ -1007,32 +1856,79 @@ def update_ip_address(self, id : Annotated[StrictStr, Field(..., description="IP :type exclude: List[str] :param ip_assignment_update_input: :type ip_assignment_update_input: IPAssignmentUpdateInput - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: FindIPAddressById200Response - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the update_ip_address_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.update_ip_address_with_http_info(id, include, exclude, ip_assignment_update_input, **kwargs) # noqa: E501 - - @validate_arguments - def update_ip_address_with_http_info(self, id : Annotated[StrictStr, Field(..., description="IP Address UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, ip_assignment_update_input : Optional[IPAssignmentUpdateInput] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Update an ip address # noqa: E501 - - Update details about an ip address # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.update_ip_address_with_http_info(id, include, exclude, ip_assignment_update_input, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._update_ip_address_serialize( + id=id, + include=include, + exclude=exclude, + ip_assignment_update_input=ip_assignment_update_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "FindIPAddressById200Response", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_ip_address_with_http_info( + self, + id: Annotated[StrictStr, Field(description="IP Address UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + ip_assignment_update_input: Optional[IPAssignmentUpdateInput] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[FindIPAddressById200Response]: + """Update an ip address + + Update details about an ip address :param id: IP Address UUID (required) :type id: str @@ -1042,123 +1938,218 @@ def update_ip_address_with_http_info(self, id : Annotated[StrictStr, Field(..., :type exclude: List[str] :param ip_assignment_update_input: :type ip_assignment_update_input: IPAssignmentUpdateInput - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(FindIPAddressById200Response, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'id', - 'include', - 'exclude', - 'ip_assignment_update_input' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + """ # noqa: E501 + + _param = self._update_ip_address_serialize( + id=id, + include=include, + exclude=exclude, + ip_assignment_update_input=ip_assignment_update_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method update_ip_address" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "FindIPAddressById200Response", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + @validate_call + def update_ip_address_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="IP Address UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + ip_assignment_update_input: Optional[IPAssignmentUpdateInput] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update an ip address + Update details about an ip address - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + :param id: IP Address UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param ip_assignment_update_input: + :type ip_assignment_update_input: IPAssignmentUpdateInput + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_ip_address_serialize( + id=id, + include=include, + exclude=exclude, + ip_assignment_update_input=ip_assignment_update_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _response_types_map: Dict[str, Optional[str]] = { + '200': "FindIPAddressById200Response", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_ip_address_serialize( + self, + id, + include, + exclude, + ip_assignment_update_input, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['ip_assignment_update_input'] is not None: - _body_params = _params['ip_assignment_update_input'] + if ip_assignment_update_input is not None: + _body_params = ip_assignment_update_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '200': "FindIPAddressById200Response", - '401': "Error", - '403': "Error", - '404': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/ips/{id}', 'PATCH', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='PATCH', + resource_path='/ips/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/licenses_api.py b/equinix_metal/equinix_metal/api/licenses_api.py index 541f307e..7b73c516 100644 --- a/equinix_metal/equinix_metal/api/licenses_api.py +++ b/equinix_metal/equinix_metal/api/licenses_api.py @@ -12,53 +12,58 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictStr, conint, conlist - -from typing import Optional - +from pydantic import Field, StrictStr +from typing import List, Optional +from typing_extensions import Annotated from equinix_metal.models.license import License from equinix_metal.models.license_create_input import LicenseCreateInput from equinix_metal.models.license_list import LicenseList from equinix_metal.models.license_update_input import LicenseUpdateInput -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class LicensesApi(object): +class LicensesApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def create_license( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + license_create_input: Annotated[LicenseCreateInput, Field(description="License to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> License: + """Create a License - @validate_arguments - def create_license(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], license_create_input : Annotated[LicenseCreateInput, Field(..., description="License to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> License: # noqa: E501 - """Create a License # noqa: E501 - - Creates a new license for the given project # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_license(id, license_create_input, include, exclude, async_req=True) - >>> result = thread.get() + Creates a new license for the given project :param id: Project UUID (required) :type id: str @@ -68,32 +73,80 @@ def create_license(self, id : Annotated[StrictStr, Field(..., description="Proje :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: License - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the create_license_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.create_license_with_http_info(id, license_create_input, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def create_license_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], license_create_input : Annotated[LicenseCreateInput, Field(..., description="License to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Create a License # noqa: E501 - - Creates a new license for the given project # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_license_with_http_info(id, license_create_input, include, exclude, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._create_license_serialize( + id=id, + license_create_input=license_create_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "License", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_license_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + license_create_input: Annotated[LicenseCreateInput, Field(description="License to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[License]: + """Create a License + + Creates a new license for the given project :param id: Project UUID (required) :type id: str @@ -103,275 +156,510 @@ def create_license_with_http_info(self, id : Annotated[StrictStr, Field(..., des :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(License, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'id', - 'license_create_input', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + """ # noqa: E501 + + _param = self._create_license_serialize( + id=id, + license_create_input=license_create_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_license" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '201': "License", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + @validate_call + def create_license_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + license_create_input: Annotated[LicenseCreateInput, Field(description="License to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a License + Creates a new license for the given project - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + :param id: Project UUID (required) + :type id: str + :param license_create_input: License to create (required) + :type license_create_input: LicenseCreateInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_license_serialize( + id=id, + license_create_input=license_create_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "License", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_license_serialize( + self, + id, + license_create_input, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['license_create_input'] is not None: - _body_params = _params['license_create_input'] + if license_create_input is not None: + _body_params = license_create_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '201': "License", - '401': "Error", - '403': "Error", - '404': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{id}/licenses', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/projects/{id}/licenses', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def delete_license(self, id : Annotated[StrictStr, Field(..., description="License UUID")], **kwargs) -> None: # noqa: E501 - """Delete the license # noqa: E501 - Deletes a license. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def delete_license( + self, + id: Annotated[StrictStr, Field(description="License UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete the license - >>> thread = api.delete_license(id, async_req=True) - >>> result = thread.get() + Deletes a license. :param id: License UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the delete_license_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.delete_license_with_http_info(id, **kwargs) # noqa: E501 - - @validate_arguments - def delete_license_with_http_info(self, id : Annotated[StrictStr, Field(..., description="License UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """Delete the license # noqa: E501 - - Deletes a license. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_license_with_http_info(id, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._delete_license_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_license_with_http_info( + self, + id: Annotated[StrictStr, Field(description="License UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete the license + + Deletes a license. :param id: License UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 + + _param = self._delete_license_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def delete_license_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="License UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete the license + + Deletes a license. + + :param id: License UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_license_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_license" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _delete_license_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/licenses/{id}', 'DELETE', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='DELETE', + resource_path='/licenses/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_license_by_id(self, id : Annotated[StrictStr, Field(..., description="License UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> License: # noqa: E501 - """Retrieve a license # noqa: E501 - Returns a license # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_license_by_id( + self, + id: Annotated[StrictStr, Field(description="License UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> License: + """Retrieve a license - >>> thread = api.find_license_by_id(id, include, exclude, async_req=True) - >>> result = thread.get() + Returns a license :param id: License UUID (required) :type id: str @@ -379,32 +667,77 @@ def find_license_by_id(self, id : Annotated[StrictStr, Field(..., description="L :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: License - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_license_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_license_by_id_with_http_info(id, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def find_license_by_id_with_http_info(self, id : Annotated[StrictStr, Field(..., description="License UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve a license # noqa: E501 - - Returns a license # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_license_by_id_with_http_info(id, include, exclude, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_license_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "License", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_license_by_id_with_http_info( + self, + id: Annotated[StrictStr, Field(description="License UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[License]: + """Retrieve a license + + Returns a license :param id: License UUID (required) :type id: str @@ -412,126 +745,224 @@ def find_license_by_id_with_http_info(self, id : Annotated[StrictStr, Field(..., :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(License, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_license_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "License", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def find_license_by_id_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="License UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve a license + + Returns a license + + :param id: License UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_license_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_license_by_id" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "License", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_license_by_id_serialize( + self, + id, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "License", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/licenses/{id}', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/licenses/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_project_licenses(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> LicenseList: # noqa: E501 - """Retrieve all licenses # noqa: E501 - Provides a collection of licenses for a given project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_project_licenses( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LicenseList: + """Retrieve all licenses - >>> thread = api.find_project_licenses(id, include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + Provides a collection of licenses for a given project. :param id: Project UUID (required) :type id: str @@ -543,32 +974,81 @@ def find_project_licenses(self, id : Annotated[StrictStr, Field(..., description :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: LicenseList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_project_licenses_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_project_licenses_with_http_info(id, include, exclude, page, per_page, **kwargs) # noqa: E501 - - @validate_arguments - def find_project_licenses_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve all licenses # noqa: E501 - - Provides a collection of licenses for a given project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_project_licenses_with_http_info(id, include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_project_licenses_serialize( + id=id, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "LicenseList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_project_licenses_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LicenseList]: + """Retrieve all licenses + + Provides a collection of licenses for a given project. :param id: Project UUID (required) :type id: str @@ -580,134 +1060,243 @@ def find_project_licenses_with_http_info(self, id : Annotated[StrictStr, Field(. :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(LicenseList, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'id', - 'include', - 'exclude', - 'page', - 'per_page' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + """ # noqa: E501 + + _param = self._find_project_licenses_serialize( + id=id, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_project_licenses" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} + _response_types_map: Dict[str, Optional[str]] = { + '200': "LicenseList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + @validate_call + def find_project_licenses_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all licenses - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + Provides a collection of licenses for a given project. - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + :param id: Project UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param page: Page to return + :type page: int + :param per_page: Items returned per page + :type per_page: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_project_licenses_serialize( + id=id, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - if _params.get('page') is not None: # noqa: E501 - _query_params.append(('page', _params['page'])) + _response_types_map: Dict[str, Optional[str]] = { + '200': "LicenseList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _find_project_licenses_serialize( + self, + id, + include, + exclude, + page, + per_page, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('per_page') is not None: # noqa: E501 - _query_params.append(('per_page', _params['per_page'])) + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + + if page is not None: + + _query_params.append(('page', page)) + + if per_page is not None: + + _query_params.append(('per_page', per_page)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "LicenseList", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{id}/licenses', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/projects/{id}/licenses', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def update_license(self, id : Annotated[StrictStr, Field(..., description="License UUID")], license_update_input : Annotated[LicenseUpdateInput, Field(..., description="License to update")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> License: # noqa: E501 - """Update the license # noqa: E501 - Updates the license. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def update_license( + self, + id: Annotated[StrictStr, Field(description="License UUID")], + license_update_input: Annotated[LicenseUpdateInput, Field(description="License to update")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> License: + """Update the license - >>> thread = api.update_license(id, license_update_input, include, exclude, async_req=True) - >>> result = thread.get() + Updates the license. :param id: License UUID (required) :type id: str @@ -717,32 +1306,80 @@ def update_license(self, id : Annotated[StrictStr, Field(..., description="Licen :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: License - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the update_license_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.update_license_with_http_info(id, license_update_input, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def update_license_with_http_info(self, id : Annotated[StrictStr, Field(..., description="License UUID")], license_update_input : Annotated[LicenseUpdateInput, Field(..., description="License to update")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Update the license # noqa: E501 - - Updates the license. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.update_license_with_http_info(id, license_update_input, include, exclude, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._update_license_serialize( + id=id, + license_update_input=license_update_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "License", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_license_with_http_info( + self, + id: Annotated[StrictStr, Field(description="License UUID")], + license_update_input: Annotated[LicenseUpdateInput, Field(description="License to update")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[License]: + """Update the license + + Updates the license. :param id: License UUID (required) :type id: str @@ -752,124 +1389,220 @@ def update_license_with_http_info(self, id : Annotated[StrictStr, Field(..., des :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(License, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'id', - 'license_update_input', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + """ # noqa: E501 + + _param = self._update_license_serialize( + id=id, + license_update_input=license_update_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method update_license" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "License", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + @validate_call + def update_license_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="License UUID")], + license_update_input: Annotated[LicenseUpdateInput, Field(description="License to update")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update the license + Updates the license. - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + :param id: License UUID (required) + :type id: str + :param license_update_input: License to update (required) + :type license_update_input: LicenseUpdateInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_license_serialize( + id=id, + license_update_input=license_update_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _response_types_map: Dict[str, Optional[str]] = { + '200': "License", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_license_serialize( + self, + id, + license_update_input, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['license_update_input'] is not None: - _body_params = _params['license_update_input'] + if license_update_input is not None: + _body_params = license_update_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '200': "License", - '401': "Error", - '403': "Error", - '404': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/licenses/{id}', 'PUT', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='PUT', + resource_path='/licenses/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/memberships_api.py b/equinix_metal/equinix_metal/api/memberships_api.py index 0bceea6c..a23c2be8 100644 --- a/equinix_metal/equinix_metal/api/memberships_api.py +++ b/equinix_metal/equinix_metal/api/memberships_api.py @@ -12,339 +12,603 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictStr, conlist - -from typing import Optional - +from pydantic import Field, StrictStr +from typing import List, Optional +from typing_extensions import Annotated from equinix_metal.models.membership import Membership from equinix_metal.models.membership_input import MembershipInput -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class MembershipsApi(object): +class MembershipsApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def delete_membership( + self, + id: Annotated[StrictStr, Field(description="Membership UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete the membership - @validate_arguments - def delete_membership(self, id : Annotated[StrictStr, Field(..., description="Membership UUID")], **kwargs) -> None: # noqa: E501 - """Delete the membership # noqa: E501 - - Deletes the membership. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_membership(id, async_req=True) - >>> result = thread.get() + Deletes the membership. :param id: Membership UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the delete_membership_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.delete_membership_with_http_info(id, **kwargs) # noqa: E501 - - @validate_arguments - def delete_membership_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Membership UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """Delete the membership # noqa: E501 - - Deletes the membership. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_membership_with_http_info(id, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._delete_membership_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_membership_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Membership UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete the membership + + Deletes the membership. :param id: Membership UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 + + _param = self._delete_membership_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def delete_membership_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Membership UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete the membership + + Deletes the membership. + + :param id: Membership UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_membership_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_membership" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _delete_membership_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/memberships/{id}', 'DELETE', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='DELETE', + resource_path='/memberships/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_membership_by_id(self, id : Annotated[StrictStr, Field(..., description="Membership UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> Membership: # noqa: E501 - """Retrieve a membership # noqa: E501 - Returns a single membership. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_membership_by_id( + self, + id: Annotated[StrictStr, Field(description="Membership UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Membership: + """Retrieve a membership - >>> thread = api.find_membership_by_id(id, include, async_req=True) - >>> result = thread.get() + Returns a single membership. :param id: Membership UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Membership - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_membership_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_membership_by_id_with_http_info(id, include, **kwargs) # noqa: E501 - - @validate_arguments - def find_membership_by_id_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Membership UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve a membership # noqa: E501 - - Returns a single membership. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_membership_by_id_with_http_info(id, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_membership_by_id_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Membership", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_membership_by_id_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Membership UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Membership]: + """Retrieve a membership + + Returns a single membership. :param id: Membership UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Membership, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_membership_by_id_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "Membership", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def find_membership_by_id_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Membership UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve a membership + + Returns a single membership. + + :param id: Membership UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_membership_by_id_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_membership_by_id" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "Membership", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_membership_by_id_serialize( + self, + id, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "Membership", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/memberships/{id}', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/memberships/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def update_membership(self, id : Annotated[StrictStr, Field(..., description="Membership UUID")], membership_input : Annotated[MembershipInput, Field(..., description="Membership to update")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> Membership: # noqa: E501 - """Update the membership # noqa: E501 - Updates the membership. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def update_membership( + self, + id: Annotated[StrictStr, Field(description="Membership UUID")], + membership_input: Annotated[MembershipInput, Field(description="Membership to update")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Membership: + """Update the membership - >>> thread = api.update_membership(id, membership_input, include, async_req=True) - >>> result = thread.get() + Updates the membership. :param id: Membership UUID (required) :type id: str @@ -352,32 +616,78 @@ def update_membership(self, id : Annotated[StrictStr, Field(..., description="Me :type membership_input: MembershipInput :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Membership - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the update_membership_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.update_membership_with_http_info(id, membership_input, include, **kwargs) # noqa: E501 - - @validate_arguments - def update_membership_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Membership UUID")], membership_input : Annotated[MembershipInput, Field(..., description="Membership to update")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Update the membership # noqa: E501 - - Updates the membership. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.update_membership_with_http_info(id, membership_input, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._update_membership_serialize( + id=id, + membership_input=membership_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Membership", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_membership_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Membership UUID")], + membership_input: Annotated[MembershipInput, Field(description="Membership to update")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Membership]: + """Update the membership + + Updates the membership. :param id: Membership UUID (required) :type id: str @@ -385,119 +695,209 @@ def update_membership_with_http_info(self, id : Annotated[StrictStr, Field(..., :type membership_input: MembershipInput :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Membership, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._update_membership_serialize( + id=id, + membership_input=membership_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Membership", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id', - 'membership_input', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def update_membership_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Membership UUID")], + membership_input: Annotated[MembershipInput, Field(description="Membership to update")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update the membership + + Updates the membership. + + :param id: Membership UUID (required) + :type id: str + :param membership_input: Membership to update (required) + :type membership_input: MembershipInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_membership_serialize( + id=id, + membership_input=membership_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method update_membership" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "Membership", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _update_membership_serialize( + self, + id, + membership_input, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['membership_input'] is not None: - _body_params = _params['membership_input'] + if membership_input is not None: + _body_params = membership_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '200': "Membership", - '401': "Error", - '403': "Error", - '404': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/memberships/{id}', 'PUT', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='PUT', + resource_path='/memberships/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/metal_gateways_api.py b/equinix_metal/equinix_metal/api/metal_gateways_api.py index 89721553..e07e3398 100644 --- a/equinix_metal/equinix_metal/api/metal_gateways_api.py +++ b/equinix_metal/equinix_metal/api/metal_gateways_api.py @@ -12,18 +12,14 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictStr, conint, conlist - -from typing import Optional - +from pydantic import Field, StrictStr +from typing import List, Optional +from typing_extensions import Annotated from equinix_metal.models.create_metal_gateway_request import CreateMetalGatewayRequest from equinix_metal.models.find_metal_gateway_by_id200_response import FindMetalGatewayById200Response from equinix_metal.models.ip_assignment import IPAssignment @@ -31,36 +27,47 @@ from equinix_metal.models.metal_gateway_elastic_ip_create_input import MetalGatewayElasticIpCreateInput from equinix_metal.models.metal_gateway_list import MetalGatewayList -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class MetalGatewaysApi(object): +class MetalGatewaysApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def create_metal_gateway( + self, + project_id: Annotated[StrictStr, Field(description="Project UUID")], + create_metal_gateway_request: Annotated[CreateMetalGatewayRequest, Field(description="Metal Gateway to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> FindMetalGatewayById200Response: + """Create a metal gateway - @validate_arguments - def create_metal_gateway(self, project_id : Annotated[StrictStr, Field(..., description="Project UUID")], create_metal_gateway_request : Annotated[CreateMetalGatewayRequest, Field(..., description="Metal Gateway to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> FindMetalGatewayById200Response: # noqa: E501 - """Create a metal gateway # noqa: E501 - - Create a metal gateway in a project # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_metal_gateway(project_id, create_metal_gateway_request, include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + Create a metal gateway in a project :param project_id: Project UUID (required) :type project_id: str @@ -74,32 +81,83 @@ def create_metal_gateway(self, project_id : Annotated[StrictStr, Field(..., desc :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: FindMetalGatewayById200Response - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the create_metal_gateway_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.create_metal_gateway_with_http_info(project_id, create_metal_gateway_request, include, exclude, page, per_page, **kwargs) # noqa: E501 - - @validate_arguments - def create_metal_gateway_with_http_info(self, project_id : Annotated[StrictStr, Field(..., description="Project UUID")], create_metal_gateway_request : Annotated[CreateMetalGatewayRequest, Field(..., description="Metal Gateway to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Create a metal gateway # noqa: E501 + """ # noqa: E501 + + _param = self._create_metal_gateway_serialize( + project_id=project_id, + create_metal_gateway_request=create_metal_gateway_request, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Create a metal gateway in a project # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '201': "FindMetalGatewayById200Response", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_metal_gateway_with_http_info( + self, + project_id: Annotated[StrictStr, Field(description="Project UUID")], + create_metal_gateway_request: Annotated[CreateMetalGatewayRequest, Field(description="Metal Gateway to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[FindMetalGatewayById200Response]: + """Create a metal gateway - >>> thread = api.create_metal_gateway_with_http_info(project_id, create_metal_gateway_request, include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + Create a metal gateway in a project :param project_id: Project UUID (required) :type project_id: str @@ -113,145 +171,264 @@ def create_metal_gateway_with_http_info(self, project_id : Annotated[StrictStr, :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(FindMetalGatewayById200Response, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'project_id', - 'create_metal_gateway_request', - 'include', - 'exclude', - 'page', - 'per_page' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + """ # noqa: E501 + + _param = self._create_metal_gateway_serialize( + project_id=project_id, + create_metal_gateway_request=create_metal_gateway_request, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_metal_gateway" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} + _response_types_map: Dict[str, Optional[str]] = { + '201': "FindMetalGatewayById200Response", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - # process the path parameters - _path_params = {} - if _params['project_id']: - _path_params['project_id'] = _params['project_id'] + @validate_call + def create_metal_gateway_without_preload_content( + self, + project_id: Annotated[StrictStr, Field(description="Project UUID")], + create_metal_gateway_request: Annotated[CreateMetalGatewayRequest, Field(description="Metal Gateway to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a metal gateway - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + Create a metal gateway in a project - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + :param project_id: Project UUID (required) + :type project_id: str + :param create_metal_gateway_request: Metal Gateway to create (required) + :type create_metal_gateway_request: CreateMetalGatewayRequest + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param page: Page to return + :type page: int + :param per_page: Items returned per page + :type per_page: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_metal_gateway_serialize( + project_id=project_id, + create_metal_gateway_request=create_metal_gateway_request, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - if _params.get('page') is not None: # noqa: E501 - _query_params.append(('page', _params['page'])) + _response_types_map: Dict[str, Optional[str]] = { + '201': "FindMetalGatewayById200Response", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_metal_gateway_serialize( + self, + project_id, + create_metal_gateway_request, + include, + exclude, + page, + per_page, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('per_page') is not None: # noqa: E501 - _query_params.append(('per_page', _params['per_page'])) + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if project_id is not None: + _path_params['project_id'] = project_id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + + if page is not None: + + _query_params.append(('page', page)) + + if per_page is not None: + + _query_params.append(('per_page', per_page)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['create_metal_gateway_request'] is not None: - _body_params = _params['create_metal_gateway_request'] + if create_metal_gateway_request is not None: + _body_params = create_metal_gateway_request + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '201': "FindMetalGatewayById200Response", - '401': "Error", - '404': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{project_id}/metal-gateways', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/projects/{project_id}/metal-gateways', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def create_metal_gateway_elastic_ip(self, id : Annotated[StrictStr, Field(..., description="Metal Gateway UUID")], metal_gateway_elastic_ip_create_input : MetalGatewayElasticIpCreateInput, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> IPAssignment: # noqa: E501 - """Create a Metal Gateway Elastic IP # noqa: E501 - Create a new Elastic IP on this Metal Gateway. Assign an IPv4 range as an elastic IP to the Metal Gateway, with a specified next-hop address contained within the Metal Gateway. Notice: Elastic IPs on Metal Gateways are a test feature currently under active development, and only available to certain users. Please contact Customer Success for more information. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def create_metal_gateway_elastic_ip( + self, + id: Annotated[StrictStr, Field(description="Metal Gateway UUID")], + metal_gateway_elastic_ip_create_input: MetalGatewayElasticIpCreateInput, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> IPAssignment: + """Create a Metal Gateway Elastic IP - >>> thread = api.create_metal_gateway_elastic_ip(id, metal_gateway_elastic_ip_create_input, include, exclude, async_req=True) - >>> result = thread.get() + Create a new Elastic IP on this Metal Gateway. Assign an IPv4 range as an elastic IP to the Metal Gateway, with a specified next-hop address contained within the Metal Gateway. Notice: Elastic IPs on Metal Gateways are a test feature currently under active development, and only available to certain users. Please contact Customer Success for more information. :param id: Metal Gateway UUID (required) :type id: str @@ -261,32 +438,80 @@ def create_metal_gateway_elastic_ip(self, id : Annotated[StrictStr, Field(..., d :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: IPAssignment - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the create_metal_gateway_elastic_ip_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.create_metal_gateway_elastic_ip_with_http_info(id, metal_gateway_elastic_ip_create_input, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def create_metal_gateway_elastic_ip_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Metal Gateway UUID")], metal_gateway_elastic_ip_create_input : MetalGatewayElasticIpCreateInput, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Create a Metal Gateway Elastic IP # noqa: E501 + """ # noqa: E501 + + _param = self._create_metal_gateway_elastic_ip_serialize( + id=id, + metal_gateway_elastic_ip_create_input=metal_gateway_elastic_ip_create_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Create a new Elastic IP on this Metal Gateway. Assign an IPv4 range as an elastic IP to the Metal Gateway, with a specified next-hop address contained within the Metal Gateway. Notice: Elastic IPs on Metal Gateways are a test feature currently under active development, and only available to certain users. Please contact Customer Success for more information. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '201': "IPAssignment", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_metal_gateway_elastic_ip_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Metal Gateway UUID")], + metal_gateway_elastic_ip_create_input: MetalGatewayElasticIpCreateInput, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[IPAssignment]: + """Create a Metal Gateway Elastic IP - >>> thread = api.create_metal_gateway_elastic_ip_with_http_info(id, metal_gateway_elastic_ip_create_input, include, exclude, async_req=True) - >>> result = thread.get() + Create a new Elastic IP on this Metal Gateway. Assign an IPv4 range as an elastic IP to the Metal Gateway, with a specified next-hop address contained within the Metal Gateway. Notice: Elastic IPs on Metal Gateways are a test feature currently under active development, and only available to certain users. Please contact Customer Success for more information. :param id: Metal Gateway UUID (required) :type id: str @@ -296,138 +521,245 @@ def create_metal_gateway_elastic_ip_with_http_info(self, id : Annotated[StrictSt :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(IPAssignment, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() + """ # noqa: E501 + + _param = self._create_metal_gateway_elastic_ip_serialize( + id=id, + metal_gateway_elastic_ip_create_input=metal_gateway_elastic_ip_create_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _all_params = [ - 'id', - 'metal_gateway_elastic_ip_create_input', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + _response_types_map: Dict[str, Optional[str]] = { + '201': "IPAssignment", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_metal_gateway_elastic_ip" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + @validate_call + def create_metal_gateway_elastic_ip_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Metal Gateway UUID")], + metal_gateway_elastic_ip_create_input: MetalGatewayElasticIpCreateInput, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a Metal Gateway Elastic IP - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + Create a new Elastic IP on this Metal Gateway. Assign an IPv4 range as an elastic IP to the Metal Gateway, with a specified next-hop address contained within the Metal Gateway. Notice: Elastic IPs on Metal Gateways are a test feature currently under active development, and only available to certain users. Please contact Customer Success for more information. + :param id: Metal Gateway UUID (required) + :type id: str + :param metal_gateway_elastic_ip_create_input: (required) + :type metal_gateway_elastic_ip_create_input: MetalGatewayElasticIpCreateInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_metal_gateway_elastic_ip_serialize( + id=id, + metal_gateway_elastic_ip_create_input=metal_gateway_elastic_ip_create_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _response_types_map: Dict[str, Optional[str]] = { + '201': "IPAssignment", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_metal_gateway_elastic_ip_serialize( + self, + id, + metal_gateway_elastic_ip_create_input, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['metal_gateway_elastic_ip_create_input'] is not None: - _body_params = _params['metal_gateway_elastic_ip_create_input'] + if metal_gateway_elastic_ip_create_input is not None: + _body_params = metal_gateway_elastic_ip_create_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '201': "IPAssignment", - '401': "Error", - '403': "Error", - '404': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/metal-gateways/{id}/ips', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/metal-gateways/{id}/ips', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def delete_metal_gateway(self, id : Annotated[StrictStr, Field(..., description="Metal Gateway UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> FindMetalGatewayById200Response: # noqa: E501 - """Deletes the metal gateway # noqa: E501 - Deletes a metal gateway and any elastic IP assignments associated with this metal gateway. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def delete_metal_gateway( + self, + id: Annotated[StrictStr, Field(description="Metal Gateway UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> FindMetalGatewayById200Response: + """Deletes the metal gateway - >>> thread = api.delete_metal_gateway(id, include, exclude, async_req=True) - >>> result = thread.get() + Deletes a metal gateway and any elastic IP assignments associated with this metal gateway. :param id: Metal Gateway UUID (required) :type id: str @@ -435,32 +767,76 @@ def delete_metal_gateway(self, id : Annotated[StrictStr, Field(..., description= :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: FindMetalGatewayById200Response - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the delete_metal_gateway_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.delete_metal_gateway_with_http_info(id, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def delete_metal_gateway_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Metal Gateway UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Deletes the metal gateway # noqa: E501 + """ # noqa: E501 + + _param = self._delete_metal_gateway_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Deletes a metal gateway and any elastic IP assignments associated with this metal gateway. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '202': "FindMetalGatewayById200Response", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_metal_gateway_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Metal Gateway UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[FindMetalGatewayById200Response]: + """Deletes the metal gateway - >>> thread = api.delete_metal_gateway_with_http_info(id, include, exclude, async_req=True) - >>> result = thread.get() + Deletes a metal gateway and any elastic IP assignments associated with this metal gateway. :param id: Metal Gateway UUID (required) :type id: str @@ -468,125 +844,297 @@ def delete_metal_gateway_with_http_info(self, id : Annotated[StrictStr, Field(.. :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(FindMetalGatewayById200Response, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._delete_metal_gateway_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '202': "FindMetalGatewayById200Response", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def delete_metal_gateway_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Metal Gateway UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Deletes the metal gateway + + Deletes a metal gateway and any elastic IP assignments associated with this metal gateway. + + :param id: Metal Gateway UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_metal_gateway_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_metal_gateway" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '202': "FindMetalGatewayById200Response", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _delete_metal_gateway_serialize( + self, + id, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '202': "FindMetalGatewayById200Response", - '401': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/metal-gateways/{id}', 'DELETE', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='DELETE', + resource_path='/metal-gateways/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + + @validate_call + def find_metal_gateway_by_id( + self, + id: Annotated[StrictStr, Field(description="Metal Gateway UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> FindMetalGatewayById200Response: + """Returns the metal gateway - @validate_arguments - def find_metal_gateway_by_id(self, id : Annotated[StrictStr, Field(..., description="Metal Gateway UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> FindMetalGatewayById200Response: # noqa: E501 - """Returns the metal gateway # noqa: E501 + Returns a specific metal gateway + + :param id: Metal Gateway UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_metal_gateway_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Returns a specific metal gateway # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "FindMetalGatewayById200Response", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_metal_gateway_by_id_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Metal Gateway UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[FindMetalGatewayById200Response]: + """Returns the metal gateway - >>> thread = api.find_metal_gateway_by_id(id, include, exclude, async_req=True) - >>> result = thread.get() + Returns a specific metal gateway :param id: Metal Gateway UUID (required) :type id: str @@ -594,32 +1142,76 @@ def find_metal_gateway_by_id(self, id : Annotated[StrictStr, Field(..., descript :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: FindMetalGatewayById200Response - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_metal_gateway_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_metal_gateway_by_id_with_http_info(id, include, exclude, **kwargs) # noqa: E501 + """ # noqa: E501 + + _param = self._find_metal_gateway_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "FindMetalGatewayById200Response", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - @validate_arguments - def find_metal_gateway_by_id_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Metal Gateway UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Returns the metal gateway # noqa: E501 - Returns a specific metal gateway # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_metal_gateway_by_id_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Metal Gateway UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Returns the metal gateway - >>> thread = api.find_metal_gateway_by_id_with_http_info(id, include, exclude, async_req=True) - >>> result = thread.get() + Returns a specific metal gateway :param id: Metal Gateway UUID (required) :type id: str @@ -627,117 +1219,123 @@ def find_metal_gateway_by_id_with_http_info(self, id : Annotated[StrictStr, Fiel :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(FindMetalGatewayById200Response, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'id', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + """ # noqa: E501 + + _param = self._find_metal_gateway_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_metal_gateway_by_id" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "FindMetalGatewayById200Response", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_metal_gateway_by_id_serialize( + self, + id, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "FindMetalGatewayById200Response", - '401': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/metal-gateways/{id}', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/metal-gateways/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + - @validate_arguments - def find_metal_gateways_by_project_all_pages(self, project_id : Annotated[StrictStr, Field(..., description="Project UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> MetalGatewayList: # noqa: E501 + @validate_call + def find_metal_gateways_by_project_all_pages(self, project_id : Annotated[StrictStr, Field(description="Project UUID")], include : Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, per_page : Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, **kwargs) -> MetalGatewayList: # noqa: E501 """Returns all metal gateways for a project # noqa: E501 This method is the same as find_metal_gateways_by_project, but fetches resources from all the pages. @@ -788,19 +1386,33 @@ def find_metal_gateways_by_project_all_pages(self, project_id : Annotated[Strict if page_response.meta.next is None: break page += 1 - - return all_pages - @validate_arguments - def find_metal_gateways_by_project(self, project_id : Annotated[StrictStr, Field(..., description="Project UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> MetalGatewayList: # noqa: E501 - """Returns all metal gateways for a project # noqa: E501 + return all_pages - Return all metal gateways for a project # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_metal_gateways_by_project( + self, + project_id: Annotated[StrictStr, Field(description="Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> MetalGatewayList: + """Returns all metal gateways for a project - >>> thread = api.find_metal_gateways_by_project(project_id, include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + Return all metal gateways for a project :param project_id: Project UUID (required) :type project_id: str @@ -812,32 +1424,80 @@ def find_metal_gateways_by_project(self, project_id : Annotated[StrictStr, Field :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: MetalGatewayList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_metal_gateways_by_project_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_metal_gateways_by_project_with_http_info(project_id, include, exclude, page, per_page, **kwargs) # noqa: E501 - - @validate_arguments - def find_metal_gateways_by_project_with_http_info(self, project_id : Annotated[StrictStr, Field(..., description="Project UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Returns all metal gateways for a project # noqa: E501 + """ # noqa: E501 + + _param = self._find_metal_gateways_by_project_serialize( + project_id=project_id, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Return all metal gateways for a project # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "MetalGatewayList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_metal_gateways_by_project_with_http_info( + self, + project_id: Annotated[StrictStr, Field(description="Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[MetalGatewayList]: + """Returns all metal gateways for a project - >>> thread = api.find_metal_gateways_by_project_with_http_info(project_id, include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + Return all metal gateways for a project :param project_id: Project UUID (required) :type project_id: str @@ -849,133 +1509,240 @@ def find_metal_gateways_by_project_with_http_info(self, project_id : Annotated[S :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(MetalGatewayList, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'project_id', - 'include', - 'exclude', - 'page', - 'per_page' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + """ # noqa: E501 + + _param = self._find_metal_gateways_by_project_serialize( + project_id=project_id, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_metal_gateways_by_project" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} + _response_types_map: Dict[str, Optional[str]] = { + '200': "MetalGatewayList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - # process the path parameters - _path_params = {} - if _params['project_id']: - _path_params['project_id'] = _params['project_id'] + @validate_call + def find_metal_gateways_by_project_without_preload_content( + self, + project_id: Annotated[StrictStr, Field(description="Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Returns all metal gateways for a project - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + Return all metal gateways for a project - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + :param project_id: Project UUID (required) + :type project_id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param page: Page to return + :type page: int + :param per_page: Items returned per page + :type per_page: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_metal_gateways_by_project_serialize( + project_id=project_id, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - if _params.get('page') is not None: # noqa: E501 - _query_params.append(('page', _params['page'])) + _response_types_map: Dict[str, Optional[str]] = { + '200': "MetalGatewayList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _find_metal_gateways_by_project_serialize( + self, + project_id, + include, + exclude, + page, + per_page, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('per_page') is not None: # noqa: E501 - _query_params.append(('per_page', _params['per_page'])) + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if project_id is not None: + _path_params['project_id'] = project_id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + + if page is not None: + + _query_params.append(('page', page)) + + if per_page is not None: + + _query_params.append(('per_page', per_page)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "MetalGatewayList", - '401': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{project_id}/metal-gateways', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/projects/{project_id}/metal-gateways', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def get_metal_gateway_elastic_ips(self, id : Annotated[StrictStr, Field(..., description="Metal Gateway UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> IPAssignmentList: # noqa: E501 - """List Metal Gateway Elastic IPs # noqa: E501 - Returns the list of Elastic IPs assigned to this Metal Gateway # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def get_metal_gateway_elastic_ips( + self, + id: Annotated[StrictStr, Field(description="Metal Gateway UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> IPAssignmentList: + """List Metal Gateway Elastic IPs - >>> thread = api.get_metal_gateway_elastic_ips(id, include, exclude, async_req=True) - >>> result = thread.get() + Returns the list of Elastic IPs assigned to this Metal Gateway :param id: Metal Gateway UUID (required) :type id: str @@ -983,32 +1750,76 @@ def get_metal_gateway_elastic_ips(self, id : Annotated[StrictStr, Field(..., des :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: IPAssignmentList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the get_metal_gateway_elastic_ips_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.get_metal_gateway_elastic_ips_with_http_info(id, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def get_metal_gateway_elastic_ips_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Metal Gateway UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """List Metal Gateway Elastic IPs # noqa: E501 + """ # noqa: E501 + + _param = self._get_metal_gateway_elastic_ips_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Returns the list of Elastic IPs assigned to this Metal Gateway # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "IPAssignmentList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_metal_gateway_elastic_ips_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Metal Gateway UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[IPAssignmentList]: + """List Metal Gateway Elastic IPs - >>> thread = api.get_metal_gateway_elastic_ips_with_http_info(id, include, exclude, async_req=True) - >>> result = thread.get() + Returns the list of Elastic IPs assigned to this Metal Gateway :param id: Metal Gateway UUID (required) :type id: str @@ -1016,111 +1827,195 @@ def get_metal_gateway_elastic_ips_with_http_info(self, id : Annotated[StrictStr, :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(IPAssignmentList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._get_metal_gateway_elastic_ips_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "IPAssignmentList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def get_metal_gateway_elastic_ips_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Metal Gateway UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Metal Gateway Elastic IPs + + Returns the list of Elastic IPs assigned to this Metal Gateway + + :param id: Metal Gateway UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_metal_gateway_elastic_ips_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_metal_gateway_elastic_ips" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "IPAssignmentList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _get_metal_gateway_elastic_ips_serialize( + self, + id, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "IPAssignmentList", - '401': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/metal-gateways/{id}/ips', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/metal-gateways/{id}/ips', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/metros_api.py b/equinix_metal/equinix_metal/api/metros_api.py index 05887037..b6fff448 100644 --- a/equinix_metal/equinix_metal/api/metros_api.py +++ b/equinix_metal/equinix_metal/api/metros_api.py @@ -12,307 +12,532 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated from pydantic import Field, StrictStr - +from typing_extensions import Annotated from equinix_metal.models.metro import Metro from equinix_metal.models.metro_list import MetroList -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class MetrosApi(object): +class MetrosApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def find_metros( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> MetroList: + """Retrieve all metros + + Provides a listing of available metros - @validate_arguments - def find_metros(self, **kwargs) -> MetroList: # noqa: E501 - """Retrieve all metros # noqa: E501 + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_metros_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Provides a listing of available metros # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "MetroList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_metros_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[MetroList]: + """Retrieve all metros - >>> thread = api.find_metros(async_req=True) - >>> result = thread.get() + Provides a listing of available metros - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: MetroList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_metros_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_metros_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - def find_metros_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve all metros # noqa: E501 - - Provides a listing of available metros # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_metros_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + """ # noqa: E501 + + _param = self._find_metros_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MetroList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def find_metros_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all metros + + Provides a listing of available metros + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(MetroList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 - _params = locals() + _param = self._find_metros_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _all_params = [ - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + _response_types_map: Dict[str, Optional[str]] = { + '200': "MetroList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) + return response_data.response - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_metros" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + def _find_metros_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the path parameters - _path_params = {} + _host = None + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "MetroList", - '401': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/locations/metros', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/locations/metros', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def get_metro(self, id : Annotated[StrictStr, Field(..., description="Metro UUID")], **kwargs) -> Metro: # noqa: E501 - """Retrieve a specific Metro's details # noqa: E501 - Show the details for a metro, including name, code, and country. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def get_metro( + self, + id: Annotated[StrictStr, Field(description="Metro UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Metro: + """Retrieve a specific Metro's details - >>> thread = api.get_metro(id, async_req=True) - >>> result = thread.get() + Show the details for a metro, including name, code, and country. :param id: Metro UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Metro - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the get_metro_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.get_metro_with_http_info(id, **kwargs) # noqa: E501 - - @validate_arguments - def get_metro_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Metro UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve a specific Metro's details # noqa: E501 - - Show the details for a metro, including name, code, and country. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.get_metro_with_http_info(id, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._get_metro_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Metro", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_metro_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Metro UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Metro]: + """Retrieve a specific Metro's details + + Show the details for a metro, including name, code, and country. :param id: Metro UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Metro, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._get_metro_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "Metro", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def get_metro_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Metro UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve a specific Metro's details + + Show the details for a metro, including name, code, and country. + + :param id: Metro UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_metro_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_metro" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "Metro", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _get_metro_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "Metro", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/locations/metros/{id}', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/locations/metros/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/operating_systems_api.py b/equinix_metal/equinix_metal/api/operating_systems_api.py index 0522e46b..a63164dc 100644 --- a/equinix_metal/equinix_metal/api/operating_systems_api.py +++ b/equinix_metal/equinix_metal/api/operating_systems_api.py @@ -12,296 +12,514 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated from equinix_metal.models.operating_system_list import OperatingSystemList -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class OperatingSystemsApi(object): +class OperatingSystemsApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def find_operating_system_version( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> OperatingSystemList: + """Retrieve all operating system versions - @validate_arguments - def find_operating_system_version(self, **kwargs) -> OperatingSystemList: # noqa: E501 - """Retrieve all operating system versions # noqa: E501 + Provides a listing of available operating system versions. - Provides a listing of available operating system versions. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_operating_system_version_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OperatingSystemList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_operating_system_version_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[OperatingSystemList]: + """Retrieve all operating system versions - >>> thread = api.find_operating_system_version(async_req=True) - >>> result = thread.get() + Provides a listing of available operating system versions. - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: OperatingSystemList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_operating_system_version_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_operating_system_version_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - def find_operating_system_version_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve all operating system versions # noqa: E501 - - Provides a listing of available operating system versions. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_operating_system_version_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + """ # noqa: E501 + + _param = self._find_operating_system_version_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OperatingSystemList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def find_operating_system_version_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all operating system versions + + Provides a listing of available operating system versions. + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(OperatingSystemList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 - _params = locals() + _param = self._find_operating_system_version_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _all_params = [ - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + _response_types_map: Dict[str, Optional[str]] = { + '200': "OperatingSystemList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) + return response_data.response - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_operating_system_version" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + def _find_operating_system_version_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the path parameters - _path_params = {} + _host = None + + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "OperatingSystemList", - '401': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/operating-system-versions', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/operating-system-versions', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_operating_systems(self, **kwargs) -> OperatingSystemList: # noqa: E501 - """Retrieve all operating systems # noqa: E501 - Provides a listing of available operating systems to provision your new device with. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_operating_systems( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> OperatingSystemList: + """Retrieve all operating systems - >>> thread = api.find_operating_systems(async_req=True) - >>> result = thread.get() + Provides a listing of available operating systems to provision your new device with. - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: OperatingSystemList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_operating_systems_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_operating_systems_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - def find_operating_systems_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve all operating systems # noqa: E501 - - Provides a listing of available operating systems to provision your new device with. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_operating_systems_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + """ # noqa: E501 + + _param = self._find_operating_systems_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OperatingSystemList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_operating_systems_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[OperatingSystemList]: + """Retrieve all operating systems + + Provides a listing of available operating systems to provision your new device with. + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(OperatingSystemList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_operating_systems_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "OperatingSystemList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def find_operating_systems_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all operating systems + + Provides a listing of available operating systems to provision your new device with. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_operating_systems_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_operating_systems" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "OperatingSystemList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} + def _find_operating_systems_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "OperatingSystemList", - '401': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/operating-systems', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/operating-systems', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/organizations_api.py b/equinix_metal/equinix_metal/api/organizations_api.py index eb9bde07..7dd90fb5 100644 --- a/equinix_metal/equinix_metal/api/organizations_api.py +++ b/equinix_metal/equinix_metal/api/organizations_api.py @@ -12,18 +12,14 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictStr, conint, conlist - -from typing import Optional - +from pydantic import Field, StrictStr, field_validator +from typing import List, Optional +from typing_extensions import Annotated from equinix_metal.models.invitation import Invitation from equinix_metal.models.invitation_input import InvitationInput from equinix_metal.models.invitation_list import InvitationList @@ -40,36 +36,122 @@ from equinix_metal.models.project_list import ProjectList from equinix_metal.models.transfer_request_list import TransferRequestList -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class OrganizationsApi(object): +class OrganizationsApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def create_organization( + self, + organization_input: Annotated[OrganizationInput, Field(description="Organization to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Organization: + """Create an organization - @validate_arguments - def create_organization(self, organization_input : Annotated[OrganizationInput, Field(..., description="Organization to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> Organization: # noqa: E501 - """Create an organization # noqa: E501 + Creates an organization. - Creates an organization. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + :param organization_input: Organization to create (required) + :type organization_input: OrganizationInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_organization_serialize( + organization_input=organization_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - >>> thread = api.create_organization(organization_input, include, exclude, async_req=True) - >>> result = thread.get() + _response_types_map: Dict[str, Optional[str]] = { + '201': "Organization", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_organization_with_http_info( + self, + organization_input: Annotated[OrganizationInput, Field(description="Organization to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Organization]: + """Create an organization + + Creates an organization. :param organization_input: Organization to create (required) :type organization_input: OrganizationInput @@ -77,32 +159,77 @@ def create_organization(self, organization_input : Annotated[OrganizationInput, :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Organization - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the create_organization_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.create_organization_with_http_info(organization_input, include, exclude, **kwargs) # noqa: E501 + """ # noqa: E501 + + _param = self._create_organization_serialize( + organization_input=organization_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "Organization", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - @validate_arguments - def create_organization_with_http_info(self, organization_input : Annotated[OrganizationInput, Field(..., description="Organization to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Create an organization # noqa: E501 - Creates an organization. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def create_organization_without_preload_content( + self, + organization_input: Annotated[OrganizationInput, Field(description="Organization to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create an organization - >>> thread = api.create_organization_with_http_info(organization_input, include, exclude, async_req=True) - >>> result = thread.get() + Creates an organization. :param organization_input: Organization to create (required) :type organization_input: OrganizationInput @@ -110,133 +237,157 @@ def create_organization_with_http_info(self, organization_input : Annotated[Orga :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Organization, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() + """ # noqa: E501 + + _param = self._create_organization_serialize( + organization_input=organization_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _all_params = [ - 'organization_input', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + _response_types_map: Dict[str, Optional[str]] = { + '201': "Organization", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) + return response_data.response - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_organization" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + def _create_organization_serialize( + self, + organization_input, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the path parameters - _path_params = {} + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['organization_input'] is not None: - _body_params = _params['organization_input'] + if organization_input is not None: + _body_params = organization_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '201': "Organization", - '401': "Error", - '404': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/organizations', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/organizations', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def create_organization_invitation(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], invitation_input : Annotated[InvitationInput, Field(..., description="Invitation to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> Invitation: # noqa: E501 - """Create an invitation for an organization # noqa: E501 - In order to add a user to an organization, they must first be invited. To invite to several projects the parameter `projects_ids:[a,b,c]` can be used # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def create_organization_invitation( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + invitation_input: Annotated[InvitationInput, Field(description="Invitation to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Invitation: + """Create an invitation for an organization - >>> thread = api.create_organization_invitation(id, invitation_input, include, async_req=True) - >>> result = thread.get() + In order to add a user to an organization, they must first be invited. To invite to several projects the parameter `projects_ids:[a,b,c]` can be used :param id: Organization UUID (required) :type id: str @@ -244,32 +395,78 @@ def create_organization_invitation(self, id : Annotated[StrictStr, Field(..., de :type invitation_input: InvitationInput :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Invitation - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the create_organization_invitation_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.create_organization_invitation_with_http_info(id, invitation_input, include, **kwargs) # noqa: E501 - - @validate_arguments - def create_organization_invitation_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], invitation_input : Annotated[InvitationInput, Field(..., description="Invitation to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Create an invitation for an organization # noqa: E501 + """ # noqa: E501 + + _param = self._create_organization_invitation_serialize( + id=id, + invitation_input=invitation_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - In order to add a user to an organization, they must first be invited. To invite to several projects the parameter `projects_ids:[a,b,c]` can be used # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '201': "Invitation", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_organization_invitation_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + invitation_input: Annotated[InvitationInput, Field(description="Invitation to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Invitation]: + """Create an invitation for an organization - >>> thread = api.create_organization_invitation_with_http_info(id, invitation_input, include, async_req=True) - >>> result = thread.get() + In order to add a user to an organization, they must first be invited. To invite to several projects the parameter `projects_ids:[a,b,c]` can be used :param id: Organization UUID (required) :type id: str @@ -277,133 +474,235 @@ def create_organization_invitation_with_http_info(self, id : Annotated[StrictStr :type invitation_input: InvitationInput :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Invitation, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._create_organization_invitation_serialize( + id=id, + invitation_input=invitation_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "Invitation", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id', - 'invitation_input', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def create_organization_invitation_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + invitation_input: Annotated[InvitationInput, Field(description="Invitation to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create an invitation for an organization + + In order to add a user to an organization, they must first be invited. To invite to several projects the parameter `projects_ids:[a,b,c]` can be used + + :param id: Organization UUID (required) + :type id: str + :param invitation_input: Invitation to create (required) + :type invitation_input: InvitationInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_organization_invitation_serialize( + id=id, + invitation_input=invitation_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_organization_invitation" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '201': "Invitation", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _create_organization_invitation_serialize( + self, + id, + invitation_input, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['invitation_input'] is not None: - _body_params = _params['invitation_input'] + if invitation_input is not None: + _body_params = invitation_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '201': "Invitation", - '401': "Error", - '403': "Error", - '404': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/organizations/{id}/invitations', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/organizations/{id}/invitations', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def create_organization_project(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], project_create_input : Annotated[ProjectCreateInput, Field(..., description="Project to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> Project: # noqa: E501 - """Create a project for the organization # noqa: E501 - Creates a new project for the organization # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def create_organization_project( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + project_create_input: Annotated[ProjectCreateInput, Field(description="Project to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Project: + """Create a project for the organization - >>> thread = api.create_organization_project(id, project_create_input, include, exclude, async_req=True) - >>> result = thread.get() + Creates a new project for the organization :param id: Organization UUID (required) :type id: str @@ -413,32 +712,78 @@ def create_organization_project(self, id : Annotated[StrictStr, Field(..., descr :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Project - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the create_organization_project_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.create_organization_project_with_http_info(id, project_create_input, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def create_organization_project_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], project_create_input : Annotated[ProjectCreateInput, Field(..., description="Project to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Create a project for the organization # noqa: E501 + """ # noqa: E501 + + _param = self._create_organization_project_serialize( + id=id, + project_create_input=project_create_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Creates a new project for the organization # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '201': "Project", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_organization_project_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + project_create_input: Annotated[ProjectCreateInput, Field(description="Project to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Project]: + """Create a project for the organization - >>> thread = api.create_organization_project_with_http_info(id, project_create_input, include, exclude, async_req=True) - >>> result = thread.get() + Creates a new project for the organization :param id: Organization UUID (required) :type id: str @@ -448,169 +793,241 @@ def create_organization_project_with_http_info(self, id : Annotated[StrictStr, F :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Project, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'id', - 'project_create_input', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + """ # noqa: E501 + + _param = self._create_organization_project_serialize( + id=id, + project_create_input=project_create_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_organization_project" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] - - - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' - - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' - - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params['project_create_input'] is not None: - _body_params = _params['project_create_input'] - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list - - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { + _response_types_map: Dict[str, Optional[str]] = { '201': "Project", '401': "Error", '422': "Error", } - - return self.api_client.call_api( - '/organizations/{id}/projects', 'POST', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + ) - @validate_arguments - def create_payment_method(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], payment_method_create_input : Annotated[PaymentMethodCreateInput, Field(..., description="Payment Method to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> PaymentMethod: # noqa: E501 - """Create a payment method for the given organization # noqa: E501 - Creates a payment method. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def create_organization_project_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + project_create_input: Annotated[ProjectCreateInput, Field(description="Project to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a project for the organization - >>> thread = api.create_payment_method(id, payment_method_create_input, include, async_req=True) - >>> result = thread.get() + Creates a new project for the organization :param id: Organization UUID (required) :type id: str - :param payment_method_create_input: Payment Method to create (required) - :type payment_method_create_input: PaymentMethodCreateInput + :param project_create_input: Project to create (required) + :type project_create_input: ProjectCreateInput :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: PaymentMethod - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the create_payment_method_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.create_payment_method_with_http_info(id, payment_method_create_input, include, **kwargs) # noqa: E501 + """ # noqa: E501 + + _param = self._create_organization_project_serialize( + id=id, + project_create_input=project_create_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - @validate_arguments - def create_payment_method_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], payment_method_create_input : Annotated[PaymentMethodCreateInput, Field(..., description="Payment Method to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Create a payment method for the given organization # noqa: E501 + _response_types_map: Dict[str, Optional[str]] = { + '201': "Project", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_organization_project_serialize( + self, + id, + project_create_input, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - Creates a payment method. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None - >>> thread = api.create_payment_method_with_http_info(id, payment_method_create_input, include, async_req=True) - >>> result = thread.get() + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + + # process the header parameters + # process the form parameters + # process the body parameter + if project_create_input is not None: + _body_params = project_create_input + + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/organizations/{id}/projects', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + @validate_call + def create_payment_method( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + payment_method_create_input: Annotated[PaymentMethodCreateInput, Field(description="Payment Method to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PaymentMethod: + """Create a payment method for the given organization + + Creates a payment method. :param id: Organization UUID (required) :type id: str @@ -618,420 +1035,855 @@ def create_payment_method_with_http_info(self, id : Annotated[StrictStr, Field(. :type payment_method_create_input: PaymentMethodCreateInput :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(PaymentMethod, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._create_payment_method_serialize( + id=id, + payment_method_create_input=payment_method_create_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '201': "PaymentMethod", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_payment_method_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + payment_method_create_input: Annotated[PaymentMethodCreateInput, Field(description="Payment Method to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PaymentMethod]: + """Create a payment method for the given organization - _all_params = [ - 'id', - 'payment_method_create_input', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + Creates a payment method. + + :param id: Organization UUID (required) + :type id: str + :param payment_method_create_input: Payment Method to create (required) + :type payment_method_create_input: PaymentMethodCreateInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_payment_method_serialize( + id=id, + payment_method_create_input=payment_method_create_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "PaymentMethod", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_payment_method_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + payment_method_create_input: Annotated[PaymentMethodCreateInput, Field(description="Payment Method to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a payment method for the given organization + + Creates a payment method. + + :param id: Organization UUID (required) + :type id: str + :param payment_method_create_input: Payment Method to create (required) + :type payment_method_create_input: PaymentMethodCreateInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_payment_method_serialize( + id=id, + payment_method_create_input=payment_method_create_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_payment_method" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '201': "PaymentMethod", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _create_payment_method_serialize( + self, + id, + payment_method_create_input, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['payment_method_create_input'] is not None: - _body_params = _params['payment_method_create_input'] + if payment_method_create_input is not None: + _body_params = payment_method_create_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '201': "PaymentMethod", - '401': "Error", - '404': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/organizations/{id}/payment-methods', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/organizations/{id}/payment-methods', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def delete_organization(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], **kwargs) -> None: # noqa: E501 - """Delete the organization # noqa: E501 - Deletes the organization. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def delete_organization( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete the organization - >>> thread = api.delete_organization(id, async_req=True) - >>> result = thread.get() + Deletes the organization. :param id: Organization UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the delete_organization_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.delete_organization_with_http_info(id, **kwargs) # noqa: E501 - - @validate_arguments - def delete_organization_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """Delete the organization # noqa: E501 + """ # noqa: E501 + + _param = self._delete_organization_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Deletes the organization. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_organization_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete the organization - >>> thread = api.delete_organization_with_http_info(id, async_req=True) - >>> result = thread.get() + Deletes the organization. :param id: Organization UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 + + _param = self._delete_organization_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def delete_organization_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete the organization + + Deletes the organization. + + :param id: Organization UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_organization_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_organization" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _delete_organization_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/organizations/{id}', 'DELETE', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='DELETE', + resource_path='/organizations/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_operating_systems_by_organization(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> OperatingSystemList: # noqa: E501 - """Retrieve all operating systems visible by the organization # noqa: E501 - Returns a listing of available operating systems for the given organization # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_operating_systems_by_organization( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> OperatingSystemList: + """Retrieve all operating systems visible by the organization - >>> thread = api.find_operating_systems_by_organization(id, include, async_req=True) - >>> result = thread.get() + Returns a listing of available operating systems for the given organization :param id: Organization UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: OperatingSystemList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_operating_systems_by_organization_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_operating_systems_by_organization_with_http_info(id, include, **kwargs) # noqa: E501 - - @validate_arguments - def find_operating_systems_by_organization_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve all operating systems visible by the organization # noqa: E501 + """ # noqa: E501 + + _param = self._find_operating_systems_by_organization_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Returns a listing of available operating systems for the given organization # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "OperatingSystemList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_operating_systems_by_organization_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[OperatingSystemList]: + """Retrieve all operating systems visible by the organization - >>> thread = api.find_operating_systems_by_organization_with_http_info(id, include, async_req=True) - >>> result = thread.get() + Returns a listing of available operating systems for the given organization :param id: Organization UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(OperatingSystemList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_operating_systems_by_organization_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OperatingSystemList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def find_operating_systems_by_organization_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all operating systems visible by the organization + + Returns a listing of available operating systems for the given organization + + :param id: Organization UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_operating_systems_by_organization_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_operating_systems_by_organization" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "OperatingSystemList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_operating_systems_by_organization_serialize( + self, + id, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "OperatingSystemList", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/organizations/{id}/operating-systems', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/organizations/{id}/operating-systems', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_organization_by_id(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> Organization: # noqa: E501 - """Retrieve an organization's details # noqa: E501 - Returns a single organization's details, if the user is authorized to view it. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_organization_by_id( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Organization: + """Retrieve an organization's details - >>> thread = api.find_organization_by_id(id, include, exclude, async_req=True) - >>> result = thread.get() + Returns a single organization's details, if the user is authorized to view it. :param id: Organization UUID (required) :type id: str @@ -1039,32 +1891,155 @@ def find_organization_by_id(self, id : Annotated[StrictStr, Field(..., descripti :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Organization - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_organization_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_organization_by_id_with_http_info(id, include, exclude, **kwargs) # noqa: E501 + """ # noqa: E501 + + _param = self._find_organization_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Organization", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_organization_by_id_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Organization]: + """Retrieve an organization's details + + Returns a single organization's details, if the user is authorized to view it. + + :param id: Organization UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_organization_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Organization", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - @validate_arguments - def find_organization_by_id_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve an organization's details # noqa: E501 - Returns a single organization's details, if the user is authorized to view it. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_organization_by_id_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve an organization's details - >>> thread = api.find_organization_by_id_with_http_info(id, include, exclude, async_req=True) - >>> result = thread.get() + Returns a single organization's details, if the user is authorized to view it. :param id: Organization UUID (required) :type id: str @@ -1072,263 +2047,410 @@ def find_organization_by_id_with_http_info(self, id : Annotated[StrictStr, Field :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Organization, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'id', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + """ # noqa: E501 + + _param = self._find_organization_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_organization_by_id" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "Organization", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_organization_by_id_serialize( + self, + id, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "Organization", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/organizations/{id}', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/organizations/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_organization_customdata(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], **kwargs) -> None: # noqa: E501 - """Retrieve the custom metadata of an organization # noqa: E501 - Provides the custom metadata stored for this organization in json format # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_organization_customdata( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Retrieve the custom metadata of an organization - >>> thread = api.find_organization_customdata(id, async_req=True) - >>> result = thread.get() + Provides the custom metadata stored for this organization in json format :param id: Organization UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_organization_customdata_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_organization_customdata_with_http_info(id, **kwargs) # noqa: E501 - - @validate_arguments - def find_organization_customdata_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve the custom metadata of an organization # noqa: E501 + """ # noqa: E501 + + _param = self._find_organization_customdata_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Provides the custom metadata stored for this organization in json format # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_organization_customdata_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Retrieve the custom metadata of an organization - >>> thread = api.find_organization_customdata_with_http_info(id, async_req=True) - >>> result = thread.get() + Provides the custom metadata stored for this organization in json format :param id: Organization UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 + + _param = self._find_organization_customdata_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def find_organization_customdata_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve the custom metadata of an organization + + Provides the custom metadata stored for this organization in json format + + :param id: Organization UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_organization_customdata_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_organization_customdata" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_organization_customdata_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/organizations/{id}/customdata', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/organizations/{id}/customdata', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_organization_invitations(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> InvitationList: # noqa: E501 - """Retrieve organization invitations # noqa: E501 - Returns all invitations in an organization. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_organization_invitations( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> InvitationList: + """Retrieve organization invitations - >>> thread = api.find_organization_invitations(id, include, page, per_page, async_req=True) - >>> result = thread.get() + Returns all invitations in an organization. :param id: Organization UUID (required) :type id: str @@ -1338,32 +2460,79 @@ def find_organization_invitations(self, id : Annotated[StrictStr, Field(..., des :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: InvitationList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_organization_invitations_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_organization_invitations_with_http_info(id, include, page, per_page, **kwargs) # noqa: E501 - - @validate_arguments - def find_organization_invitations_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve organization invitations # noqa: E501 + """ # noqa: E501 + + _param = self._find_organization_invitations_serialize( + id=id, + include=include, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Returns all invitations in an organization. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "InvitationList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_organization_invitations_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[InvitationList]: + """Retrieve organization invitations - >>> thread = api.find_organization_invitations_with_http_info(id, include, page, per_page, async_req=True) - >>> result = thread.get() + Returns all invitations in an organization. :param id: Organization UUID (required) :type id: str @@ -1373,129 +2542,232 @@ def find_organization_invitations_with_http_info(self, id : Annotated[StrictStr, :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(InvitationList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_organization_invitations_serialize( + id=id, + include=include, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "InvitationList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id', - 'include', - 'page', - 'per_page' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def find_organization_invitations_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] - ) + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve organization invitations - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_organization_invitations" % _key - ) - _params[_key] = _val - del _params['kwargs'] + Returns all invitations in an organization. - _collection_formats = {} + :param id: Organization UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param page: Page to return + :type page: int + :param per_page: Items returned per page + :type per_page: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_organization_invitations_serialize( + id=id, + include=include, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "InvitationList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + def _find_organization_invitations_serialize( + self, + id, + include, + page, + per_page, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - if _params.get('page') is not None: # noqa: E501 - _query_params.append(('page', _params['page'])) + _host = None - if _params.get('per_page') is not None: # noqa: E501 - _query_params.append(('per_page', _params['per_page'])) + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if page is not None: + + _query_params.append(('page', page)) + + if per_page is not None: + + _query_params.append(('per_page', per_page)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "InvitationList", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/organizations/{id}/invitations', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/organizations/{id}/invitations', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_organization_payment_methods(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> PaymentMethodList: # noqa: E501 - """Retrieve all payment methods of an organization # noqa: E501 - Returns all payment methods of an organization. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_organization_payment_methods( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PaymentMethodList: + """Retrieve all payment methods of an organization - >>> thread = api.find_organization_payment_methods(id, include, page, per_page, async_req=True) - >>> result = thread.get() + Returns all payment methods of an organization. :param id: Organization UUID (required) :type id: str @@ -1505,32 +2777,159 @@ def find_organization_payment_methods(self, id : Annotated[StrictStr, Field(..., :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: PaymentMethodList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_organization_payment_methods_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_organization_payment_methods_with_http_info(id, include, page, per_page, **kwargs) # noqa: E501 + """ # noqa: E501 + + _param = self._find_organization_payment_methods_serialize( + id=id, + include=include, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PaymentMethodList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_organization_payment_methods_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PaymentMethodList]: + """Retrieve all payment methods of an organization - @validate_arguments - def find_organization_payment_methods_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve all payment methods of an organization # noqa: E501 + Returns all payment methods of an organization. + + :param id: Organization UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param page: Page to return + :type page: int + :param per_page: Items returned per page + :type per_page: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_organization_payment_methods_serialize( + id=id, + include=include, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PaymentMethodList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - Returns all payment methods of an organization. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.find_organization_payment_methods_with_http_info(id, include, page, per_page, async_req=True) - >>> result = thread.get() + @validate_call + def find_organization_payment_methods_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all payment methods of an organization + + Returns all payment methods of an organization. :param id: Organization UUID (required) :type id: str @@ -1540,120 +2939,128 @@ def find_organization_payment_methods_with_http_info(self, id : Annotated[Strict :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(PaymentMethodList, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'id', - 'include', - 'page', - 'per_page' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + """ # noqa: E501 + + _param = self._find_organization_payment_methods_serialize( + id=id, + include=include, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_organization_payment_methods" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} + _response_types_map: Dict[str, Optional[str]] = { + '200': "PaymentMethodList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_organization_payment_methods_serialize( + self, + id, + include, + page, + per_page, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _host = None - if _params.get('page') is not None: # noqa: E501 - _query_params.append(('page', _params['page'])) + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } - if _params.get('per_page') is not None: # noqa: E501 - _query_params.append(('per_page', _params['per_page'])) + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if page is not None: + + _query_params.append(('page', page)) + + if per_page is not None: + + _query_params.append(('per_page', per_page)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "PaymentMethodList", - '401': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/organizations/{id}/payment-methods', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/organizations/{id}/payment-methods', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + - @validate_arguments - def find_organization_projects_all_pages(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], name : Annotated[Optional[StrictStr], Field(description="Filter results by name.")] = None, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> ProjectList: # noqa: E501 + @validate_call + def find_organization_projects_all_pages(self, id : Annotated[StrictStr, Field(description="Organization UUID")], name : Annotated[Optional[StrictStr], Field(description="Filter results by name.")] = None, include : Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, per_page : Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, **kwargs) -> ProjectList: # noqa: E501 """Retrieve all projects of an organization # noqa: E501 This method is the same as find_organization_projects, but fetches resources from all the pages. @@ -1707,19 +3114,34 @@ def find_organization_projects_all_pages(self, id : Annotated[StrictStr, Field(. if page_response.meta.next is None: break page += 1 - - return all_pages - @validate_arguments - def find_organization_projects(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], name : Annotated[Optional[StrictStr], Field(description="Filter results by name.")] = None, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> ProjectList: # noqa: E501 - """Retrieve all projects of an organization # noqa: E501 + return all_pages - Returns a collection of projects that belong to the organization. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_organization_projects( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + name: Annotated[Optional[StrictStr], Field(description="Filter results by name.")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ProjectList: + """Retrieve all projects of an organization - >>> thread = api.find_organization_projects(id, name, include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + Returns a collection of projects that belong to the organization. :param id: Organization UUID (required) :type id: str @@ -1733,32 +3155,81 @@ def find_organization_projects(self, id : Annotated[StrictStr, Field(..., descri :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ProjectList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_organization_projects_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_organization_projects_with_http_info(id, name, include, exclude, page, per_page, **kwargs) # noqa: E501 - - @validate_arguments - def find_organization_projects_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], name : Annotated[Optional[StrictStr], Field(description="Filter results by name.")] = None, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve all projects of an organization # noqa: E501 + """ # noqa: E501 + + _param = self._find_organization_projects_serialize( + id=id, + name=name, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Returns a collection of projects that belong to the organization. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "ProjectList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_organization_projects_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + name: Annotated[Optional[StrictStr], Field(description="Filter results by name.")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ProjectList]: + """Retrieve all projects of an organization - >>> thread = api.find_organization_projects_with_http_info(id, name, include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + Returns a collection of projects that belong to the organization. :param id: Organization UUID (required) :type id: str @@ -1772,278 +3243,508 @@ def find_organization_projects_with_http_info(self, id : Annotated[StrictStr, Fi :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ProjectList, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'id', - 'name', - 'include', - 'exclude', - 'page', - 'per_page' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + """ # noqa: E501 + + _param = self._find_organization_projects_serialize( + id=id, + name=name, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_organization_projects" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "ProjectList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - # process the query parameters - _query_params = [] - if _params.get('name') is not None: # noqa: E501 - _query_params.append(('name', _params['name'])) + @validate_call + def find_organization_projects_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + name: Annotated[Optional[StrictStr], Field(description="Filter results by name.")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all projects of an organization - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + Returns a collection of projects that belong to the organization. - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + :param id: Organization UUID (required) + :type id: str + :param name: Filter results by name. + :type name: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param page: Page to return + :type page: int + :param per_page: Items returned per page + :type per_page: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_organization_projects_serialize( + id=id, + name=name, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - if _params.get('page') is not None: # noqa: E501 - _query_params.append(('page', _params['page'])) + _response_types_map: Dict[str, Optional[str]] = { + '200': "ProjectList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _find_organization_projects_serialize( + self, + id, + name, + include, + exclude, + page, + per_page, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('per_page') is not None: # noqa: E501 - _query_params.append(('per_page', _params['per_page'])) + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if name is not None: + + _query_params.append(('name', name)) + + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + + if page is not None: + + _query_params.append(('page', page)) + + if per_page is not None: + + _query_params.append(('per_page', per_page)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "ProjectList", - '401': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/organizations/{id}/projects', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/organizations/{id}/projects', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_organization_transfers(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> TransferRequestList: # noqa: E501 - """Retrieve all project transfer requests from or to an organization # noqa: E501 - Provides a collection of project transfer requests from or to the organization. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_organization_transfers( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> TransferRequestList: + """Retrieve all project transfer requests from or to an organization - >>> thread = api.find_organization_transfers(id, include, async_req=True) - >>> result = thread.get() + Provides a collection of project transfer requests from or to the organization. :param id: Organization UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: TransferRequestList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_organization_transfers_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_organization_transfers_with_http_info(id, include, **kwargs) # noqa: E501 - - @validate_arguments - def find_organization_transfers_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve all project transfer requests from or to an organization # noqa: E501 + """ # noqa: E501 + + _param = self._find_organization_transfers_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Provides a collection of project transfer requests from or to the organization. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "TransferRequestList", + '401': "Error", + '403': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_organization_transfers_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[TransferRequestList]: + """Retrieve all project transfer requests from or to an organization - >>> thread = api.find_organization_transfers_with_http_info(id, include, async_req=True) - >>> result = thread.get() + Provides a collection of project transfer requests from or to the organization. :param id: Organization UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(TransferRequestList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_organization_transfers_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "TransferRequestList", + '401': "Error", + '403': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def find_organization_transfers_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all project transfer requests from or to an organization + + Provides a collection of project transfer requests from or to the organization. + + :param id: Organization UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_organization_transfers_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_organization_transfers" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "TransferRequestList", + '401': "Error", + '403': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_organization_transfers_serialize( + self, + id, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "TransferRequestList", - '401': "Error", - '403': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/organizations/{id}/transfers', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/organizations/{id}/transfers', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_organizations_all_pages(self, personal : Annotated[Optional[StrictStr], Field(description="Include, exclude or show only personal organizations.")] = None, without_projects : Annotated[Optional[StrictStr], Field(description="Include, exclude or show only organizations that have no projects.")] = None, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> OrganizationList: # noqa: E501 + + @validate_call + def find_organizations_all_pages(self, personal : Annotated[Optional[StrictStr], Field(description="Include, exclude or show only personal organizations.")] = None, without_projects : Annotated[Optional[StrictStr], Field(description="Include, exclude or show only organizations that have no projects.")] = None, include : Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, per_page : Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, **kwargs) -> OrganizationList: # noqa: E501 """Retrieve all organizations # noqa: E501 This method is the same as find_organizations, but fetches resources from all the pages. @@ -2097,19 +3798,122 @@ def find_organizations_all_pages(self, personal : Annotated[Optional[StrictStr], if page_response.meta.next is None: break page += 1 - + return all_pages - @validate_arguments - def find_organizations(self, personal : Annotated[Optional[StrictStr], Field(description="Include, exclude or show only personal organizations.")] = None, without_projects : Annotated[Optional[StrictStr], Field(description="Include, exclude or show only organizations that have no projects.")] = None, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> OrganizationList: # noqa: E501 - """Retrieve all organizations # noqa: E501 + @validate_call + def find_organizations( + self, + personal: Annotated[Optional[StrictStr], Field(description="Include, exclude or show only personal organizations.")] = None, + without_projects: Annotated[Optional[StrictStr], Field(description="Include, exclude or show only organizations that have no projects.")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> OrganizationList: + """Retrieve all organizations - Returns a list of organizations that are accessible to the current user. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + Returns a list of organizations that are accessible to the current user. + + :param personal: Include, exclude or show only personal organizations. + :type personal: str + :param without_projects: Include, exclude or show only organizations that have no projects. + :type without_projects: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param page: Page to return + :type page: int + :param per_page: Items returned per page + :type per_page: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_organizations_serialize( + personal=personal, + without_projects=without_projects, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OrganizationList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_organizations_with_http_info( + self, + personal: Annotated[Optional[StrictStr], Field(description="Include, exclude or show only personal organizations.")] = None, + without_projects: Annotated[Optional[StrictStr], Field(description="Include, exclude or show only organizations that have no projects.")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[OrganizationList]: + """Retrieve all organizations - >>> thread = api.find_organizations(personal, without_projects, include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + Returns a list of organizations that are accessible to the current user. :param personal: Include, exclude or show only personal organizations. :type personal: str @@ -2123,32 +3927,81 @@ def find_organizations(self, personal : Annotated[Optional[StrictStr], Field(des :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: OrganizationList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_organizations_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_organizations_with_http_info(personal, without_projects, include, exclude, page, per_page, **kwargs) # noqa: E501 + """ # noqa: E501 + + _param = self._find_organizations_serialize( + personal=personal, + without_projects=without_projects, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - @validate_arguments - def find_organizations_with_http_info(self, personal : Annotated[Optional[StrictStr], Field(description="Include, exclude or show only personal organizations.")] = None, without_projects : Annotated[Optional[StrictStr], Field(description="Include, exclude or show only organizations that have no projects.")] = None, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve all organizations # noqa: E501 + _response_types_map: Dict[str, Optional[str]] = { + '200': "OrganizationList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - Returns a list of organizations that are accessible to the current user. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.find_organizations_with_http_info(personal, without_projects, include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + @validate_call + def find_organizations_without_preload_content( + self, + personal: Annotated[Optional[StrictStr], Field(description="Include, exclude or show only personal organizations.")] = None, + without_projects: Annotated[Optional[StrictStr], Field(description="Include, exclude or show only organizations that have no projects.")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all organizations + + Returns a list of organizations that are accessible to the current user. :param personal: Include, exclude or show only personal organizations. :type personal: str @@ -2162,136 +4015,162 @@ def find_organizations_with_http_info(self, personal : Annotated[Optional[Strict :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(OrganizationList, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'personal', - 'without_projects', - 'include', - 'exclude', - 'page', - 'per_page' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + """ # noqa: E501 + + _param = self._find_organizations_serialize( + personal=personal, + without_projects=without_projects, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_organizations" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "OrganizationList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _find_organizations_serialize( + self, + personal, + without_projects, + include, + exclude, + page, + per_page, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - _collection_formats = {} + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None # process the path parameters - _path_params = {} - # process the query parameters - _query_params = [] - if _params.get('personal') is not None: # noqa: E501 - _query_params.append(('personal', _params['personal'])) - - if _params.get('without_projects') is not None: # noqa: E501 - _query_params.append(('without_projects', _params['without_projects'])) - - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' - - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' - - if _params.get('page') is not None: # noqa: E501 - _query_params.append(('page', _params['page'])) - - if _params.get('per_page') is not None: # noqa: E501 - _query_params.append(('per_page', _params['per_page'])) - + if personal is not None: + + _query_params.append(('personal', personal)) + + if without_projects is not None: + + _query_params.append(('without_projects', without_projects)) + + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + + if page is not None: + + _query_params.append(('page', page)) + + if per_page is not None: + + _query_params.append(('per_page', per_page)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "OrganizationList", - '401': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/organizations', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/organizations', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_plans_by_organization(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> PlanList: # noqa: E501 - """Retrieve all plans visible by the organization # noqa: E501 - Returns a listing of available plans for the given organization # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_plans_by_organization( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PlanList: + """Retrieve all plans visible by the organization - >>> thread = api.find_plans_by_organization(id, include, exclude, async_req=True) - >>> result = thread.get() + Returns a listing of available plans for the given organization :param id: Organization UUID (required) :type id: str @@ -2299,32 +4178,77 @@ def find_plans_by_organization(self, id : Annotated[StrictStr, Field(..., descri :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: PlanList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_plans_by_organization_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_plans_by_organization_with_http_info(id, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def find_plans_by_organization_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve all plans visible by the organization # noqa: E501 + """ # noqa: E501 + + _param = self._find_plans_by_organization_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Returns a listing of available plans for the given organization # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "PlanList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_plans_by_organization_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PlanList]: + """Retrieve all plans visible by the organization - >>> thread = api.find_plans_by_organization_with_http_info(id, include, exclude, async_req=True) - >>> result = thread.get() + Returns a listing of available plans for the given organization :param id: Organization UUID (required) :type id: str @@ -2332,126 +4256,223 @@ def find_plans_by_organization_with_http_info(self, id : Annotated[StrictStr, Fi :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(PlanList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_plans_by_organization_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PlanList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def find_plans_by_organization_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all plans visible by the organization + + Returns a listing of available plans for the given organization + + :param id: Organization UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_plans_by_organization_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_plans_by_organization" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "PlanList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_plans_by_organization_serialize( + self, + id, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "PlanList", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/organizations/{id}/plans', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/organizations/{id}/plans', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def update_organization(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], organization_input : Annotated[OrganizationInput, Field(..., description="Organization to update")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> Organization: # noqa: E501 - """Update the organization # noqa: E501 - Updates the organization. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def update_organization( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + organization_input: Annotated[OrganizationInput, Field(description="Organization to update")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Organization: + """Update the organization - >>> thread = api.update_organization(id, organization_input, include, exclude, async_req=True) - >>> result = thread.get() + Updates the organization. :param id: Organization UUID (required) :type id: str @@ -2461,32 +4482,80 @@ def update_organization(self, id : Annotated[StrictStr, Field(..., description=" :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Organization - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the update_organization_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.update_organization_with_http_info(id, organization_input, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def update_organization_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Organization UUID")], organization_input : Annotated[OrganizationInput, Field(..., description="Organization to update")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Update the organization # noqa: E501 + """ # noqa: E501 + + _param = self._update_organization_serialize( + id=id, + organization_input=organization_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Updates the organization. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "Organization", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_organization_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + organization_input: Annotated[OrganizationInput, Field(description="Organization to update")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Organization]: + """Update the organization - >>> thread = api.update_organization_with_http_info(id, organization_input, include, exclude, async_req=True) - >>> result = thread.get() + Updates the organization. :param id: Organization UUID (required) :type id: str @@ -2496,124 +4565,220 @@ def update_organization_with_http_info(self, id : Annotated[StrictStr, Field(... :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Organization, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() + """ # noqa: E501 + + _param = self._update_organization_serialize( + id=id, + organization_input=organization_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _all_params = [ - 'id', - 'organization_input', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + _response_types_map: Dict[str, Optional[str]] = { + '200': "Organization", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method update_organization" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + @validate_call + def update_organization_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Organization UUID")], + organization_input: Annotated[OrganizationInput, Field(description="Organization to update")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update the organization - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + Updates the organization. + :param id: Organization UUID (required) + :type id: str + :param organization_input: Organization to update (required) + :type organization_input: OrganizationInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_organization_serialize( + id=id, + organization_input=organization_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _response_types_map: Dict[str, Optional[str]] = { + '200': "Organization", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_organization_serialize( + self, + id, + organization_input, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['organization_input'] is not None: - _body_params = _params['organization_input'] + if organization_input is not None: + _body_params = organization_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '200': "Organization", - '401': "Error", - '403': "Error", - '404': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/organizations/{id}', 'PUT', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='PUT', + resource_path='/organizations/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/otps_api.py b/equinix_metal/equinix_metal/api/otps_api.py index bf4f663b..9c5ad358 100644 --- a/equinix_metal/equinix_metal/api/otps_api.py +++ b/equinix_metal/equinix_metal/api/otps_api.py @@ -12,568 +12,1043 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated from pydantic import Field, StrictStr - +from typing_extensions import Annotated from equinix_metal.models.recovery_code_list import RecoveryCodeList -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class OTPsApi(object): +class OTPsApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def find_ensure_otp( + self, + otp: Annotated[StrictStr, Field(description="OTP")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Verify user by providing an OTP - @validate_arguments - def find_ensure_otp(self, otp : Annotated[StrictStr, Field(..., description="OTP")], **kwargs) -> None: # noqa: E501 - """Verify user by providing an OTP # noqa: E501 - - It verifies the user once a valid OTP is provided. It gives back a session token, essentially logging in the user. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_ensure_otp(otp, async_req=True) - >>> result = thread.get() + It verifies the user once a valid OTP is provided. It gives back a session token, essentially logging in the user. :param otp: OTP (required) :type otp: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_ensure_otp_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_ensure_otp_with_http_info(otp, **kwargs) # noqa: E501 - - @validate_arguments - def find_ensure_otp_with_http_info(self, otp : Annotated[StrictStr, Field(..., description="OTP")], **kwargs) -> ApiResponse: # noqa: E501 - """Verify user by providing an OTP # noqa: E501 - - It verifies the user once a valid OTP is provided. It gives back a session token, essentially logging in the user. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_ensure_otp_with_http_info(otp, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_ensure_otp_serialize( + otp=otp, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "Error", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_ensure_otp_with_http_info( + self, + otp: Annotated[StrictStr, Field(description="OTP")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Verify user by providing an OTP + + It verifies the user once a valid OTP is provided. It gives back a session token, essentially logging in the user. :param otp: OTP (required) :type otp: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 + + _param = self._find_ensure_otp_serialize( + otp=otp, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "Error", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'otp' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def find_ensure_otp_without_preload_content( + self, + otp: Annotated[StrictStr, Field(description="OTP")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Verify user by providing an OTP + + It verifies the user once a valid OTP is provided. It gives back a session token, essentially logging in the user. + + :param otp: OTP (required) + :type otp: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_ensure_otp_serialize( + otp=otp, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_ensure_otp" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "Error", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['otp']: - _path_params['otp'] = _params['otp'] + def _find_ensure_otp_serialize( + self, + otp, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if otp is not None: + _path_params['otp'] = otp # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/user/otp/verify/{otp}', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/user/otp/verify/{otp}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_recovery_codes(self, **kwargs) -> RecoveryCodeList: # noqa: E501 - """Retrieve my recovery codes # noqa: E501 - Returns my recovery codes. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_recovery_codes( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RecoveryCodeList: + """Retrieve my recovery codes - >>> thread = api.find_recovery_codes(async_req=True) - >>> result = thread.get() + Returns my recovery codes. - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: RecoveryCodeList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_recovery_codes_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_recovery_codes_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - def find_recovery_codes_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve my recovery codes # noqa: E501 - - Returns my recovery codes. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_recovery_codes_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + """ # noqa: E501 + + _param = self._find_recovery_codes_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RecoveryCodeList", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_recovery_codes_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[RecoveryCodeList]: + """Retrieve my recovery codes + + Returns my recovery codes. + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(RecoveryCodeList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 - _params = locals() + _param = self._find_recovery_codes_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _all_params = [ - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + _response_types_map: Dict[str, Optional[str]] = { + '200': "RecoveryCodeList", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def find_recovery_codes_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve my recovery codes + + Returns my recovery codes. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_recovery_codes_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_recovery_codes" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "RecoveryCodeList", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} + def _find_recovery_codes_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "RecoveryCodeList", - '401': "Error", - '404': "Error", - '422': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/user/otp/recovery-codes', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/user/otp/recovery-codes', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def receive_codes(self, **kwargs) -> None: # noqa: E501 - """Receive an OTP per sms # noqa: E501 - Sends an OTP to the user's mobile phone. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def receive_codes( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Receive an OTP per sms - >>> thread = api.receive_codes(async_req=True) - >>> result = thread.get() + Sends an OTP to the user's mobile phone. - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the receive_codes_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.receive_codes_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - def receive_codes_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 - """Receive an OTP per sms # noqa: E501 - - Sends an OTP to the user's mobile phone. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.receive_codes_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + """ # noqa: E501 + + _param = self._receive_codes_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "Error", + '401': "Error", + '422': "Error", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def receive_codes_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Receive an OTP per sms + + Sends an OTP to the user's mobile phone. + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 - _params = locals() + _param = self._receive_codes_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _all_params = [ - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "Error", + '401': "Error", + '422': "Error", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def receive_codes_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Receive an OTP per sms + + Sends an OTP to the user's mobile phone. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._receive_codes_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method receive_codes" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "Error", + '401': "Error", + '422': "Error", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} + def _receive_codes_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/user/otp/sms/receive', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/user/otp/sms/receive', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def regenerate_codes(self, **kwargs) -> RecoveryCodeList: # noqa: E501 - """Generate new recovery codes # noqa: E501 - Generate a new set of recovery codes. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def regenerate_codes( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RecoveryCodeList: + """Generate new recovery codes - >>> thread = api.regenerate_codes(async_req=True) - >>> result = thread.get() + Generate a new set of recovery codes. - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: RecoveryCodeList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the regenerate_codes_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.regenerate_codes_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - def regenerate_codes_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 - """Generate new recovery codes # noqa: E501 - - Generate a new set of recovery codes. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.regenerate_codes_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + """ # noqa: E501 + + _param = self._regenerate_codes_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RecoveryCodeList", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def regenerate_codes_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[RecoveryCodeList]: + """Generate new recovery codes + + Generate a new set of recovery codes. + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(RecoveryCodeList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 - _params = locals() + _param = self._regenerate_codes_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _all_params = [ - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + _response_types_map: Dict[str, Optional[str]] = { + '200': "RecoveryCodeList", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def regenerate_codes_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Generate new recovery codes + + Generate a new set of recovery codes. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._regenerate_codes_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method regenerate_codes" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "RecoveryCodeList", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} + def _regenerate_codes_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "RecoveryCodeList", - '401': "Error", - '404': "Error", - '422': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/user/otp/recovery-codes', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/user/otp/recovery-codes', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/password_reset_tokens_api.py b/equinix_metal/equinix_metal/api/password_reset_tokens_api.py index 5a1accbe..7cdc3d28 100644 --- a/equinix_metal/equinix_metal/api/password_reset_tokens_api.py +++ b/equinix_metal/equinix_metal/api/password_reset_tokens_api.py @@ -12,304 +12,539 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated from pydantic import Field, StrictStr - +from typing_extensions import Annotated from equinix_metal.models.new_password import NewPassword -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class PasswordResetTokensApi(object): +class PasswordResetTokensApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def create_password_reset_token( + self, + email: Annotated[StrictStr, Field(description="Email of user to create password reset token")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Create a password reset token - @validate_arguments - def create_password_reset_token(self, email : Annotated[StrictStr, Field(..., description="Email of user to create password reset token")], **kwargs) -> None: # noqa: E501 - """Create a password reset token # noqa: E501 - - Creates a password reset token # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_password_reset_token(email, async_req=True) - >>> result = thread.get() + Creates a password reset token :param email: Email of user to create password reset token (required) :type email: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the create_password_reset_token_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.create_password_reset_token_with_http_info(email, **kwargs) # noqa: E501 - - @validate_arguments - def create_password_reset_token_with_http_info(self, email : Annotated[StrictStr, Field(..., description="Email of user to create password reset token")], **kwargs) -> ApiResponse: # noqa: E501 - """Create a password reset token # noqa: E501 - - Creates a password reset token # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_password_reset_token_with_http_info(email, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._create_password_reset_token_serialize( + email=email, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': None, + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_password_reset_token_with_http_info( + self, + email: Annotated[StrictStr, Field(description="Email of user to create password reset token")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Create a password reset token + + Creates a password reset token :param email: Email of user to create password reset token (required) :type email: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 + + _param = self._create_password_reset_token_serialize( + email=email, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '201': None, + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'email' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def create_password_reset_token_without_preload_content( + self, + email: Annotated[StrictStr, Field(description="Email of user to create password reset token")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a password reset token + + Creates a password reset token + + :param email: Email of user to create password reset token (required) + :type email: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_password_reset_token_serialize( + email=email, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_password_reset_token" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '201': None, + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} + def _create_password_reset_token_serialize( + self, + email, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the query parameters - _query_params = [] - if _params.get('email') is not None: # noqa: E501 - _query_params.append(('email', _params['email'])) + _host = None + + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if email is not None: + + _query_params.append(('email', email)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/reset-password', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/reset-password', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def reset_password(self, **kwargs) -> NewPassword: # noqa: E501 - """Reset current user password # noqa: E501 - Resets current user password. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def reset_password( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> NewPassword: + """Reset current user password - >>> thread = api.reset_password(async_req=True) - >>> result = thread.get() + Resets current user password. - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: NewPassword - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the reset_password_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.reset_password_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - def reset_password_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 - """Reset current user password # noqa: E501 - - Resets current user password. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.reset_password_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + """ # noqa: E501 + + _param = self._reset_password_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "NewPassword", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def reset_password_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[NewPassword]: + """Reset current user password + + Resets current user password. + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(NewPassword, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 - _params = locals() + _param = self._reset_password_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _all_params = [ - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + _response_types_map: Dict[str, Optional[str]] = { + '201': "NewPassword", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def reset_password_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Reset current user password + + Resets current user password. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._reset_password_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "NewPassword", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) + return response_data.response - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method reset_password" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + def _reset_password_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the path parameters - _path_params = {} + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '201': "NewPassword", - '401': "Error", - '422': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/reset-password', 'DELETE', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='DELETE', + resource_path='/reset-password', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/payment_methods_api.py b/equinix_metal/equinix_metal/api/payment_methods_api.py index 2679d497..0ba31e7c 100644 --- a/equinix_metal/equinix_metal/api/payment_methods_api.py +++ b/equinix_metal/equinix_metal/api/payment_methods_api.py @@ -12,338 +12,597 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictStr, conlist - -from typing import Optional - +from pydantic import Field, StrictStr +from typing import List, Optional +from typing_extensions import Annotated from equinix_metal.models.payment_method import PaymentMethod from equinix_metal.models.payment_method_update_input import PaymentMethodUpdateInput -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class PaymentMethodsApi(object): +class PaymentMethodsApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def delete_payment_method( + self, + id: Annotated[StrictStr, Field(description="Payment Method UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete the payment method - @validate_arguments - def delete_payment_method(self, id : Annotated[StrictStr, Field(..., description="Payment Method UUID")], **kwargs) -> None: # noqa: E501 - """Delete the payment method # noqa: E501 - - Deletes the payment method. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_payment_method(id, async_req=True) - >>> result = thread.get() + Deletes the payment method. :param id: Payment Method UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the delete_payment_method_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.delete_payment_method_with_http_info(id, **kwargs) # noqa: E501 - - @validate_arguments - def delete_payment_method_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Payment Method UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """Delete the payment method # noqa: E501 - - Deletes the payment method. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_payment_method_with_http_info(id, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._delete_payment_method_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_payment_method_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Payment Method UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete the payment method + + Deletes the payment method. :param id: Payment Method UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 + + _param = self._delete_payment_method_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def delete_payment_method_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Payment Method UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete the payment method + + Deletes the payment method. + + :param id: Payment Method UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_payment_method_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_payment_method" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _delete_payment_method_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/payment-methods/{id}', 'DELETE', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='DELETE', + resource_path='/payment-methods/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_payment_method_by_id(self, id : Annotated[StrictStr, Field(..., description="Payment Method UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> PaymentMethod: # noqa: E501 - """Retrieve a payment method # noqa: E501 - Returns a payment method # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_payment_method_by_id( + self, + id: Annotated[StrictStr, Field(description="Payment Method UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PaymentMethod: + """Retrieve a payment method - >>> thread = api.find_payment_method_by_id(id, include, async_req=True) - >>> result = thread.get() + Returns a payment method :param id: Payment Method UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: PaymentMethod - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_payment_method_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_payment_method_by_id_with_http_info(id, include, **kwargs) # noqa: E501 - - @validate_arguments - def find_payment_method_by_id_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Payment Method UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve a payment method # noqa: E501 - - Returns a payment method # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_payment_method_by_id_with_http_info(id, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_payment_method_by_id_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PaymentMethod", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_payment_method_by_id_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Payment Method UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PaymentMethod]: + """Retrieve a payment method + + Returns a payment method :param id: Payment Method UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(PaymentMethod, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_payment_method_by_id_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PaymentMethod", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def find_payment_method_by_id_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Payment Method UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve a payment method + + Returns a payment method + + :param id: Payment Method UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_payment_method_by_id_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_payment_method_by_id" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "PaymentMethod", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_payment_method_by_id_serialize( + self, + id, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "PaymentMethod", - '401': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/payment-methods/{id}', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/payment-methods/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def update_payment_method(self, id : Annotated[StrictStr, Field(..., description="Payment Method UUID")], payment_method_update_input : Annotated[PaymentMethodUpdateInput, Field(..., description="Payment Method to update")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> PaymentMethod: # noqa: E501 - """Update the payment method # noqa: E501 - Updates the payment method. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def update_payment_method( + self, + id: Annotated[StrictStr, Field(description="Payment Method UUID")], + payment_method_update_input: Annotated[PaymentMethodUpdateInput, Field(description="Payment Method to update")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PaymentMethod: + """Update the payment method - >>> thread = api.update_payment_method(id, payment_method_update_input, include, async_req=True) - >>> result = thread.get() + Updates the payment method. :param id: Payment Method UUID (required) :type id: str @@ -351,32 +610,77 @@ def update_payment_method(self, id : Annotated[StrictStr, Field(..., description :type payment_method_update_input: PaymentMethodUpdateInput :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: PaymentMethod - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the update_payment_method_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.update_payment_method_with_http_info(id, payment_method_update_input, include, **kwargs) # noqa: E501 - - @validate_arguments - def update_payment_method_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Payment Method UUID")], payment_method_update_input : Annotated[PaymentMethodUpdateInput, Field(..., description="Payment Method to update")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Update the payment method # noqa: E501 - - Updates the payment method. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.update_payment_method_with_http_info(id, payment_method_update_input, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._update_payment_method_serialize( + id=id, + payment_method_update_input=payment_method_update_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PaymentMethod", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_payment_method_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Payment Method UUID")], + payment_method_update_input: Annotated[PaymentMethodUpdateInput, Field(description="Payment Method to update")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PaymentMethod]: + """Update the payment method + + Updates the payment method. :param id: Payment Method UUID (required) :type id: str @@ -384,118 +688,207 @@ def update_payment_method_with_http_info(self, id : Annotated[StrictStr, Field(. :type payment_method_update_input: PaymentMethodUpdateInput :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(PaymentMethod, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._update_payment_method_serialize( + id=id, + payment_method_update_input=payment_method_update_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PaymentMethod", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id', - 'payment_method_update_input', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def update_payment_method_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Payment Method UUID")], + payment_method_update_input: Annotated[PaymentMethodUpdateInput, Field(description="Payment Method to update")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update the payment method + + Updates the payment method. + + :param id: Payment Method UUID (required) + :type id: str + :param payment_method_update_input: Payment Method to update (required) + :type payment_method_update_input: PaymentMethodUpdateInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_payment_method_serialize( + id=id, + payment_method_update_input=payment_method_update_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method update_payment_method" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "PaymentMethod", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _update_payment_method_serialize( + self, + id, + payment_method_update_input, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['payment_method_update_input'] is not None: - _body_params = _params['payment_method_update_input'] + if payment_method_update_input is not None: + _body_params = payment_method_update_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '200': "PaymentMethod", - '401': "Error", - '404': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/payment-methods/{id}', 'PUT', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='PUT', + resource_path='/payment-methods/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/plans_api.py b/equinix_metal/equinix_metal/api/plans_api.py index 5ed9b192..b41d47eb 100644 --- a/equinix_metal/equinix_metal/api/plans_api.py +++ b/equinix_metal/equinix_metal/api/plans_api.py @@ -12,50 +12,56 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictStr, conlist, validator - -from typing import Optional - +from pydantic import Field, StrictStr, field_validator +from typing import List, Optional +from typing_extensions import Annotated from equinix_metal.models.plan_list import PlanList -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class PlansApi(object): +class PlansApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def find_plans( + self, + categories: Annotated[Optional[List[StrictStr]], Field(description="Filter plans by its category")] = None, + type: Annotated[Optional[StrictStr], Field(description="Filter plans by its plan type")] = None, + slug: Annotated[Optional[StrictStr], Field(description="Filter plans by slug")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PlanList: + """Retrieve all plans - @validate_arguments - def find_plans(self, categories : Annotated[Optional[conlist(StrictStr)], Field(description="Filter plans by its category")] = None, type : Annotated[Optional[StrictStr], Field(description="Filter plans by its plan type")] = None, slug : Annotated[Optional[StrictStr], Field(description="Filter plans by slug")] = None, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> PlanList: # noqa: E501 - """Retrieve all plans # noqa: E501 - - Provides a listing of available plans to provision your device on. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_plans(categories, type, slug, include, exclude, async_req=True) - >>> result = thread.get() + Provides a listing of available plans to provision your device on. :param categories: Filter plans by its category :type categories: List[str] @@ -67,32 +73,79 @@ def find_plans(self, categories : Annotated[Optional[conlist(StrictStr)], Field( :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: PlanList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_plans_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_plans_with_http_info(categories, type, slug, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def find_plans_with_http_info(self, categories : Annotated[Optional[conlist(StrictStr)], Field(description="Filter plans by its category")] = None, type : Annotated[Optional[StrictStr], Field(description="Filter plans by its plan type")] = None, slug : Annotated[Optional[StrictStr], Field(description="Filter plans by slug")] = None, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve all plans # noqa: E501 - - Provides a listing of available plans to provision your device on. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_plans_with_http_info(categories, type, slug, include, exclude, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_plans_serialize( + categories=categories, + type=type, + slug=slug, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PlanList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_plans_with_http_info( + self, + categories: Annotated[Optional[List[StrictStr]], Field(description="Filter plans by its category")] = None, + type: Annotated[Optional[StrictStr], Field(description="Filter plans by its plan type")] = None, + slug: Annotated[Optional[StrictStr], Field(description="Filter plans by slug")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PlanList]: + """Retrieve all plans + + Provides a listing of available plans to provision your device on. :param categories: Filter plans by its category :type categories: List[str] @@ -104,133 +157,241 @@ def find_plans_with_http_info(self, categories : Annotated[Optional[conlist(Stri :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(PlanList, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'categories', - 'type', - 'slug', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + """ # noqa: E501 + + _param = self._find_plans_serialize( + categories=categories, + type=type, + slug=slug, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_plans" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} + _response_types_map: Dict[str, Optional[str]] = { + '200': "PlanList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - # process the path parameters - _path_params = {} - # process the query parameters - _query_params = [] - if _params.get('categories') is not None: # noqa: E501 - _query_params.append(('categories[]', _params['categories'])) - _collection_formats['categories[]'] = 'multi' + @validate_call + def find_plans_without_preload_content( + self, + categories: Annotated[Optional[List[StrictStr]], Field(description="Filter plans by its category")] = None, + type: Annotated[Optional[StrictStr], Field(description="Filter plans by its plan type")] = None, + slug: Annotated[Optional[StrictStr], Field(description="Filter plans by slug")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all plans - if _params.get('type') is not None: # noqa: E501 - _query_params.append(('type', _params['type'])) + Provides a listing of available plans to provision your device on. - if _params.get('slug') is not None: # noqa: E501 - _query_params.append(('slug', _params['slug'])) + :param categories: Filter plans by its category + :type categories: List[str] + :param type: Filter plans by its plan type + :type type: str + :param slug: Filter plans by slug + :type slug: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_plans_serialize( + categories=categories, + type=type, + slug=slug, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _response_types_map: Dict[str, Optional[str]] = { + '200': "PlanList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _find_plans_serialize( + self, + categories, + type, + slug, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'categories[]': 'multi', + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + # process the query parameters + if categories is not None: + + _query_params.append(('categories[]', categories)) + + if type is not None: + + _query_params.append(('type', type)) + + if slug is not None: + + _query_params.append(('slug', slug)) + + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "PlanList", - '401': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/plans', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/plans', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_plans_by_project(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> PlanList: # noqa: E501 - """Retrieve all plans visible by the project # noqa: E501 - Returns a listing of available plans for the given project # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_plans_by_project( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PlanList: + """Retrieve all plans visible by the project - >>> thread = api.find_plans_by_project(id, include, exclude, async_req=True) - >>> result = thread.get() + Returns a listing of available plans for the given project :param id: Project UUID (required) :type id: str @@ -238,32 +399,77 @@ def find_plans_by_project(self, id : Annotated[StrictStr, Field(..., description :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: PlanList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_plans_by_project_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_plans_by_project_with_http_info(id, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def find_plans_by_project_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve all plans visible by the project # noqa: E501 - - Returns a listing of available plans for the given project # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_plans_by_project_with_http_info(id, include, exclude, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_plans_by_project_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PlanList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_plans_by_project_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PlanList]: + """Retrieve all plans visible by the project + + Returns a listing of available plans for the given project :param id: Project UUID (required) :type id: str @@ -271,112 +477,197 @@ def find_plans_by_project_with_http_info(self, id : Annotated[StrictStr, Field(. :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(PlanList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_plans_by_project_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "PlanList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def find_plans_by_project_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all plans visible by the project + + Returns a listing of available plans for the given project + + :param id: Project UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_plans_by_project_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_plans_by_project" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "PlanList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_plans_by_project_serialize( + self, + id, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "PlanList", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{id}/plans', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/projects/{id}/plans', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/ports_api.py b/equinix_metal/equinix_metal/api/ports_api.py index 0118a64d..b1f0600c 100644 --- a/equinix_metal/equinix_metal/api/ports_api.py +++ b/equinix_metal/equinix_metal/api/ports_api.py @@ -12,18 +12,14 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictBool, StrictStr, conlist - -from typing import Optional - +from pydantic import Field, StrictBool, StrictStr +from typing import List, Optional +from typing_extensions import Annotated from equinix_metal.models.port import Port from equinix_metal.models.port_assign_input import PortAssignInput from equinix_metal.models.port_convert_layer3_input import PortConvertLayer3Input @@ -33,36 +29,44 @@ from equinix_metal.models.port_vlan_assignment_batch_list import PortVlanAssignmentBatchList from equinix_metal.models.port_vlan_assignment_list import PortVlanAssignmentList -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class PortsApi(object): +class PortsApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def assign_native_vlan( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + vnid: Annotated[StrictStr, Field(description="Virtual Network ID. May be the UUID of the Virtual Network record, or the VLAN value itself (ex: '1001').")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Port: + """Assign a native VLAN - @validate_arguments - def assign_native_vlan(self, id : Annotated[StrictStr, Field(..., description="Port UUID")], vnid : Annotated[StrictStr, Field(..., description="Virtual Network ID. May be the UUID of the Virtual Network record, or the VLAN value itself (ex: '1001').")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> Port: # noqa: E501 - """Assign a native VLAN # noqa: E501 - - Sets a virtual network on this port as a \"native VLAN\". The VLAN must have already been assigned using the using the \"Assign a port to a virtual network\" operation. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.assign_native_vlan(id, vnid, include, async_req=True) - >>> result = thread.get() + Sets a virtual network on this port as a \"native VLAN\". The VLAN must have already been assigned using the using the \"Assign a port to a virtual network\" operation. :param id: Port UUID (required) :type id: str @@ -70,32 +74,77 @@ def assign_native_vlan(self, id : Annotated[StrictStr, Field(..., description="P :type vnid: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Port - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the assign_native_vlan_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.assign_native_vlan_with_http_info(id, vnid, include, **kwargs) # noqa: E501 - - @validate_arguments - def assign_native_vlan_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Port UUID")], vnid : Annotated[StrictStr, Field(..., description="Virtual Network ID. May be the UUID of the Virtual Network record, or the VLAN value itself (ex: '1001').")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Assign a native VLAN # noqa: E501 - - Sets a virtual network on this port as a \"native VLAN\". The VLAN must have already been assigned using the using the \"Assign a port to a virtual network\" operation. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.assign_native_vlan_with_http_info(id, vnid, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._assign_native_vlan_serialize( + id=id, + vnid=vnid, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Port", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def assign_native_vlan_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + vnid: Annotated[StrictStr, Field(description="Virtual Network ID. May be the UUID of the Virtual Network record, or the VLAN value itself (ex: '1001').")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Port]: + """Assign a native VLAN + + Sets a virtual network on this port as a \"native VLAN\". The VLAN must have already been assigned using the using the \"Assign a port to a virtual network\" operation. :param id: Port UUID (required) :type id: str @@ -103,125 +152,221 @@ def assign_native_vlan_with_http_info(self, id : Annotated[StrictStr, Field(..., :type vnid: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Port, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._assign_native_vlan_serialize( + id=id, + vnid=vnid, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "Port", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id', - 'vnid', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def assign_native_vlan_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + vnid: Annotated[StrictStr, Field(description="Virtual Network ID. May be the UUID of the Virtual Network record, or the VLAN value itself (ex: '1001').")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Assign a native VLAN + + Sets a virtual network on this port as a \"native VLAN\". The VLAN must have already been assigned using the using the \"Assign a port to a virtual network\" operation. + + :param id: Port UUID (required) + :type id: str + :param vnid: Virtual Network ID. May be the UUID of the Virtual Network record, or the VLAN value itself (ex: '1001'). (required) + :type vnid: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._assign_native_vlan_serialize( + id=id, + vnid=vnid, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method assign_native_vlan" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "Port", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _assign_native_vlan_serialize( + self, + id, + vnid, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('vnid') is not None: # noqa: E501 - _query_params.append(('vnid', _params['vnid'])) + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if vnid is not None: + + _query_params.append(('vnid', vnid)) + + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "Port", - '401': "Error", - '404': "Error", - '422': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/ports/{id}/native-vlan', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/ports/{id}/native-vlan', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def assign_port(self, id : Annotated[StrictStr, Field(..., description="Port UUID")], port_assign_input : Annotated[PortAssignInput, Field(..., description="Virtual Network ID. May be the UUID of the Virtual Network record, or the VLAN value itself (ex: '1001').")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> Port: # noqa: E501 - """Assign a port to virtual network # noqa: E501 - Assign a hardware port to a virtual network. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def assign_port( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + port_assign_input: Annotated[PortAssignInput, Field(description="Virtual Network ID. May be the UUID of the Virtual Network record, or the VLAN value itself (ex: '1001').")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Port: + """Assign a port to virtual network - >>> thread = api.assign_port(id, port_assign_input, include, async_req=True) - >>> result = thread.get() + Assign a hardware port to a virtual network. :param id: Port UUID (required) :type id: str @@ -229,32 +374,78 @@ def assign_port(self, id : Annotated[StrictStr, Field(..., description="Port UUI :type port_assign_input: PortAssignInput :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Port - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the assign_port_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.assign_port_with_http_info(id, port_assign_input, include, **kwargs) # noqa: E501 - - @validate_arguments - def assign_port_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Port UUID")], port_assign_input : Annotated[PortAssignInput, Field(..., description="Virtual Network ID. May be the UUID of the Virtual Network record, or the VLAN value itself (ex: '1001').")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Assign a port to virtual network # noqa: E501 - - Assign a hardware port to a virtual network. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.assign_port_with_http_info(id, port_assign_input, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._assign_port_serialize( + id=id, + port_assign_input=port_assign_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Port", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def assign_port_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + port_assign_input: Annotated[PortAssignInput, Field(description="Virtual Network ID. May be the UUID of the Virtual Network record, or the VLAN value itself (ex: '1001').")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Port]: + """Assign a port to virtual network + + Assign a hardware port to a virtual network. :param id: Port UUID (required) :type id: str @@ -262,133 +453,234 @@ def assign_port_with_http_info(self, id : Annotated[StrictStr, Field(..., descri :type port_assign_input: PortAssignInput :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Port, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._assign_port_serialize( + id=id, + port_assign_input=port_assign_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Port", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id', - 'port_assign_input', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def assign_port_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + port_assign_input: Annotated[PortAssignInput, Field(description="Virtual Network ID. May be the UUID of the Virtual Network record, or the VLAN value itself (ex: '1001').")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Assign a port to virtual network + + Assign a hardware port to a virtual network. + + :param id: Port UUID (required) + :type id: str + :param port_assign_input: Virtual Network ID. May be the UUID of the Virtual Network record, or the VLAN value itself (ex: '1001'). (required) + :type port_assign_input: PortAssignInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._assign_port_serialize( + id=id, + port_assign_input=port_assign_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method assign_port" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "Port", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _assign_port_serialize( + self, + id, + port_assign_input, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['port_assign_input'] is not None: - _body_params = _params['port_assign_input'] + if port_assign_input is not None: + _body_params = port_assign_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '200': "Port", - '401': "Error", - '403': "Error", - '404': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/ports/{id}/assign', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/ports/{id}/assign', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def bond_port(self, id : Annotated[StrictStr, Field(..., description="Port UUID")], bulk_enable : Annotated[Optional[StrictBool], Field(description="enable both ports")] = None, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> Port: # noqa: E501 - """Enabling bonding # noqa: E501 - Enabling bonding for one or all ports # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def bond_port( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + bulk_enable: Annotated[Optional[StrictBool], Field(description="enable both ports")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Port: + """Enabling bonding - >>> thread = api.bond_port(id, bulk_enable, include, async_req=True) - >>> result = thread.get() + Enabling bonding for one or all ports :param id: Port UUID (required) :type id: str @@ -396,32 +688,78 @@ def bond_port(self, id : Annotated[StrictStr, Field(..., description="Port UUID" :type bulk_enable: bool :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Port - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the bond_port_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.bond_port_with_http_info(id, bulk_enable, include, **kwargs) # noqa: E501 - - @validate_arguments - def bond_port_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Port UUID")], bulk_enable : Annotated[Optional[StrictBool], Field(description="enable both ports")] = None, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Enabling bonding # noqa: E501 - - Enabling bonding for one or all ports # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.bond_port_with_http_info(id, bulk_enable, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._bond_port_serialize( + id=id, + bulk_enable=bulk_enable, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Port", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def bond_port_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + bulk_enable: Annotated[Optional[StrictBool], Field(description="enable both ports")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Port]: + """Enabling bonding + + Enabling bonding for one or all ports :param id: Port UUID (required) :type id: str @@ -429,460 +767,851 @@ def bond_port_with_http_info(self, id : Annotated[StrictStr, Field(..., descript :type bulk_enable: bool :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Port, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'id', - 'bulk_enable', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + """ # noqa: E501 + + _param = self._bond_port_serialize( + id=id, + bulk_enable=bulk_enable, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method bond_port" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] - - - # process the query parameters - _query_params = [] - if _params.get('bulk_enable') is not None: # noqa: E501 - _query_params.append(('bulk_enable', _params['bulk_enable'])) - - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' - - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { + _response_types_map: Dict[str, Optional[str]] = { '200': "Port", '401': "Error", '403': "Error", '404': "Error", '422': "Error", } - - return self.api_client.call_api( - '/ports/{id}/bond', 'POST', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - def convert_layer2(self, id : Annotated[StrictStr, Field(..., description="Port UUID")], port_assign_input : Annotated[PortAssignInput, Field(..., description="Virtual Network ID. May be the UUID of the Virtual Network record, or the VLAN value itself (ex: '1001').")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> Port: # noqa: E501 - """Convert to Layer 2 # noqa: E501 + ) - Converts a bond port to Layer 2. IP assignments of the port will be removed. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.convert_layer2(id, port_assign_input, include, async_req=True) - >>> result = thread.get() + @validate_call + def bond_port_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + bulk_enable: Annotated[Optional[StrictBool], Field(description="enable both ports")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Enabling bonding - :param id: Port UUID (required) - :type id: str - :param port_assign_input: Virtual Network ID. May be the UUID of the Virtual Network record, or the VLAN value itself (ex: '1001'). (required) - :type port_assign_input: PortAssignInput - :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. - :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Port - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the convert_layer2_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.convert_layer2_with_http_info(id, port_assign_input, include, **kwargs) # noqa: E501 - - @validate_arguments - def convert_layer2_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Port UUID")], port_assign_input : Annotated[PortAssignInput, Field(..., description="Virtual Network ID. May be the UUID of the Virtual Network record, or the VLAN value itself (ex: '1001').")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Convert to Layer 2 # noqa: E501 - - Converts a bond port to Layer 2. IP assignments of the port will be removed. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.convert_layer2_with_http_info(id, port_assign_input, include, async_req=True) - >>> result = thread.get() + Enabling bonding for one or all ports :param id: Port UUID (required) :type id: str - :param port_assign_input: Virtual Network ID. May be the UUID of the Virtual Network record, or the VLAN value itself (ex: '1001'). (required) - :type port_assign_input: PortAssignInput + :param bulk_enable: enable both ports + :type bulk_enable: bool :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Port, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() + """ # noqa: E501 + + _param = self._bond_port_serialize( + id=id, + bulk_enable=bulk_enable, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _all_params = [ - 'id', - 'port_assign_input', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + _response_types_map: Dict[str, Optional[str]] = { + '200': "Port", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) + return response_data.response - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method convert_layer2" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + def _bond_port_serialize( + self, + id, + bulk_enable, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + _host = None + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if bulk_enable is not None: + + _query_params.append(('bulk_enable', bulk_enable)) + + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['port_assign_input'] is not None: - _body_params = _params['port_assign_input'] + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '200': "Port", - '401': "Error", - '403': "Error", - '404': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/ports/{id}/convert/layer-2', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/ports/{id}/bond', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def convert_layer3(self, id : Annotated[StrictStr, Field(..., description="Port UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, port_convert_layer3_input : Annotated[Optional[PortConvertLayer3Input], Field(description="IPs to request")] = None, **kwargs) -> Port: # noqa: E501 - """Convert to Layer 3 # noqa: E501 - Converts a bond port to Layer 3. VLANs must first be unassigned. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def convert_layer2( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + port_assign_input: Annotated[PortAssignInput, Field(description="Virtual Network ID. May be the UUID of the Virtual Network record, or the VLAN value itself (ex: '1001').")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Port: + """Convert to Layer 2 - >>> thread = api.convert_layer3(id, include, port_convert_layer3_input, async_req=True) - >>> result = thread.get() + Converts a bond port to Layer 2. IP assignments of the port will be removed. :param id: Port UUID (required) :type id: str + :param port_assign_input: Virtual Network ID. May be the UUID of the Virtual Network record, or the VLAN value itself (ex: '1001'). (required) + :type port_assign_input: PortAssignInput :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param port_convert_layer3_input: IPs to request - :type port_convert_layer3_input: PortConvertLayer3Input - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Port - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the convert_layer3_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.convert_layer3_with_http_info(id, include, port_convert_layer3_input, **kwargs) # noqa: E501 - - @validate_arguments - def convert_layer3_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Port UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, port_convert_layer3_input : Annotated[Optional[PortConvertLayer3Input], Field(description="IPs to request")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Convert to Layer 3 # noqa: E501 - - Converts a bond port to Layer 3. VLANs must first be unassigned. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.convert_layer3_with_http_info(id, include, port_convert_layer3_input, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._convert_layer2_serialize( + id=id, + port_assign_input=port_assign_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - :param id: Port UUID (required) - :type id: str - :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. - :type include: List[str] - :param port_convert_layer3_input: IPs to request - :type port_convert_layer3_input: PortConvertLayer3Input - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: timeout setting for this request. If one + _response_types_map: Dict[str, Optional[str]] = { + '200': "Port", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def convert_layer2_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + port_assign_input: Annotated[PortAssignInput, Field(description="Virtual Network ID. May be the UUID of the Virtual Network record, or the VLAN value itself (ex: '1001').")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Port]: + """Convert to Layer 2 + + Converts a bond port to Layer 2. IP assignments of the port will be removed. + + :param id: Port UUID (required) + :type id: str + :param port_assign_input: Virtual Network ID. May be the UUID of the Virtual Network record, or the VLAN value itself (ex: '1001'). (required) + :type port_assign_input: PortAssignInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Port, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._convert_layer2_serialize( + id=id, + port_assign_input=port_assign_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Port", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id', - 'include', - 'port_convert_layer3_input' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def convert_layer2_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + port_assign_input: Annotated[PortAssignInput, Field(description="Virtual Network ID. May be the UUID of the Virtual Network record, or the VLAN value itself (ex: '1001').")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Convert to Layer 2 + + Converts a bond port to Layer 2. IP assignments of the port will be removed. + + :param id: Port UUID (required) + :type id: str + :param port_assign_input: Virtual Network ID. May be the UUID of the Virtual Network record, or the VLAN value itself (ex: '1001'). (required) + :type port_assign_input: PortAssignInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._convert_layer2_serialize( + id=id, + port_assign_input=port_assign_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method convert_layer3" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "Port", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _convert_layer2_serialize( + self, + id, + port_assign_input, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['port_convert_layer3_input'] is not None: - _body_params = _params['port_convert_layer3_input'] + if port_assign_input is not None: + _body_params = port_assign_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 + _auth_settings: List[str] = [ + 'x_auth_token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/ports/{id}/convert/layer-2', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + @validate_call + def convert_layer3( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + port_convert_layer3_input: Annotated[Optional[PortConvertLayer3Input], Field(description="IPs to request")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Port: + """Convert to Layer 3 + + Converts a bond port to Layer 3. VLANs must first be unassigned. + + :param id: Port UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param port_convert_layer3_input: IPs to request + :type port_convert_layer3_input: PortConvertLayer3Input + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._convert_layer3_serialize( + id=id, + include=include, + port_convert_layer3_input=port_convert_layer3_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Port", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def convert_layer3_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + port_convert_layer3_input: Annotated[Optional[PortConvertLayer3Input], Field(description="IPs to request")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Port]: + """Convert to Layer 3 + + Converts a bond port to Layer 3. VLANs must first be unassigned. + + :param id: Port UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param port_convert_layer3_input: IPs to request + :type port_convert_layer3_input: PortConvertLayer3Input + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._convert_layer3_serialize( + id=id, + include=include, + port_convert_layer3_input=port_convert_layer3_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Port", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def convert_layer3_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + port_convert_layer3_input: Annotated[Optional[PortConvertLayer3Input], Field(description="IPs to request")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Convert to Layer 3 + + Converts a bond port to Layer 3. VLANs must first be unassigned. + + :param id: Port UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param port_convert_layer3_input: IPs to request + :type port_convert_layer3_input: PortConvertLayer3Input + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._convert_layer3_serialize( + id=id, + include=include, + port_convert_layer3_input=port_convert_layer3_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _response_types_map = { + _response_types_map: Dict[str, Optional[str]] = { '200': "Port", '401': "Error", '403': "Error", '404': "Error", '422': "Error", } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _convert_layer3_serialize( + self, + id, + include, + port_convert_layer3_input, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + # process the header parameters + # process the form parameters + # process the body parameter + if port_convert_layer3_input is not None: + _body_params = port_convert_layer3_input + - return self.api_client.call_api( - '/ports/{id}/convert/layer-3', 'POST', - _path_params, - _query_params, - _header_params, + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/ports/{id}/convert/layer-3', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def create_port_vlan_assignment_batch(self, id : Annotated[StrictStr, Field(..., description="Port UUID")], port_vlan_assignment_batch_create_input : Annotated[PortVlanAssignmentBatchCreateInput, Field(..., description="VLAN Assignment batch details")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> PortVlanAssignmentBatch: # noqa: E501 - """Create a new Port-VLAN Assignment management batch # noqa: E501 - Create a new asynchronous batch request which handles adding and/or removing the VLANs to which the port is assigned. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def create_port_vlan_assignment_batch( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + port_vlan_assignment_batch_create_input: Annotated[PortVlanAssignmentBatchCreateInput, Field(description="VLAN Assignment batch details")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PortVlanAssignmentBatch: + """Create a new Port-VLAN Assignment management batch - >>> thread = api.create_port_vlan_assignment_batch(id, port_vlan_assignment_batch_create_input, include, async_req=True) - >>> result = thread.get() + Create a new asynchronous batch request which handles adding and/or removing the VLANs to which the port is assigned. :param id: Port UUID (required) :type id: str @@ -890,32 +1619,78 @@ def create_port_vlan_assignment_batch(self, id : Annotated[StrictStr, Field(..., :type port_vlan_assignment_batch_create_input: PortVlanAssignmentBatchCreateInput :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: PortVlanAssignmentBatch - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the create_port_vlan_assignment_batch_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.create_port_vlan_assignment_batch_with_http_info(id, port_vlan_assignment_batch_create_input, include, **kwargs) # noqa: E501 - - @validate_arguments - def create_port_vlan_assignment_batch_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Port UUID")], port_vlan_assignment_batch_create_input : Annotated[PortVlanAssignmentBatchCreateInput, Field(..., description="VLAN Assignment batch details")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Create a new Port-VLAN Assignment management batch # noqa: E501 - - Create a new asynchronous batch request which handles adding and/or removing the VLANs to which the port is assigned. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_port_vlan_assignment_batch_with_http_info(id, port_vlan_assignment_batch_create_input, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._create_port_vlan_assignment_batch_serialize( + id=id, + port_vlan_assignment_batch_create_input=port_vlan_assignment_batch_create_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "PortVlanAssignmentBatch", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_port_vlan_assignment_batch_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + port_vlan_assignment_batch_create_input: Annotated[PortVlanAssignmentBatchCreateInput, Field(description="VLAN Assignment batch details")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PortVlanAssignmentBatch]: + """Create a new Port-VLAN Assignment management batch + + Create a new asynchronous batch request which handles adding and/or removing the VLANs to which the port is assigned. :param id: Port UUID (required) :type id: str @@ -923,284 +1698,517 @@ def create_port_vlan_assignment_batch_with_http_info(self, id : Annotated[Strict :type port_vlan_assignment_batch_create_input: PortVlanAssignmentBatchCreateInput :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(PortVlanAssignmentBatch, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._create_port_vlan_assignment_batch_serialize( + id=id, + port_vlan_assignment_batch_create_input=port_vlan_assignment_batch_create_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "PortVlanAssignmentBatch", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id', - 'port_vlan_assignment_batch_create_input', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def create_port_vlan_assignment_batch_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + port_vlan_assignment_batch_create_input: Annotated[PortVlanAssignmentBatchCreateInput, Field(description="VLAN Assignment batch details")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a new Port-VLAN Assignment management batch + + Create a new asynchronous batch request which handles adding and/or removing the VLANs to which the port is assigned. + + :param id: Port UUID (required) + :type id: str + :param port_vlan_assignment_batch_create_input: VLAN Assignment batch details (required) + :type port_vlan_assignment_batch_create_input: PortVlanAssignmentBatchCreateInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_port_vlan_assignment_batch_serialize( + id=id, + port_vlan_assignment_batch_create_input=port_vlan_assignment_batch_create_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_port_vlan_assignment_batch" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '201': "PortVlanAssignmentBatch", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _create_port_vlan_assignment_batch_serialize( + self, + id, + port_vlan_assignment_batch_create_input, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['port_vlan_assignment_batch_create_input'] is not None: - _body_params = _params['port_vlan_assignment_batch_create_input'] + if port_vlan_assignment_batch_create_input is not None: + _body_params = port_vlan_assignment_batch_create_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '201': "PortVlanAssignmentBatch", - '401': "Error", - '403': "Error", - '404': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/ports/{id}/vlan-assignments/batches', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/ports/{id}/vlan-assignments/batches', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def delete_native_vlan(self, id : Annotated[StrictStr, Field(..., description="Port UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> Port: # noqa: E501 - """Remove native VLAN # noqa: E501 - Removes the native VLAN from this port # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def delete_native_vlan( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Port: + """Remove native VLAN - >>> thread = api.delete_native_vlan(id, include, async_req=True) - >>> result = thread.get() + Removes the native VLAN from this port :param id: Port UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Port - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the delete_native_vlan_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.delete_native_vlan_with_http_info(id, include, **kwargs) # noqa: E501 - - @validate_arguments - def delete_native_vlan_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Port UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Remove native VLAN # noqa: E501 - - Removes the native VLAN from this port # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_native_vlan_with_http_info(id, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._delete_native_vlan_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Port", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_native_vlan_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Port]: + """Remove native VLAN + + Removes the native VLAN from this port + + :param id: Port UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_native_vlan_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Port", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_native_vlan_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Remove native VLAN + + Removes the native VLAN from this port :param id: Port UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Port, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() + """ # noqa: E501 + + _param = self._delete_native_vlan_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _all_params = [ - 'id', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + _response_types_map: Dict[str, Optional[str]] = { + '200': "Port", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) + return response_data.response - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_native_vlan" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + def _delete_native_vlan_serialize( + self, + id, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + _host = None + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "Port", - '401': "Error", - '404': "Error", - '422': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/ports/{id}/native-vlan', 'DELETE', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='DELETE', + resource_path='/ports/{id}/native-vlan', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def disbond_port(self, id : Annotated[StrictStr, Field(..., description="Port UUID")], bulk_disable : Annotated[Optional[StrictBool], Field(description="disable both ports")] = None, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> Port: # noqa: E501 - """Disabling bonding # noqa: E501 - Disabling bonding for one or all ports # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def disbond_port( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + bulk_disable: Annotated[Optional[StrictBool], Field(description="disable both ports")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Port: + """Disabling bonding - >>> thread = api.disbond_port(id, bulk_disable, include, async_req=True) - >>> result = thread.get() + Disabling bonding for one or all ports :param id: Port UUID (required) :type id: str @@ -1208,32 +2216,78 @@ def disbond_port(self, id : Annotated[StrictStr, Field(..., description="Port UU :type bulk_disable: bool :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Port - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the disbond_port_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.disbond_port_with_http_info(id, bulk_disable, include, **kwargs) # noqa: E501 - - @validate_arguments - def disbond_port_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Port UUID")], bulk_disable : Annotated[Optional[StrictBool], Field(description="disable both ports")] = None, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Disabling bonding # noqa: E501 - - Disabling bonding for one or all ports # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.disbond_port_with_http_info(id, bulk_disable, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._disbond_port_serialize( + id=id, + bulk_disable=bulk_disable, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Port", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def disbond_port_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + bulk_disable: Annotated[Optional[StrictBool], Field(description="disable both ports")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Port]: + """Disabling bonding + + Disabling bonding for one or all ports :param id: Port UUID (required) :type id: str @@ -1241,276 +2295,503 @@ def disbond_port_with_http_info(self, id : Annotated[StrictStr, Field(..., descr :type bulk_disable: bool :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Port, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._disbond_port_serialize( + id=id, + bulk_disable=bulk_disable, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "Port", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id', - 'bulk_disable', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def disbond_port_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + bulk_disable: Annotated[Optional[StrictBool], Field(description="disable both ports")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Disabling bonding + + Disabling bonding for one or all ports + + :param id: Port UUID (required) + :type id: str + :param bulk_disable: disable both ports + :type bulk_disable: bool + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._disbond_port_serialize( + id=id, + bulk_disable=bulk_disable, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method disbond_port" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "Port", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _disbond_port_serialize( + self, + id, + bulk_disable, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('bulk_disable') is not None: # noqa: E501 - _query_params.append(('bulk_disable', _params['bulk_disable'])) + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if bulk_disable is not None: + + _query_params.append(('bulk_disable', bulk_disable)) + + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "Port", - '401': "Error", - '403': "Error", - '404': "Error", - '422': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/ports/{id}/disbond', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/ports/{id}/disbond', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_port_by_id(self, id : Annotated[StrictStr, Field(..., description="Port UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> Port: # noqa: E501 - """Retrieve a port # noqa: E501 - Returns a port # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_port_by_id( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Port: + """Retrieve a port - >>> thread = api.find_port_by_id(id, include, async_req=True) - >>> result = thread.get() + Returns a port :param id: Port UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Port - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_port_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_port_by_id_with_http_info(id, include, **kwargs) # noqa: E501 - - @validate_arguments - def find_port_by_id_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Port UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve a port # noqa: E501 - - Returns a port # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_port_by_id_with_http_info(id, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_port_by_id_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Port", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_port_by_id_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Port]: + """Retrieve a port + + Returns a port :param id: Port UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Port, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_port_by_id_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Port", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def find_port_by_id_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve a port + + Returns a port + + :param id: Port UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_port_by_id_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_port_by_id" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "Port", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_port_by_id_serialize( + self, + id, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "Port", - '401': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/ports/{id}', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/ports/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_port_vlan_assignment_batch_by_port_id_and_batch_id(self, id : Annotated[StrictStr, Field(..., description="Port UUID")], batch_id : Annotated[StrictStr, Field(..., description="Batch ID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> PortVlanAssignmentBatch: # noqa: E501 - """Retrieve a VLAN Assignment Batch's details # noqa: E501 - Returns the details of an existing Port-VLAN Assignment batch, including the list of VLANs to assign or unassign, and the current state of the batch. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_port_vlan_assignment_batch_by_port_id_and_batch_id( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + batch_id: Annotated[StrictStr, Field(description="Batch ID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PortVlanAssignmentBatch: + """Retrieve a VLAN Assignment Batch's details - >>> thread = api.find_port_vlan_assignment_batch_by_port_id_and_batch_id(id, batch_id, include, async_req=True) - >>> result = thread.get() + Returns the details of an existing Port-VLAN Assignment batch, including the list of VLANs to assign or unassign, and the current state of the batch. :param id: Port UUID (required) :type id: str @@ -1518,32 +2799,77 @@ def find_port_vlan_assignment_batch_by_port_id_and_batch_id(self, id : Annotated :type batch_id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: PortVlanAssignmentBatch - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_port_vlan_assignment_batch_by_port_id_and_batch_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_port_vlan_assignment_batch_by_port_id_and_batch_id_with_http_info(id, batch_id, include, **kwargs) # noqa: E501 - - @validate_arguments - def find_port_vlan_assignment_batch_by_port_id_and_batch_id_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Port UUID")], batch_id : Annotated[StrictStr, Field(..., description="Batch ID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve a VLAN Assignment Batch's details # noqa: E501 - - Returns the details of an existing Port-VLAN Assignment batch, including the list of VLANs to assign or unassign, and the current state of the batch. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_port_vlan_assignment_batch_by_port_id_and_batch_id_with_http_info(id, batch_id, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_port_vlan_assignment_batch_by_port_id_and_batch_id_serialize( + id=id, + batch_id=batch_id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PortVlanAssignmentBatch", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_port_vlan_assignment_batch_by_port_id_and_batch_id_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + batch_id: Annotated[StrictStr, Field(description="Batch ID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PortVlanAssignmentBatch]: + """Retrieve a VLAN Assignment Batch's details + + Returns the details of an existing Port-VLAN Assignment batch, including the list of VLANs to assign or unassign, and the current state of the batch. :param id: Port UUID (required) :type id: str @@ -1551,267 +2877,484 @@ def find_port_vlan_assignment_batch_by_port_id_and_batch_id_with_http_info(self, :type batch_id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(PortVlanAssignmentBatch, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_port_vlan_assignment_batch_by_port_id_and_batch_id_serialize( + id=id, + batch_id=batch_id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "PortVlanAssignmentBatch", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id', - 'batch_id', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def find_port_vlan_assignment_batch_by_port_id_and_batch_id_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + batch_id: Annotated[StrictStr, Field(description="Batch ID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve a VLAN Assignment Batch's details + + Returns the details of an existing Port-VLAN Assignment batch, including the list of VLANs to assign or unassign, and the current state of the batch. + + :param id: Port UUID (required) + :type id: str + :param batch_id: Batch ID (required) + :type batch_id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_port_vlan_assignment_batch_by_port_id_and_batch_id_serialize( + id=id, + batch_id=batch_id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_port_vlan_assignment_batch_by_port_id_and_batch_id" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "PortVlanAssignmentBatch", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_port_vlan_assignment_batch_by_port_id_and_batch_id_serialize( + self, + id, + batch_id, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - if _params['batch_id']: - _path_params['batch_id'] = _params['batch_id'] + _host = None + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + if batch_id is not None: + _path_params['batch_id'] = batch_id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "PortVlanAssignmentBatch", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/ports/{id}/vlan-assignments/batches/{batch_id}', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/ports/{id}/vlan-assignments/batches/{batch_id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + - @validate_arguments - def find_port_vlan_assignment_batches(self, id : Annotated[StrictStr, Field(..., description="Port UUID")], **kwargs) -> PortVlanAssignmentBatchList: # noqa: E501 - """List the VLAN Assignment Batches for a port # noqa: E501 + @validate_call + def find_port_vlan_assignment_batches( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PortVlanAssignmentBatchList: + """List the VLAN Assignment Batches for a port + + Show all the VLAN assignment batches that have been created for managing this port's VLAN assignments + + :param id: Port UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_port_vlan_assignment_batches_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Show all the VLAN assignment batches that have been created for managing this port's VLAN assignments # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "PortVlanAssignmentBatchList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_port_vlan_assignment_batches_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PortVlanAssignmentBatchList]: + """List the VLAN Assignment Batches for a port - >>> thread = api.find_port_vlan_assignment_batches(id, async_req=True) - >>> result = thread.get() + Show all the VLAN assignment batches that have been created for managing this port's VLAN assignments :param id: Port UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: PortVlanAssignmentBatchList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_port_vlan_assignment_batches_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_port_vlan_assignment_batches_with_http_info(id, **kwargs) # noqa: E501 - - @validate_arguments - def find_port_vlan_assignment_batches_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Port UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """List the VLAN Assignment Batches for a port # noqa: E501 - - Show all the VLAN assignment batches that have been created for managing this port's VLAN assignments # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_port_vlan_assignment_batches_with_http_info(id, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_port_vlan_assignment_batches_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PortVlanAssignmentBatchList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def find_port_vlan_assignment_batches_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List the VLAN Assignment Batches for a port + + Show all the VLAN assignment batches that have been created for managing this port's VLAN assignments :param id: Port UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(PortVlanAssignmentBatchList, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() + """ # noqa: E501 + + _param = self._find_port_vlan_assignment_batches_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _all_params = [ - 'id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + _response_types_map: Dict[str, Optional[str]] = { + '200': "PortVlanAssignmentBatchList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) + return response_data.response - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_port_vlan_assignment_batches" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + def _find_port_vlan_assignment_batches_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + _host = None + + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "PortVlanAssignmentBatchList", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/ports/{id}/vlan-assignments/batches', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/ports/{id}/vlan-assignments/batches', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_port_vlan_assignment_by_port_id_and_assignment_id(self, id : Annotated[StrictStr, Field(..., description="Port UUID")], assignment_id : Annotated[StrictStr, Field(..., description="Assignment ID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> PortVlanAssignment: # noqa: E501 - """Show a particular Port VLAN assignment's details # noqa: E501 - Show the details of a specific Port-VLAN assignment, including the current state and if the VLAN is set as native. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_port_vlan_assignment_by_port_id_and_assignment_id( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + assignment_id: Annotated[StrictStr, Field(description="Assignment ID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PortVlanAssignment: + """Show a particular Port VLAN assignment's details - >>> thread = api.find_port_vlan_assignment_by_port_id_and_assignment_id(id, assignment_id, include, async_req=True) - >>> result = thread.get() + Show the details of a specific Port-VLAN assignment, including the current state and if the VLAN is set as native. :param id: Port UUID (required) :type id: str @@ -1819,32 +3362,77 @@ def find_port_vlan_assignment_by_port_id_and_assignment_id(self, id : Annotated[ :type assignment_id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: PortVlanAssignment - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_port_vlan_assignment_by_port_id_and_assignment_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_port_vlan_assignment_by_port_id_and_assignment_id_with_http_info(id, assignment_id, include, **kwargs) # noqa: E501 - - @validate_arguments - def find_port_vlan_assignment_by_port_id_and_assignment_id_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Port UUID")], assignment_id : Annotated[StrictStr, Field(..., description="Assignment ID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Show a particular Port VLAN assignment's details # noqa: E501 - - Show the details of a specific Port-VLAN assignment, including the current state and if the VLAN is set as native. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_port_vlan_assignment_by_port_id_and_assignment_id_with_http_info(id, assignment_id, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_port_vlan_assignment_by_port_id_and_assignment_id_serialize( + id=id, + assignment_id=assignment_id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PortVlanAssignment", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_port_vlan_assignment_by_port_id_and_assignment_id_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + assignment_id: Annotated[StrictStr, Field(description="Assignment ID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PortVlanAssignment]: + """Show a particular Port VLAN assignment's details + + Show the details of a specific Port-VLAN assignment, including the current state and if the VLAN is set as native. :param id: Port UUID (required) :type id: str @@ -1852,276 +3440,502 @@ def find_port_vlan_assignment_by_port_id_and_assignment_id_with_http_info(self, :type assignment_id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(PortVlanAssignment, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_port_vlan_assignment_by_port_id_and_assignment_id_serialize( + id=id, + assignment_id=assignment_id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PortVlanAssignment", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id', - 'assignment_id', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def find_port_vlan_assignment_by_port_id_and_assignment_id_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + assignment_id: Annotated[StrictStr, Field(description="Assignment ID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Show a particular Port VLAN assignment's details + + Show the details of a specific Port-VLAN assignment, including the current state and if the VLAN is set as native. + + :param id: Port UUID (required) + :type id: str + :param assignment_id: Assignment ID (required) + :type assignment_id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_port_vlan_assignment_by_port_id_and_assignment_id_serialize( + id=id, + assignment_id=assignment_id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_port_vlan_assignment_by_port_id_and_assignment_id" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "PortVlanAssignment", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_port_vlan_assignment_by_port_id_and_assignment_id_serialize( + self, + id, + assignment_id, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - if _params['assignment_id']: - _path_params['assignment_id'] = _params['assignment_id'] + _host = None + _collection_formats: Dict[str, str] = { + 'include': 'multi', + } - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'multi' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + if assignment_id is not None: + _path_params['assignment_id'] = assignment_id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "PortVlanAssignment", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/ports/{id}/vlan-assignments/{assignment_id}', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/ports/{id}/vlan-assignments/{assignment_id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_port_vlan_assignments(self, id : Annotated[StrictStr, Field(..., description="Port UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> PortVlanAssignmentList: # noqa: E501 - """List Current VLAN assignments for a port # noqa: E501 - Show the port's current VLAN assignments, including if this VLAN is set as native, and the current state of the assignment (ex. 'assigned' or 'unassigning') # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_port_vlan_assignments( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PortVlanAssignmentList: + """List Current VLAN assignments for a port - >>> thread = api.find_port_vlan_assignments(id, include, async_req=True) - >>> result = thread.get() + Show the port's current VLAN assignments, including if this VLAN is set as native, and the current state of the assignment (ex. 'assigned' or 'unassigning') :param id: Port UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: PortVlanAssignmentList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_port_vlan_assignments_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_port_vlan_assignments_with_http_info(id, include, **kwargs) # noqa: E501 - - @validate_arguments - def find_port_vlan_assignments_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Port UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """List Current VLAN assignments for a port # noqa: E501 - - Show the port's current VLAN assignments, including if this VLAN is set as native, and the current state of the assignment (ex. 'assigned' or 'unassigning') # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_port_vlan_assignments_with_http_info(id, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_port_vlan_assignments_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PortVlanAssignmentList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_port_vlan_assignments_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PortVlanAssignmentList]: + """List Current VLAN assignments for a port + + Show the port's current VLAN assignments, including if this VLAN is set as native, and the current state of the assignment (ex. 'assigned' or 'unassigning') :param id: Port UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(PortVlanAssignmentList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_port_vlan_assignments_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PortVlanAssignmentList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def find_port_vlan_assignments_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Current VLAN assignments for a port + + Show the port's current VLAN assignments, including if this VLAN is set as native, and the current state of the assignment (ex. 'assigned' or 'unassigning') + + :param id: Port UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_port_vlan_assignments_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_port_vlan_assignments" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "PortVlanAssignmentList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_port_vlan_assignments_serialize( + self, + id, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'multi' + _collection_formats: Dict[str, str] = { + 'include': 'multi', + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "PortVlanAssignmentList", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/ports/{id}/vlan-assignments', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/ports/{id}/vlan-assignments', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def unassign_port(self, id : Annotated[StrictStr, Field(..., description="Port UUID")], port_assign_input : Annotated[PortAssignInput, Field(..., description="Virtual Network ID. May be the UUID of the Virtual Network record, or the VLAN value itself (ex: '1001').")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> Port: # noqa: E501 - """Unassign a port # noqa: E501 - Unassign a port for a hardware. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def unassign_port( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + port_assign_input: Annotated[PortAssignInput, Field(description="Virtual Network ID. May be the UUID of the Virtual Network record, or the VLAN value itself (ex: '1001').")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Port: + """Unassign a port - >>> thread = api.unassign_port(id, port_assign_input, include, async_req=True) - >>> result = thread.get() + Unassign a port for a hardware. :param id: Port UUID (required) :type id: str @@ -2129,32 +3943,78 @@ def unassign_port(self, id : Annotated[StrictStr, Field(..., description="Port U :type port_assign_input: PortAssignInput :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Port - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the unassign_port_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.unassign_port_with_http_info(id, port_assign_input, include, **kwargs) # noqa: E501 - - @validate_arguments - def unassign_port_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Port UUID")], port_assign_input : Annotated[PortAssignInput, Field(..., description="Virtual Network ID. May be the UUID of the Virtual Network record, or the VLAN value itself (ex: '1001').")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Unassign a port # noqa: E501 - - Unassign a port for a hardware. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.unassign_port_with_http_info(id, port_assign_input, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._unassign_port_serialize( + id=id, + port_assign_input=port_assign_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Port", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def unassign_port_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + port_assign_input: Annotated[PortAssignInput, Field(description="Virtual Network ID. May be the UUID of the Virtual Network record, or the VLAN value itself (ex: '1001').")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Port]: + """Unassign a port + + Unassign a port for a hardware. :param id: Port UUID (required) :type id: str @@ -2162,119 +4022,209 @@ def unassign_port_with_http_info(self, id : Annotated[StrictStr, Field(..., desc :type port_assign_input: PortAssignInput :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Port, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._unassign_port_serialize( + id=id, + port_assign_input=port_assign_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "Port", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id', - 'port_assign_input', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def unassign_port_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Port UUID")], + port_assign_input: Annotated[PortAssignInput, Field(description="Virtual Network ID. May be the UUID of the Virtual Network record, or the VLAN value itself (ex: '1001').")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Unassign a port + + Unassign a port for a hardware. + + :param id: Port UUID (required) + :type id: str + :param port_assign_input: Virtual Network ID. May be the UUID of the Virtual Network record, or the VLAN value itself (ex: '1001'). (required) + :type port_assign_input: PortAssignInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._unassign_port_serialize( + id=id, + port_assign_input=port_assign_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method unassign_port" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "Port", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _unassign_port_serialize( + self, + id, + port_assign_input, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['port_assign_input'] is not None: - _body_params = _params['port_assign_input'] + if port_assign_input is not None: + _body_params = port_assign_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '200': "Port", - '401': "Error", - '403': "Error", - '404': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/ports/{id}/unassign', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/ports/{id}/unassign', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/projects_api.py b/equinix_metal/equinix_metal/api/projects_api.py index 8170c9f6..72fb8d5a 100644 --- a/equinix_metal/equinix_metal/api/projects_api.py +++ b/equinix_metal/equinix_metal/api/projects_api.py @@ -12,18 +12,14 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictStr, conint, conlist - -from typing import Optional - +from pydantic import Field, StrictStr +from typing import List, Optional +from typing_extensions import Annotated from equinix_metal.models.invitation import Invitation from equinix_metal.models.invitation_input import InvitationInput from equinix_metal.models.invitation_list import InvitationList @@ -35,36 +31,121 @@ from equinix_metal.models.transfer_request import TransferRequest from equinix_metal.models.transfer_request_input import TransferRequestInput -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class ProjectsApi(object): +class ProjectsApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def create_project( + self, + project_create_from_root_input: Annotated[ProjectCreateFromRootInput, Field(description="Project to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Project: + """Create a project - @validate_arguments - def create_project(self, project_create_from_root_input : Annotated[ProjectCreateFromRootInput, Field(..., description="Project to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> Project: # noqa: E501 - """Create a project # noqa: E501 + Creates a new project for the user's default organization. If the user does not have a default organization, the API will look for a personal organization belonging to the user with the name \"{User's Full Name} Projects\" to associate the project with. If that organization does not exist a new organization named \"{User's Full Name} Projects\" will be created and the new project will be tied to that organization. - Creates a new project for the user's default organization. If the user does not have a default organization, the API will look for a personal organization belonging to the user with the name \"{User's Full Name} Projects\" to associate the project with. If that organization does not exist a new organization named \"{User's Full Name} Projects\" will be created and the new project will be tied to that organization. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + :param project_create_from_root_input: Project to create (required) + :type project_create_from_root_input: ProjectCreateFromRootInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_project_serialize( + project_create_from_root_input=project_create_from_root_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - >>> thread = api.create_project(project_create_from_root_input, include, exclude, async_req=True) - >>> result = thread.get() + _response_types_map: Dict[str, Optional[str]] = { + '201': "Project", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_project_with_http_info( + self, + project_create_from_root_input: Annotated[ProjectCreateFromRootInput, Field(description="Project to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Project]: + """Create a project + + Creates a new project for the user's default organization. If the user does not have a default organization, the API will look for a personal organization belonging to the user with the name \"{User's Full Name} Projects\" to associate the project with. If that organization does not exist a new organization named \"{User's Full Name} Projects\" will be created and the new project will be tied to that organization. :param project_create_from_root_input: Project to create (required) :type project_create_from_root_input: ProjectCreateFromRootInput @@ -72,32 +153,76 @@ def create_project(self, project_create_from_root_input : Annotated[ProjectCreat :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Project - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the create_project_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.create_project_with_http_info(project_create_from_root_input, include, exclude, **kwargs) # noqa: E501 + """ # noqa: E501 + + _param = self._create_project_serialize( + project_create_from_root_input=project_create_from_root_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - @validate_arguments - def create_project_with_http_info(self, project_create_from_root_input : Annotated[ProjectCreateFromRootInput, Field(..., description="Project to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Create a project # noqa: E501 + _response_types_map: Dict[str, Optional[str]] = { + '201': "Project", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - Creates a new project for the user's default organization. If the user does not have a default organization, the API will look for a personal organization belonging to the user with the name \"{User's Full Name} Projects\" to associate the project with. If that organization does not exist a new organization named \"{User's Full Name} Projects\" will be created and the new project will be tied to that organization. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_project_with_http_info(project_create_from_root_input, include, exclude, async_req=True) - >>> result = thread.get() + @validate_call + def create_project_without_preload_content( + self, + project_create_from_root_input: Annotated[ProjectCreateFromRootInput, Field(description="Project to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a project + + Creates a new project for the user's default organization. If the user does not have a default organization, the API will look for a personal organization belonging to the user with the name \"{User's Full Name} Projects\" to associate the project with. If that organization does not exist a new organization named \"{User's Full Name} Projects\" will be created and the new project will be tied to that organization. :param project_create_from_root_input: Project to create (required) :type project_create_from_root_input: ProjectCreateFromRootInput @@ -105,132 +230,156 @@ def create_project_with_http_info(self, project_create_from_root_input : Annotat :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Project, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() + """ # noqa: E501 + + _param = self._create_project_serialize( + project_create_from_root_input=project_create_from_root_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _all_params = [ - 'project_create_from_root_input', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + _response_types_map: Dict[str, Optional[str]] = { + '201': "Project", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) + return response_data.response - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_project" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + def _create_project_serialize( + self, + project_create_from_root_input, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the path parameters - _path_params = {} + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['project_create_from_root_input'] is not None: - _body_params = _params['project_create_from_root_input'] + if project_create_from_root_input is not None: + _body_params = project_create_from_root_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '201': "Project", - '401': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/projects', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def create_project_invitation(self, project_id : Annotated[StrictStr, Field(..., description="Project UUID")], invitation_input : Annotated[InvitationInput, Field(..., description="Invitation to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> Invitation: # noqa: E501 - """Create an invitation for a project # noqa: E501 - In order to add a user to a project, they must first be invited. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def create_project_invitation( + self, + project_id: Annotated[StrictStr, Field(description="Project UUID")], + invitation_input: Annotated[InvitationInput, Field(description="Invitation to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Invitation: + """Create an invitation for a project - >>> thread = api.create_project_invitation(project_id, invitation_input, include, async_req=True) - >>> result = thread.get() + In order to add a user to a project, they must first be invited. :param project_id: Project UUID (required) :type project_id: str @@ -238,32 +387,78 @@ def create_project_invitation(self, project_id : Annotated[StrictStr, Field(..., :type invitation_input: InvitationInput :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Invitation - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the create_project_invitation_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.create_project_invitation_with_http_info(project_id, invitation_input, include, **kwargs) # noqa: E501 - - @validate_arguments - def create_project_invitation_with_http_info(self, project_id : Annotated[StrictStr, Field(..., description="Project UUID")], invitation_input : Annotated[InvitationInput, Field(..., description="Invitation to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Create an invitation for a project # noqa: E501 + """ # noqa: E501 + + _param = self._create_project_invitation_serialize( + project_id=project_id, + invitation_input=invitation_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - In order to add a user to a project, they must first be invited. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '201': "Invitation", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_project_invitation_with_http_info( + self, + project_id: Annotated[StrictStr, Field(description="Project UUID")], + invitation_input: Annotated[InvitationInput, Field(description="Invitation to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Invitation]: + """Create an invitation for a project - >>> thread = api.create_project_invitation_with_http_info(project_id, invitation_input, include, async_req=True) - >>> result = thread.get() + In order to add a user to a project, they must first be invited. :param project_id: Project UUID (required) :type project_id: str @@ -271,133 +466,234 @@ def create_project_invitation_with_http_info(self, project_id : Annotated[Strict :type invitation_input: InvitationInput :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Invitation, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._create_project_invitation_serialize( + project_id=project_id, + invitation_input=invitation_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "Invitation", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'project_id', - 'invitation_input', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def create_project_invitation_without_preload_content( + self, + project_id: Annotated[StrictStr, Field(description="Project UUID")], + invitation_input: Annotated[InvitationInput, Field(description="Invitation to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create an invitation for a project + + In order to add a user to a project, they must first be invited. + + :param project_id: Project UUID (required) + :type project_id: str + :param invitation_input: Invitation to create (required) + :type invitation_input: InvitationInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_project_invitation_serialize( + project_id=project_id, + invitation_input=invitation_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_project_invitation" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '201': "Invitation", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['project_id']: - _path_params['project_id'] = _params['project_id'] + def _create_project_invitation_serialize( + self, + project_id, + invitation_input, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if project_id is not None: + _path_params['project_id'] = project_id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['invitation_input'] is not None: - _body_params = _params['invitation_input'] + if invitation_input is not None: + _body_params = invitation_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '201': "Invitation", - '401': "Error", - '403': "Error", - '404': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{project_id}/invitations', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/projects/{project_id}/invitations', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def create_transfer_request(self, id : Annotated[StrictStr, Field(..., description="UUID of the project to be transferred")], transfer_request_input : Annotated[TransferRequestInput, Field(..., description="Transfer Request to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> TransferRequest: # noqa: E501 - """(Deprecated) Create a transfer request # noqa: E501 - Organization owners can transfer their projects to other organizations. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def create_transfer_request( + self, + id: Annotated[StrictStr, Field(description="UUID of the project to be transferred")], + transfer_request_input: Annotated[TransferRequestInput, Field(description="Transfer Request to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> TransferRequest: + """(Deprecated) Create a transfer request - >>> thread = api.create_transfer_request(id, transfer_request_input, include, async_req=True) - >>> result = thread.get() + Organization owners can transfer their projects to other organizations. :param id: UUID of the project to be transferred (required) :type id: str @@ -405,32 +701,79 @@ def create_transfer_request(self, id : Annotated[StrictStr, Field(..., descripti :type transfer_request_input: TransferRequestInput :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: TransferRequest - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the create_transfer_request_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.create_transfer_request_with_http_info(id, transfer_request_input, include, **kwargs) # noqa: E501 + """ # noqa: E501 + warnings.warn("POST /projects/{id}/transfers is deprecated.", DeprecationWarning) - @validate_arguments - def create_transfer_request_with_http_info(self, id : Annotated[StrictStr, Field(..., description="UUID of the project to be transferred")], transfer_request_input : Annotated[TransferRequestInput, Field(..., description="Transfer Request to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """(Deprecated) Create a transfer request # noqa: E501 + _param = self._create_transfer_request_serialize( + id=id, + transfer_request_input=transfer_request_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Organization owners can transfer their projects to other organizations. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '201': "TransferRequest", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_transfer_request_with_http_info( + self, + id: Annotated[StrictStr, Field(description="UUID of the project to be transferred")], + transfer_request_input: Annotated[TransferRequestInput, Field(description="Transfer Request to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[TransferRequest]: + """(Deprecated) Create a transfer request - >>> thread = api.create_transfer_request_with_http_info(id, transfer_request_input, include, async_req=True) - >>> result = thread.get() + Organization owners can transfer their projects to other organizations. :param id: UUID of the project to be transferred (required) :type id: str @@ -438,417 +781,781 @@ def create_transfer_request_with_http_info(self, id : Annotated[StrictStr, Field :type transfer_request_input: TransferRequestInput :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(TransferRequest, status_code(int), headers(HTTPHeaderDict)) - """ - + """ # noqa: E501 warnings.warn("POST /projects/{id}/transfers is deprecated.", DeprecationWarning) - _params = locals() - - _all_params = [ - 'id', - 'transfer_request_input', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + _param = self._create_transfer_request_serialize( + id=id, + transfer_request_input=transfer_request_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_transfer_request" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] - - - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' - - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params['transfer_request_input'] is not None: - _body_params = _params['transfer_request_input'] - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list - - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { + _response_types_map: Dict[str, Optional[str]] = { '201': "TransferRequest", '401': "Error", '403': "Error", '404': "Error", '422': "Error", } - - return self.api_client.call_api( - '/projects/{id}/transfers', 'POST', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + ) - @validate_arguments - def delete_project(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], **kwargs) -> None: # noqa: E501 - """Delete the project # noqa: E501 - Deletes the project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def create_transfer_request_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="UUID of the project to be transferred")], + transfer_request_input: Annotated[TransferRequestInput, Field(description="Transfer Request to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """(Deprecated) Create a transfer request - >>> thread = api.delete_project(id, async_req=True) - >>> result = thread.get() + Organization owners can transfer their projects to other organizations. - :param id: Project UUID (required) + :param id: UUID of the project to be transferred (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional + :param transfer_request_input: Transfer Request to create (required) + :type transfer_request_input: TransferRequestInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the delete_project_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.delete_project_with_http_info(id, **kwargs) # noqa: E501 + """ # noqa: E501 + warnings.warn("POST /projects/{id}/transfers is deprecated.", DeprecationWarning) - @validate_arguments - def delete_project_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """Delete the project # noqa: E501 + _param = self._create_transfer_request_serialize( + id=id, + transfer_request_input=transfer_request_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Deletes the project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '201': "TransferRequest", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - >>> thread = api.delete_project_with_http_info(id, async_req=True) - >>> result = thread.get() + + def _create_transfer_request_serialize( + self, + id, + transfer_request_input, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + # process the header parameters + # process the form parameters + # process the body parameter + if transfer_request_input is not None: + _body_params = transfer_request_input + + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/projects/{id}/transfers', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + @validate_call + def delete_project( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete the project + + Deletes the project. :param id: Project UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 + + _param = self._delete_project_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_project_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete the project - _all_params = [ - 'id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + Deletes the project. + + :param id: Project UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_project_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_project_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete the project + + Deletes the project. + + :param id: Project UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_project_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_project" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _delete_project_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{id}', 'DELETE', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='DELETE', + resource_path='/projects/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_ip_reservation_customdata(self, project_id : Annotated[StrictStr, Field(..., description="Project UUID")], id : Annotated[StrictStr, Field(..., description="Ip Reservation UUID")], **kwargs) -> None: # noqa: E501 - """Retrieve the custom metadata of an IP Reservation # noqa: E501 - Provides the custom metadata stored for this IP Reservation in json format # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_ip_reservation_customdata( + self, + project_id: Annotated[StrictStr, Field(description="Project UUID")], + id: Annotated[StrictStr, Field(description="Ip Reservation UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Retrieve the custom metadata of an IP Reservation - >>> thread = api.find_ip_reservation_customdata(project_id, id, async_req=True) - >>> result = thread.get() + Provides the custom metadata stored for this IP Reservation in json format :param project_id: Project UUID (required) :type project_id: str :param id: Ip Reservation UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_ip_reservation_customdata_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_ip_reservation_customdata_with_http_info(project_id, id, **kwargs) # noqa: E501 - - @validate_arguments - def find_ip_reservation_customdata_with_http_info(self, project_id : Annotated[StrictStr, Field(..., description="Project UUID")], id : Annotated[StrictStr, Field(..., description="Ip Reservation UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve the custom metadata of an IP Reservation # noqa: E501 + """ # noqa: E501 + + _param = self._find_ip_reservation_customdata_serialize( + project_id=project_id, + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Provides the custom metadata stored for this IP Reservation in json format # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_ip_reservation_customdata_with_http_info( + self, + project_id: Annotated[StrictStr, Field(description="Project UUID")], + id: Annotated[StrictStr, Field(description="Ip Reservation UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Retrieve the custom metadata of an IP Reservation - >>> thread = api.find_ip_reservation_customdata_with_http_info(project_id, id, async_req=True) - >>> result = thread.get() + Provides the custom metadata stored for this IP Reservation in json format :param project_id: Project UUID (required) :type project_id: str :param id: Ip Reservation UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 + + _param = self._find_ip_reservation_customdata_serialize( + project_id=project_id, + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'project_id', - 'id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def find_ip_reservation_customdata_without_preload_content( + self, + project_id: Annotated[StrictStr, Field(description="Project UUID")], + id: Annotated[StrictStr, Field(description="Ip Reservation UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve the custom metadata of an IP Reservation + + Provides the custom metadata stored for this IP Reservation in json format + + :param project_id: Project UUID (required) + :type project_id: str + :param id: Ip Reservation UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_ip_reservation_customdata_serialize( + project_id=project_id, + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_ip_reservation_customdata" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['project_id']: - _path_params['project_id'] = _params['project_id'] + def _find_ip_reservation_customdata_serialize( + self, + project_id, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - if _params['id']: - _path_params['id'] = _params['id'] + _host = None + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if project_id is not None: + _path_params['project_id'] = project_id + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{project_id}/ips/{id}/customdata', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/projects/{project_id}/ips/{id}/customdata', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_project_by_id(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> Project: # noqa: E501 - """Retrieve a project # noqa: E501 - Returns a single project if the user has access # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_project_by_id( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Project: + """Retrieve a project - >>> thread = api.find_project_by_id(id, include, exclude, async_req=True) - >>> result = thread.get() + Returns a single project if the user has access :param id: Project UUID (required) :type id: str @@ -856,32 +1563,77 @@ def find_project_by_id(self, id : Annotated[StrictStr, Field(..., description="P :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Project - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_project_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_project_by_id_with_http_info(id, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def find_project_by_id_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve a project # noqa: E501 + """ # noqa: E501 + + _param = self._find_project_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Returns a single project if the user has access # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "Project", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_project_by_id_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Project]: + """Retrieve a project - >>> thread = api.find_project_by_id_with_http_info(id, include, exclude, async_req=True) - >>> result = thread.get() + Returns a single project if the user has access :param id: Project UUID (required) :type id: str @@ -889,263 +1641,488 @@ def find_project_by_id_with_http_info(self, id : Annotated[StrictStr, Field(..., :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Project, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_project_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "Project", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def find_project_by_id_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve a project + + Returns a single project if the user has access + + :param id: Project UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_project_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_project_by_id" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "Project", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_project_by_id_serialize( + self, + id, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "Project", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{id}', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/projects/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_project_customdata(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], **kwargs) -> None: # noqa: E501 - """Retrieve the custom metadata of a project # noqa: E501 - Provides the custom metadata stored for this project in json format # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_project_customdata( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Retrieve the custom metadata of a project - >>> thread = api.find_project_customdata(id, async_req=True) - >>> result = thread.get() + Provides the custom metadata stored for this project in json format :param id: Project UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_project_customdata_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_project_customdata_with_http_info(id, **kwargs) # noqa: E501 + """ # noqa: E501 + + _param = self._find_project_customdata_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - @validate_arguments - def find_project_customdata_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve the custom metadata of a project # noqa: E501 + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_project_customdata_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Retrieve the custom metadata of a project - Provides the custom metadata stored for this project in json format # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_project_customdata_with_http_info(id, async_req=True) - >>> result = thread.get() + Provides the custom metadata stored for this project in json format :param id: Project UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 + + _param = self._find_project_customdata_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def find_project_customdata_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve the custom metadata of a project + + Provides the custom metadata stored for this project in json format + + :param id: Project UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_project_customdata_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_project_customdata" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_project_customdata_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{id}/customdata', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/projects/{id}/customdata', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_project_invitations(self, project_id : Annotated[StrictStr, Field(..., description="Project UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> InvitationList: # noqa: E501 - """Retrieve project invitations # noqa: E501 - Returns all invitations in a project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_project_invitations( + self, + project_id: Annotated[StrictStr, Field(description="Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> InvitationList: + """Retrieve project invitations - >>> thread = api.find_project_invitations(project_id, include, page, per_page, async_req=True) - >>> result = thread.get() + Returns all invitations in a project. :param project_id: Project UUID (required) :type project_id: str @@ -1155,32 +2132,79 @@ def find_project_invitations(self, project_id : Annotated[StrictStr, Field(..., :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: InvitationList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_project_invitations_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_project_invitations_with_http_info(project_id, include, page, per_page, **kwargs) # noqa: E501 - - @validate_arguments - def find_project_invitations_with_http_info(self, project_id : Annotated[StrictStr, Field(..., description="Project UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve project invitations # noqa: E501 + """ # noqa: E501 + + _param = self._find_project_invitations_serialize( + project_id=project_id, + include=include, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Returns all invitations in a project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "InvitationList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_project_invitations_with_http_info( + self, + project_id: Annotated[StrictStr, Field(description="Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[InvitationList]: + """Retrieve project invitations - >>> thread = api.find_project_invitations_with_http_info(project_id, include, page, per_page, async_req=True) - >>> result = thread.get() + Returns all invitations in a project. :param project_id: Project UUID (required) :type project_id: str @@ -1190,129 +2214,233 @@ def find_project_invitations_with_http_info(self, project_id : Annotated[StrictS :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(InvitationList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_project_invitations_serialize( + project_id=project_id, + include=include, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "InvitationList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'project_id', - 'include', - 'page', - 'per_page' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def find_project_invitations_without_preload_content( + self, + project_id: Annotated[StrictStr, Field(description="Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] - ) + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve project invitations - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_project_invitations" % _key - ) - _params[_key] = _val - del _params['kwargs'] + Returns all invitations in a project. + + :param project_id: Project UUID (required) + :type project_id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param page: Page to return + :type page: int + :param per_page: Items returned per page + :type per_page: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_project_invitations_serialize( + project_id=project_id, + include=include, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _collection_formats = {} + _response_types_map: Dict[str, Optional[str]] = { + '200': "InvitationList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - # process the path parameters - _path_params = {} - if _params['project_id']: - _path_params['project_id'] = _params['project_id'] + def _find_project_invitations_serialize( + self, + project_id, + include, + page, + per_page, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _host = None - if _params.get('page') is not None: # noqa: E501 - _query_params.append(('page', _params['page'])) + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } - if _params.get('per_page') is not None: # noqa: E501 - _query_params.append(('per_page', _params['per_page'])) + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if project_id is not None: + _path_params['project_id'] = project_id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if page is not None: + + _query_params.append(('page', page)) + + if per_page is not None: + + _query_params.append(('per_page', per_page)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "InvitationList", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{project_id}/invitations', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/projects/{project_id}/invitations', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_project_memberships(self, project_id : Annotated[StrictStr, Field(..., description="Project UUID")], search : Annotated[Optional[StrictStr], Field(description="Search by member full name, id and email.")] = None, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> MembershipList: # noqa: E501 - """Retrieve project memberships # noqa: E501 - Returns all memberships in a project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_project_memberships( + self, + project_id: Annotated[StrictStr, Field(description="Project UUID")], + search: Annotated[Optional[StrictStr], Field(description="Search by member full name, id and email.")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> MembershipList: + """Retrieve project memberships - >>> thread = api.find_project_memberships(project_id, search, include, page, per_page, async_req=True) - >>> result = thread.get() + Returns all memberships in a project. :param project_id: Project UUID (required) :type project_id: str @@ -1324,32 +2452,167 @@ def find_project_memberships(self, project_id : Annotated[StrictStr, Field(..., :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_project_memberships_serialize( + project_id=project_id, + search=search, + include=include, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MembershipList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_project_memberships_with_http_info( + self, + project_id: Annotated[StrictStr, Field(description="Project UUID")], + search: Annotated[Optional[StrictStr], Field(description="Search by member full name, id and email.")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[MembershipList]: + """Retrieve project memberships + + Returns all memberships in a project. + + :param project_id: Project UUID (required) + :type project_id: str + :param search: Search by member full name, id and email. + :type search: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param page: Page to return + :type page: int + :param per_page: Items returned per page + :type per_page: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: MembershipList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_project_memberships_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_project_memberships_with_http_info(project_id, search, include, page, per_page, **kwargs) # noqa: E501 + """ # noqa: E501 + + _param = self._find_project_memberships_serialize( + project_id=project_id, + search=search, + include=include, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - @validate_arguments - def find_project_memberships_with_http_info(self, project_id : Annotated[StrictStr, Field(..., description="Project UUID")], search : Annotated[Optional[StrictStr], Field(description="Search by member full name, id and email.")] = None, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve project memberships # noqa: E501 + _response_types_map: Dict[str, Optional[str]] = { + '200': "MembershipList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - Returns all memberships in a project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.find_project_memberships_with_http_info(project_id, search, include, page, per_page, async_req=True) - >>> result = thread.get() + @validate_call + def find_project_memberships_without_preload_content( + self, + project_id: Annotated[StrictStr, Field(description="Project UUID")], + search: Annotated[Optional[StrictStr], Field(description="Search by member full name, id and email.")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve project memberships + + Returns all memberships in a project. :param project_id: Project UUID (required) :type project_id: str @@ -1361,125 +2624,135 @@ def find_project_memberships_with_http_info(self, project_id : Annotated[StrictS :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(MembershipList, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'project_id', - 'search', - 'include', - 'page', - 'per_page' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + """ # noqa: E501 + + _param = self._find_project_memberships_serialize( + project_id=project_id, + search=search, + include=include, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_project_memberships" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "MembershipList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _find_project_memberships_serialize( + self, + project_id, + search, + include, + page, + per_page, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } - _collection_formats = {} + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None # process the path parameters - _path_params = {} - if _params['project_id']: - _path_params['project_id'] = _params['project_id'] - - + if project_id is not None: + _path_params['project_id'] = project_id # process the query parameters - _query_params = [] - if _params.get('search') is not None: # noqa: E501 - _query_params.append(('search', _params['search'])) - - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' - - if _params.get('page') is not None: # noqa: E501 - _query_params.append(('page', _params['page'])) - - if _params.get('per_page') is not None: # noqa: E501 - _query_params.append(('per_page', _params['per_page'])) - + if search is not None: + + _query_params.append(('search', search)) + + if include is not None: + + _query_params.append(('include', include)) + + if page is not None: + + _query_params.append(('page', page)) + + if per_page is not None: + + _query_params.append(('per_page', per_page)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "MembershipList", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{project_id}/memberships', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/projects/{project_id}/memberships', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_projects_all_pages(self, name : Annotated[Optional[StrictStr], Field(description="Filter results by name.")] = None, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> ProjectList: # noqa: E501 + + @validate_call + def find_projects_all_pages(self, name : Annotated[Optional[StrictStr], Field(description="Filter results by name.")] = None, include : Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, per_page : Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, **kwargs) -> ProjectList: # noqa: E501 """Retrieve all projects # noqa: E501 This method is the same as find_projects, but fetches resources from all the pages. @@ -1530,19 +2803,33 @@ def find_projects_all_pages(self, name : Annotated[Optional[StrictStr], Field(de if page_response.meta.next is None: break page += 1 - - return all_pages - @validate_arguments - def find_projects(self, name : Annotated[Optional[StrictStr], Field(description="Filter results by name.")] = None, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> ProjectList: # noqa: E501 - """Retrieve all projects # noqa: E501 + return all_pages - Returns a collection of projects that the current user is a member of. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_projects( + self, + name: Annotated[Optional[StrictStr], Field(description="Filter results by name.")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ProjectList: + """Retrieve all projects - >>> thread = api.find_projects(name, include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + Returns a collection of projects that the current user is a member of. :param name: Filter results by name. :type name: str @@ -1554,32 +2841,79 @@ def find_projects(self, name : Annotated[Optional[StrictStr], Field(description= :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ProjectList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_projects_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_projects_with_http_info(name, include, exclude, page, per_page, **kwargs) # noqa: E501 - - @validate_arguments - def find_projects_with_http_info(self, name : Annotated[Optional[StrictStr], Field(description="Filter results by name.")] = None, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve all projects # noqa: E501 + """ # noqa: E501 + + _param = self._find_projects_serialize( + name=name, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Returns a collection of projects that the current user is a member of. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "ProjectList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_projects_with_http_info( + self, + name: Annotated[Optional[StrictStr], Field(description="Filter results by name.")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ProjectList]: + """Retrieve all projects - >>> thread = api.find_projects_with_http_info(name, include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + Returns a collection of projects that the current user is a member of. :param name: Filter results by name. :type name: str @@ -1591,132 +2925,241 @@ def find_projects_with_http_info(self, name : Annotated[Optional[StrictStr], Fie :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ProjectList, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'name', - 'include', - 'exclude', - 'page', - 'per_page' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + """ # noqa: E501 + + _param = self._find_projects_serialize( + name=name, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_projects" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} + _response_types_map: Dict[str, Optional[str]] = { + '200': "ProjectList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - # process the path parameters - _path_params = {} - # process the query parameters - _query_params = [] - if _params.get('name') is not None: # noqa: E501 - _query_params.append(('name', _params['name'])) + @validate_call + def find_projects_without_preload_content( + self, + name: Annotated[Optional[StrictStr], Field(description="Filter results by name.")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all projects - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + Returns a collection of projects that the current user is a member of. - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + :param name: Filter results by name. + :type name: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param page: Page to return + :type page: int + :param per_page: Items returned per page + :type per_page: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_projects_serialize( + name=name, + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - if _params.get('page') is not None: # noqa: E501 - _query_params.append(('page', _params['page'])) + _response_types_map: Dict[str, Optional[str]] = { + '200': "ProjectList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _find_projects_serialize( + self, + name, + include, + exclude, + page, + per_page, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('per_page') is not None: # noqa: E501 - _query_params.append(('per_page', _params['per_page'])) + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + # process the query parameters + if name is not None: + + _query_params.append(('name', name)) + + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + + if page is not None: + + _query_params.append(('page', page)) + + if per_page is not None: + + _query_params.append(('per_page', per_page)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "ProjectList", - '401': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/projects', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def update_project(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], project_update_input : Annotated[ProjectUpdateInput, Field(..., description="Project to update")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> Project: # noqa: E501 - """Update the project # noqa: E501 - Updates the project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def update_project( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + project_update_input: Annotated[ProjectUpdateInput, Field(description="Project to update")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Project: + """Update the project - >>> thread = api.update_project(id, project_update_input, include, exclude, async_req=True) - >>> result = thread.get() + Updates the project. :param id: Project UUID (required) :type id: str @@ -1726,32 +3169,80 @@ def update_project(self, id : Annotated[StrictStr, Field(..., description="Proje :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Project - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the update_project_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.update_project_with_http_info(id, project_update_input, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def update_project_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], project_update_input : Annotated[ProjectUpdateInput, Field(..., description="Project to update")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Update the project # noqa: E501 + """ # noqa: E501 + + _param = self._update_project_serialize( + id=id, + project_update_input=project_update_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Updates the project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "Project", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_project_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + project_update_input: Annotated[ProjectUpdateInput, Field(description="Project to update")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Project]: + """Update the project - >>> thread = api.update_project_with_http_info(id, project_update_input, include, exclude, async_req=True) - >>> result = thread.get() + Updates the project. :param id: Project UUID (required) :type id: str @@ -1761,124 +3252,220 @@ def update_project_with_http_info(self, id : Annotated[StrictStr, Field(..., des :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Project, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() + """ # noqa: E501 + + _param = self._update_project_serialize( + id=id, + project_update_input=project_update_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _all_params = [ - 'id', - 'project_update_input', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + _response_types_map: Dict[str, Optional[str]] = { + '200': "Project", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method update_project" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + @validate_call + def update_project_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + project_update_input: Annotated[ProjectUpdateInput, Field(description="Project to update")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update the project - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + Updates the project. + :param id: Project UUID (required) + :type id: str + :param project_update_input: Project to update (required) + :type project_update_input: ProjectUpdateInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_project_serialize( + id=id, + project_update_input=project_update_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _response_types_map: Dict[str, Optional[str]] = { + '200': "Project", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_project_serialize( + self, + id, + project_update_input, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['project_update_input'] is not None: - _body_params = _params['project_update_input'] + if project_update_input is not None: + _body_params = project_update_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '200': "Project", - '401': "Error", - '403': "Error", - '404': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{id}', 'PUT', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='PUT', + resource_path='/projects/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/self_service_reservations_api.py b/equinix_metal/equinix_metal/api/self_service_reservations_api.py index 484c8be7..79d279e5 100644 --- a/equinix_metal/equinix_metal/api/self_service_reservations_api.py +++ b/equinix_metal/equinix_metal/api/self_service_reservations_api.py @@ -12,357 +12,624 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictStr, conint, conlist, validator - -from typing import Optional - +from pydantic import Field, StrictStr, field_validator +from typing import List, Optional +from typing_extensions import Annotated from equinix_metal.models.create_self_service_reservation_request import CreateSelfServiceReservationRequest from equinix_metal.models.self_service_reservation_list import SelfServiceReservationList from equinix_metal.models.self_service_reservation_response import SelfServiceReservationResponse -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class SelfServiceReservationsApi(object): +class SelfServiceReservationsApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def create_self_service_reservation( + self, + project_id: Annotated[StrictStr, Field(description="Project UUID")], + create_self_service_reservation_request: Annotated[CreateSelfServiceReservationRequest, Field(description="reservation to create")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SelfServiceReservationResponse: + """Create a reservation - @validate_arguments - def create_self_service_reservation(self, project_id : Annotated[StrictStr, Field(..., description="Project UUID")], create_self_service_reservation_request : Annotated[CreateSelfServiceReservationRequest, Field(..., description="reservation to create")], **kwargs) -> SelfServiceReservationResponse: # noqa: E501 - """Create a reservation # noqa: E501 - - Creates a reservation. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_self_service_reservation(project_id, create_self_service_reservation_request, async_req=True) - >>> result = thread.get() + Creates a reservation. :param project_id: Project UUID (required) :type project_id: str :param create_self_service_reservation_request: reservation to create (required) :type create_self_service_reservation_request: CreateSelfServiceReservationRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: SelfServiceReservationResponse - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the create_self_service_reservation_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.create_self_service_reservation_with_http_info(project_id, create_self_service_reservation_request, **kwargs) # noqa: E501 - - @validate_arguments - def create_self_service_reservation_with_http_info(self, project_id : Annotated[StrictStr, Field(..., description="Project UUID")], create_self_service_reservation_request : Annotated[CreateSelfServiceReservationRequest, Field(..., description="reservation to create")], **kwargs) -> ApiResponse: # noqa: E501 - """Create a reservation # noqa: E501 - - Creates a reservation. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_self_service_reservation_with_http_info(project_id, create_self_service_reservation_request, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._create_self_service_reservation_serialize( + project_id=project_id, + create_self_service_reservation_request=create_self_service_reservation_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "SelfServiceReservationResponse", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_self_service_reservation_with_http_info( + self, + project_id: Annotated[StrictStr, Field(description="Project UUID")], + create_self_service_reservation_request: Annotated[CreateSelfServiceReservationRequest, Field(description="reservation to create")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SelfServiceReservationResponse]: + """Create a reservation + + Creates a reservation. :param project_id: Project UUID (required) :type project_id: str :param create_self_service_reservation_request: reservation to create (required) :type create_self_service_reservation_request: CreateSelfServiceReservationRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(SelfServiceReservationResponse, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._create_self_service_reservation_serialize( + project_id=project_id, + create_self_service_reservation_request=create_self_service_reservation_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '201': "SelfServiceReservationResponse", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'project_id', - 'create_self_service_reservation_request' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def create_self_service_reservation_without_preload_content( + self, + project_id: Annotated[StrictStr, Field(description="Project UUID")], + create_self_service_reservation_request: Annotated[CreateSelfServiceReservationRequest, Field(description="reservation to create")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a reservation + + Creates a reservation. + + :param project_id: Project UUID (required) + :type project_id: str + :param create_self_service_reservation_request: reservation to create (required) + :type create_self_service_reservation_request: CreateSelfServiceReservationRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_self_service_reservation_serialize( + project_id=project_id, + create_self_service_reservation_request=create_self_service_reservation_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_self_service_reservation" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '201': "SelfServiceReservationResponse", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['project_id']: - _path_params['project_id'] = _params['project_id'] + def _create_self_service_reservation_serialize( + self, + project_id, + create_self_service_reservation_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if project_id is not None: + _path_params['project_id'] = project_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['create_self_service_reservation_request'] is not None: - _body_params = _params['create_self_service_reservation_request'] + if create_self_service_reservation_request is not None: + _body_params = create_self_service_reservation_request + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '201': "SelfServiceReservationResponse", - '401': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{project_id}/self-service/reservations', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/projects/{project_id}/self-service/reservations', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_self_service_reservation(self, id : Annotated[StrictStr, Field(..., description="Reservation short_id")], project_id : Annotated[StrictStr, Field(..., description="Project UUID")], **kwargs) -> SelfServiceReservationResponse: # noqa: E501 - """Retrieve a reservation # noqa: E501 - Returns a reservation # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_self_service_reservation( + self, + id: Annotated[StrictStr, Field(description="Reservation short_id")], + project_id: Annotated[StrictStr, Field(description="Project UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SelfServiceReservationResponse: + """Retrieve a reservation - >>> thread = api.find_self_service_reservation(id, project_id, async_req=True) - >>> result = thread.get() + Returns a reservation :param id: Reservation short_id (required) :type id: str :param project_id: Project UUID (required) :type project_id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: SelfServiceReservationResponse - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_self_service_reservation_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_self_service_reservation_with_http_info(id, project_id, **kwargs) # noqa: E501 - - @validate_arguments - def find_self_service_reservation_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Reservation short_id")], project_id : Annotated[StrictStr, Field(..., description="Project UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve a reservation # noqa: E501 - - Returns a reservation # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_self_service_reservation_with_http_info(id, project_id, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_self_service_reservation_serialize( + id=id, + project_id=project_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SelfServiceReservationResponse", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_self_service_reservation_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Reservation short_id")], + project_id: Annotated[StrictStr, Field(description="Project UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SelfServiceReservationResponse]: + """Retrieve a reservation + + Returns a reservation :param id: Reservation short_id (required) :type id: str :param project_id: Project UUID (required) :type project_id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(SelfServiceReservationResponse, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_self_service_reservation_serialize( + id=id, + project_id=project_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SelfServiceReservationResponse", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id', - 'project_id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def find_self_service_reservation_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Reservation short_id")], + project_id: Annotated[StrictStr, Field(description="Project UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve a reservation + + Returns a reservation + + :param id: Reservation short_id (required) + :type id: str + :param project_id: Project UUID (required) + :type project_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_self_service_reservation_serialize( + id=id, + project_id=project_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_self_service_reservation" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "SelfServiceReservationResponse", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_self_service_reservation_serialize( + self, + id, + project_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None - if _params['project_id']: - _path_params['project_id'] = _params['project_id'] + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + if project_id is not None: + _path_params['project_id'] = project_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "SelfServiceReservationResponse", - '401': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{project_id}/self-service/reservations/{id}', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/projects/{project_id}/self-service/reservations/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_self_service_reservations(self, project_id : Annotated[StrictStr, Field(..., description="Project UUID")], page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, categories : Annotated[Optional[conlist(StrictStr)], Field(description="Filter reservations by items category")] = None, **kwargs) -> SelfServiceReservationList: # noqa: E501 - """Retrieve all reservations # noqa: E501 - Returns all reservations. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_self_service_reservations( + self, + project_id: Annotated[StrictStr, Field(description="Project UUID")], + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + categories: Annotated[Optional[List[StrictStr]], Field(description="Filter reservations by items category")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SelfServiceReservationList: + """Retrieve all reservations - >>> thread = api.find_self_service_reservations(project_id, page, per_page, categories, async_req=True) - >>> result = thread.get() + Returns all reservations. :param project_id: Project UUID (required) :type project_id: str @@ -372,32 +639,77 @@ def find_self_service_reservations(self, project_id : Annotated[StrictStr, Field :type per_page: int :param categories: Filter reservations by items category :type categories: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: SelfServiceReservationList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_self_service_reservations_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_self_service_reservations_with_http_info(project_id, page, per_page, categories, **kwargs) # noqa: E501 - - @validate_arguments - def find_self_service_reservations_with_http_info(self, project_id : Annotated[StrictStr, Field(..., description="Project UUID")], page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, categories : Annotated[Optional[conlist(StrictStr)], Field(description="Filter reservations by items category")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve all reservations # noqa: E501 - - Returns all reservations. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_self_service_reservations_with_http_info(project_id, page, per_page, categories, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_self_service_reservations_serialize( + project_id=project_id, + page=page, + per_page=per_page, + categories=categories, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SelfServiceReservationList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_self_service_reservations_with_http_info( + self, + project_id: Annotated[StrictStr, Field(description="Project UUID")], + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + categories: Annotated[Optional[List[StrictStr]], Field(description="Filter reservations by items category")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SelfServiceReservationList]: + """Retrieve all reservations + + Returns all reservations. :param project_id: Project UUID (required) :type project_id: str @@ -407,113 +719,202 @@ def find_self_service_reservations_with_http_info(self, project_id : Annotated[S :type per_page: int :param categories: Filter reservations by items category :type categories: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(SelfServiceReservationList, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'project_id', - 'page', - 'per_page', - 'categories' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + """ # noqa: E501 + + _param = self._find_self_service_reservations_serialize( + project_id=project_id, + page=page, + per_page=per_page, + categories=categories, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_self_service_reservations" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "SelfServiceReservationList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['project_id']: - _path_params['project_id'] = _params['project_id'] + @validate_call + def find_self_service_reservations_without_preload_content( + self, + project_id: Annotated[StrictStr, Field(description="Project UUID")], + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + categories: Annotated[Optional[List[StrictStr]], Field(description="Filter reservations by items category")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all reservations + Returns all reservations. - # process the query parameters - _query_params = [] - if _params.get('page') is not None: # noqa: E501 - _query_params.append(('page', _params['page'])) + :param project_id: Project UUID (required) + :type project_id: str + :param page: Page to return + :type page: int + :param per_page: Items returned per page + :type per_page: int + :param categories: Filter reservations by items category + :type categories: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_self_service_reservations_serialize( + project_id=project_id, + page=page, + per_page=per_page, + categories=categories, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - if _params.get('per_page') is not None: # noqa: E501 - _query_params.append(('per_page', _params['per_page'])) + _response_types_map: Dict[str, Optional[str]] = { + '200': "SelfServiceReservationList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _find_self_service_reservations_serialize( + self, + project_id, + page, + per_page, + categories, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'categories': 'multi', + } - if _params.get('categories') is not None: # noqa: E501 - _query_params.append(('categories', _params['categories'])) - _collection_formats['categories'] = 'multi' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if project_id is not None: + _path_params['project_id'] = project_id + # process the query parameters + if page is not None: + + _query_params.append(('page', page)) + + if per_page is not None: + + _query_params.append(('per_page', per_page)) + + if categories is not None: + + _query_params.append(('categories', categories)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "SelfServiceReservationList", - '401': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{project_id}/self-service/reservations', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/projects/{project_id}/self-service/reservations', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/spot_market_api.py b/equinix_metal/equinix_metal/api/spot_market_api.py index 4223aacf..dbe5c67d 100644 --- a/equinix_metal/equinix_metal/api/spot_market_api.py +++ b/equinix_metal/equinix_metal/api/spot_market_api.py @@ -12,18 +12,14 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictBool, StrictStr, conlist - -from typing import Optional - +from pydantic import Field, StrictBool, StrictStr +from typing import List, Optional +from typing_extensions import Annotated from equinix_metal.models.spot_market_prices_list import SpotMarketPricesList from equinix_metal.models.spot_market_prices_per_metro_list import SpotMarketPricesPerMetroList from equinix_metal.models.spot_market_request import SpotMarketRequest @@ -31,636 +27,1183 @@ from equinix_metal.models.spot_market_request_list import SpotMarketRequestList from equinix_metal.models.spot_prices_history_report import SpotPricesHistoryReport -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class SpotMarketApi(object): +class SpotMarketApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def create_spot_market_request( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + spot_market_request_create_input: Annotated[SpotMarketRequestCreateInput, Field(description="Spot Market Request to create")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SpotMarketRequest: + """Create a spot market request - @validate_arguments - def create_spot_market_request(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], spot_market_request_create_input : Annotated[SpotMarketRequestCreateInput, Field(..., description="Spot Market Request to create")], **kwargs) -> SpotMarketRequest: # noqa: E501 - """Create a spot market request # noqa: E501 - - Creates a new spot market request. Type-specific options (such as operating_system for baremetal devices) should be included in the main data structure alongside hostname and plan. The features attribute allows you to optionally specify what features your server should have. For example, if you require a server with a TPM chip, you may specify `{ \"features\": { \"tpm\": \"required\" } }` (or `{ \"features\": [\"tpm\"] }` in shorthand). The request will fail if there are no available servers matching your criteria. Alternatively, if you do not require a certain feature, but would prefer to be assigned a server with that feature if there are any available, you may specify that feature with a preferred value (see the example request below). The request will not fail if we have no servers with that feature in our inventory. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_spot_market_request(id, spot_market_request_create_input, async_req=True) - >>> result = thread.get() + Creates a new spot market request. Type-specific options (such as operating_system for baremetal devices) should be included in the main data structure alongside hostname and plan. The features attribute allows you to optionally specify what features your server should have. For example, if you require a server with a TPM chip, you may specify `{ \"features\": { \"tpm\": \"required\" } }` (or `{ \"features\": [\"tpm\"] }` in shorthand). The request will fail if there are no available servers matching your criteria. Alternatively, if you do not require a certain feature, but would prefer to be assigned a server with that feature if there are any available, you may specify that feature with a preferred value (see the example request below). The request will not fail if we have no servers with that feature in our inventory. :param id: Project UUID (required) :type id: str :param spot_market_request_create_input: Spot Market Request to create (required) :type spot_market_request_create_input: SpotMarketRequestCreateInput - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: SpotMarketRequest - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the create_spot_market_request_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.create_spot_market_request_with_http_info(id, spot_market_request_create_input, **kwargs) # noqa: E501 - - @validate_arguments - def create_spot_market_request_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], spot_market_request_create_input : Annotated[SpotMarketRequestCreateInput, Field(..., description="Spot Market Request to create")], **kwargs) -> ApiResponse: # noqa: E501 - """Create a spot market request # noqa: E501 - - Creates a new spot market request. Type-specific options (such as operating_system for baremetal devices) should be included in the main data structure alongside hostname and plan. The features attribute allows you to optionally specify what features your server should have. For example, if you require a server with a TPM chip, you may specify `{ \"features\": { \"tpm\": \"required\" } }` (or `{ \"features\": [\"tpm\"] }` in shorthand). The request will fail if there are no available servers matching your criteria. Alternatively, if you do not require a certain feature, but would prefer to be assigned a server with that feature if there are any available, you may specify that feature with a preferred value (see the example request below). The request will not fail if we have no servers with that feature in our inventory. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_spot_market_request_with_http_info(id, spot_market_request_create_input, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._create_spot_market_request_serialize( + id=id, + spot_market_request_create_input=spot_market_request_create_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "SpotMarketRequest", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_spot_market_request_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + spot_market_request_create_input: Annotated[SpotMarketRequestCreateInput, Field(description="Spot Market Request to create")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SpotMarketRequest]: + """Create a spot market request + + Creates a new spot market request. Type-specific options (such as operating_system for baremetal devices) should be included in the main data structure alongside hostname and plan. The features attribute allows you to optionally specify what features your server should have. For example, if you require a server with a TPM chip, you may specify `{ \"features\": { \"tpm\": \"required\" } }` (or `{ \"features\": [\"tpm\"] }` in shorthand). The request will fail if there are no available servers matching your criteria. Alternatively, if you do not require a certain feature, but would prefer to be assigned a server with that feature if there are any available, you may specify that feature with a preferred value (see the example request below). The request will not fail if we have no servers with that feature in our inventory. :param id: Project UUID (required) :type id: str :param spot_market_request_create_input: Spot Market Request to create (required) :type spot_market_request_create_input: SpotMarketRequestCreateInput - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(SpotMarketRequest, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._create_spot_market_request_serialize( + id=id, + spot_market_request_create_input=spot_market_request_create_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '201': "SpotMarketRequest", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id', - 'spot_market_request_create_input' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def create_spot_market_request_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + spot_market_request_create_input: Annotated[SpotMarketRequestCreateInput, Field(description="Spot Market Request to create")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a spot market request + + Creates a new spot market request. Type-specific options (such as operating_system for baremetal devices) should be included in the main data structure alongside hostname and plan. The features attribute allows you to optionally specify what features your server should have. For example, if you require a server with a TPM chip, you may specify `{ \"features\": { \"tpm\": \"required\" } }` (or `{ \"features\": [\"tpm\"] }` in shorthand). The request will fail if there are no available servers matching your criteria. Alternatively, if you do not require a certain feature, but would prefer to be assigned a server with that feature if there are any available, you may specify that feature with a preferred value (see the example request below). The request will not fail if we have no servers with that feature in our inventory. + + :param id: Project UUID (required) + :type id: str + :param spot_market_request_create_input: Spot Market Request to create (required) + :type spot_market_request_create_input: SpotMarketRequestCreateInput + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_spot_market_request_serialize( + id=id, + spot_market_request_create_input=spot_market_request_create_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_spot_market_request" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '201': "SpotMarketRequest", + '401': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _create_spot_market_request_serialize( + self, + id, + spot_market_request_create_input, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['spot_market_request_create_input'] is not None: - _body_params = _params['spot_market_request_create_input'] + if spot_market_request_create_input is not None: + _body_params = spot_market_request_create_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '201': "SpotMarketRequest", - '401': "Error", - '404': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{id}/spot-market-requests', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/projects/{id}/spot-market-requests', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def delete_spot_market_request(self, id : Annotated[StrictStr, Field(..., description="SpotMarketRequest UUID")], force_termination : Annotated[Optional[StrictBool], Field(description="Terminate associated spot instances")] = None, **kwargs) -> None: # noqa: E501 - """Delete the spot market request # noqa: E501 - Deletes the spot market request. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def delete_spot_market_request( + self, + id: Annotated[StrictStr, Field(description="SpotMarketRequest UUID")], + force_termination: Annotated[Optional[StrictBool], Field(description="Terminate associated spot instances")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete the spot market request - >>> thread = api.delete_spot_market_request(id, force_termination, async_req=True) - >>> result = thread.get() + Deletes the spot market request. :param id: SpotMarketRequest UUID (required) :type id: str :param force_termination: Terminate associated spot instances :type force_termination: bool - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the delete_spot_market_request_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.delete_spot_market_request_with_http_info(id, force_termination, **kwargs) # noqa: E501 - - @validate_arguments - def delete_spot_market_request_with_http_info(self, id : Annotated[StrictStr, Field(..., description="SpotMarketRequest UUID")], force_termination : Annotated[Optional[StrictBool], Field(description="Terminate associated spot instances")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Delete the spot market request # noqa: E501 - - Deletes the spot market request. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_spot_market_request_with_http_info(id, force_termination, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._delete_spot_market_request_serialize( + id=id, + force_termination=force_termination, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_spot_market_request_with_http_info( + self, + id: Annotated[StrictStr, Field(description="SpotMarketRequest UUID")], + force_termination: Annotated[Optional[StrictBool], Field(description="Terminate associated spot instances")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete the spot market request + + Deletes the spot market request. :param id: SpotMarketRequest UUID (required) :type id: str :param force_termination: Terminate associated spot instances :type force_termination: bool - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 + + _param = self._delete_spot_market_request_serialize( + id=id, + force_termination=force_termination, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id', - 'force_termination' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def delete_spot_market_request_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="SpotMarketRequest UUID")], + force_termination: Annotated[Optional[StrictBool], Field(description="Terminate associated spot instances")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete the spot market request + + Deletes the spot market request. + + :param id: SpotMarketRequest UUID (required) + :type id: str + :param force_termination: Terminate associated spot instances + :type force_termination: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_spot_market_request_serialize( + id=id, + force_termination=force_termination, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_spot_market_request" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _delete_spot_market_request_serialize( + self, + id, + force_termination, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('force_termination') is not None: # noqa: E501 - _query_params.append(('force_termination', _params['force_termination'])) + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if force_termination is not None: + + _query_params.append(('force_termination', force_termination)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/spot-market-requests/{id}', 'DELETE', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='DELETE', + resource_path='/spot-market-requests/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_metro_spot_market_prices(self, metro : Annotated[Optional[StrictStr], Field(description="Metro to filter spot market prices")] = None, plan : Annotated[Optional[StrictStr], Field(description="Plan to filter spot market prices")] = None, **kwargs) -> SpotMarketPricesPerMetroList: # noqa: E501 - """Get current spot market prices for metros # noqa: E501 - Get Equinix Metal current spot market prices for all metros. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_metro_spot_market_prices( + self, + metro: Annotated[Optional[StrictStr], Field(description="Metro to filter spot market prices")] = None, + plan: Annotated[Optional[StrictStr], Field(description="Plan to filter spot market prices")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SpotMarketPricesPerMetroList: + """Get current spot market prices for metros - >>> thread = api.find_metro_spot_market_prices(metro, plan, async_req=True) - >>> result = thread.get() + Get Equinix Metal current spot market prices for all metros. :param metro: Metro to filter spot market prices :type metro: str :param plan: Plan to filter spot market prices :type plan: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: SpotMarketPricesPerMetroList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_metro_spot_market_prices_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_metro_spot_market_prices_with_http_info(metro, plan, **kwargs) # noqa: E501 - - @validate_arguments - def find_metro_spot_market_prices_with_http_info(self, metro : Annotated[Optional[StrictStr], Field(description="Metro to filter spot market prices")] = None, plan : Annotated[Optional[StrictStr], Field(description="Plan to filter spot market prices")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Get current spot market prices for metros # noqa: E501 - - Get Equinix Metal current spot market prices for all metros. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_metro_spot_market_prices_with_http_info(metro, plan, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_metro_spot_market_prices_serialize( + metro=metro, + plan=plan, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SpotMarketPricesPerMetroList", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_metro_spot_market_prices_with_http_info( + self, + metro: Annotated[Optional[StrictStr], Field(description="Metro to filter spot market prices")] = None, + plan: Annotated[Optional[StrictStr], Field(description="Plan to filter spot market prices")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SpotMarketPricesPerMetroList]: + """Get current spot market prices for metros + + Get Equinix Metal current spot market prices for all metros. :param metro: Metro to filter spot market prices :type metro: str :param plan: Plan to filter spot market prices :type plan: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(SpotMarketPricesPerMetroList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_metro_spot_market_prices_serialize( + metro=metro, + plan=plan, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SpotMarketPricesPerMetroList", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'metro', - 'plan' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def find_metro_spot_market_prices_without_preload_content( + self, + metro: Annotated[Optional[StrictStr], Field(description="Metro to filter spot market prices")] = None, + plan: Annotated[Optional[StrictStr], Field(description="Plan to filter spot market prices")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get current spot market prices for metros + + Get Equinix Metal current spot market prices for all metros. + + :param metro: Metro to filter spot market prices + :type metro: str + :param plan: Plan to filter spot market prices + :type plan: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_metro_spot_market_prices_serialize( + metro=metro, + plan=plan, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_metro_spot_market_prices" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "SpotMarketPricesPerMetroList", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} + def _find_metro_spot_market_prices_serialize( + self, + metro, + plan, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the query parameters - _query_params = [] - if _params.get('metro') is not None: # noqa: E501 - _query_params.append(('metro', _params['metro'])) + _host = None + + _collection_formats: Dict[str, str] = { + } - if _params.get('plan') is not None: # noqa: E501 - _query_params.append(('plan', _params['plan'])) + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + # process the query parameters + if metro is not None: + + _query_params.append(('metro', metro)) + + if plan is not None: + + _query_params.append(('plan', plan)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "SpotMarketPricesPerMetroList", - '401': "Error", - '422': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/market/spot/prices/metros', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/market/spot/prices/metros', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_spot_market_prices(self, facility : Annotated[Optional[StrictStr], Field(description="Facility to check spot market prices")] = None, plan : Annotated[Optional[StrictStr], Field(description="Plan to check spot market prices")] = None, **kwargs) -> SpotMarketPricesList: # noqa: E501 - """Get current spot market prices # noqa: E501 - Get Equinix Metal current spot market prices. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_spot_market_prices( + self, + facility: Annotated[Optional[StrictStr], Field(description="Facility to check spot market prices")] = None, + plan: Annotated[Optional[StrictStr], Field(description="Plan to check spot market prices")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SpotMarketPricesList: + """Get current spot market prices - >>> thread = api.find_spot_market_prices(facility, plan, async_req=True) - >>> result = thread.get() + Get Equinix Metal current spot market prices. :param facility: Facility to check spot market prices :type facility: str :param plan: Plan to check spot market prices :type plan: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: SpotMarketPricesList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_spot_market_prices_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_spot_market_prices_with_http_info(facility, plan, **kwargs) # noqa: E501 - - @validate_arguments - def find_spot_market_prices_with_http_info(self, facility : Annotated[Optional[StrictStr], Field(description="Facility to check spot market prices")] = None, plan : Annotated[Optional[StrictStr], Field(description="Plan to check spot market prices")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Get current spot market prices # noqa: E501 - - Get Equinix Metal current spot market prices. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_spot_market_prices_with_http_info(facility, plan, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_spot_market_prices_serialize( + facility=facility, + plan=plan, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SpotMarketPricesList", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_spot_market_prices_with_http_info( + self, + facility: Annotated[Optional[StrictStr], Field(description="Facility to check spot market prices")] = None, + plan: Annotated[Optional[StrictStr], Field(description="Plan to check spot market prices")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SpotMarketPricesList]: + """Get current spot market prices + + Get Equinix Metal current spot market prices. :param facility: Facility to check spot market prices :type facility: str :param plan: Plan to check spot market prices :type plan: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(SpotMarketPricesList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_spot_market_prices_serialize( + facility=facility, + plan=plan, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SpotMarketPricesList", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'facility', - 'plan' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def find_spot_market_prices_without_preload_content( + self, + facility: Annotated[Optional[StrictStr], Field(description="Facility to check spot market prices")] = None, + plan: Annotated[Optional[StrictStr], Field(description="Plan to check spot market prices")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get current spot market prices + + Get Equinix Metal current spot market prices. + + :param facility: Facility to check spot market prices + :type facility: str + :param plan: Plan to check spot market prices + :type plan: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_spot_market_prices_serialize( + facility=facility, + plan=plan, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_spot_market_prices" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "SpotMarketPricesList", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} + def _find_spot_market_prices_serialize( + self, + facility, + plan, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the query parameters - _query_params = [] - if _params.get('facility') is not None: # noqa: E501 - _query_params.append(('facility', _params['facility'])) + _host = None - if _params.get('plan') is not None: # noqa: E501 - _query_params.append(('plan', _params['plan'])) + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if facility is not None: + + _query_params.append(('facility', facility)) + + if plan is not None: + + _query_params.append(('plan', plan)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "SpotMarketPricesList", - '401': "Error", - '422': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/market/spot/prices', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/market/spot/prices', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_spot_market_prices_history(self, facility : Annotated[StrictStr, Field(..., description="Facility to check spot market prices")], plan : Annotated[StrictStr, Field(..., description="Plan to check spot market prices")], var_from : Annotated[StrictStr, Field(..., description="Timestamp from range")], until : Annotated[StrictStr, Field(..., description="Timestamp to range")], metro : Annotated[Optional[StrictStr], Field(description="Metro to check spot market price history")] = None, **kwargs) -> SpotPricesHistoryReport: # noqa: E501 - """Get spot market prices for a given period of time # noqa: E501 - Get spot market prices for a given plan and facility in a fixed period of time *Note: In the `200` response, the property `datapoints` contains arrays of `[float, integer]`.* # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_spot_market_prices_history( + self, + facility: Annotated[StrictStr, Field(description="Facility to check spot market prices")], + plan: Annotated[StrictStr, Field(description="Plan to check spot market prices")], + var_from: Annotated[StrictStr, Field(description="Timestamp from range")], + until: Annotated[StrictStr, Field(description="Timestamp to range")], + metro: Annotated[Optional[StrictStr], Field(description="Metro to check spot market price history")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SpotPricesHistoryReport: + """Get spot market prices for a given period of time - >>> thread = api.find_spot_market_prices_history(facility, plan, var_from, until, metro, async_req=True) - >>> result = thread.get() + Get spot market prices for a given plan and facility in a fixed period of time *Note: In the `200` response, the property `datapoints` contains arrays of `[float, integer]`.* :param facility: Facility to check spot market prices (required) :type facility: str @@ -672,32 +1215,80 @@ def find_spot_market_prices_history(self, facility : Annotated[StrictStr, Field( :type until: str :param metro: Metro to check spot market price history :type metro: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: SpotPricesHistoryReport - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_spot_market_prices_history_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_spot_market_prices_history_with_http_info(facility, plan, var_from, until, metro, **kwargs) # noqa: E501 - - @validate_arguments - def find_spot_market_prices_history_with_http_info(self, facility : Annotated[StrictStr, Field(..., description="Facility to check spot market prices")], plan : Annotated[StrictStr, Field(..., description="Plan to check spot market prices")], var_from : Annotated[StrictStr, Field(..., description="Timestamp from range")], until : Annotated[StrictStr, Field(..., description="Timestamp to range")], metro : Annotated[Optional[StrictStr], Field(description="Metro to check spot market price history")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Get spot market prices for a given period of time # noqa: E501 - - Get spot market prices for a given plan and facility in a fixed period of time *Note: In the `200` response, the property `datapoints` contains arrays of `[float, integer]`.* # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_spot_market_prices_history_with_http_info(facility, plan, var_from, until, metro, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_spot_market_prices_history_serialize( + facility=facility, + plan=plan, + var_from=var_from, + until=until, + metro=metro, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SpotPricesHistoryReport", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_spot_market_prices_history_with_http_info( + self, + facility: Annotated[StrictStr, Field(description="Facility to check spot market prices")], + plan: Annotated[StrictStr, Field(description="Plan to check spot market prices")], + var_from: Annotated[StrictStr, Field(description="Timestamp from range")], + until: Annotated[StrictStr, Field(description="Timestamp to range")], + metro: Annotated[Optional[StrictStr], Field(description="Metro to check spot market price history")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SpotPricesHistoryReport]: + """Get spot market prices for a given period of time + + Get spot market prices for a given plan and facility in a fixed period of time *Note: In the `200` response, the property `datapoints` contains arrays of `[float, integer]`.* :param facility: Facility to check spot market prices (required) :type facility: str @@ -709,409 +1300,760 @@ def find_spot_market_prices_history_with_http_info(self, facility : Annotated[St :type until: str :param metro: Metro to check spot market price history :type metro: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(SpotPricesHistoryReport, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'facility', - 'plan', - 'var_from', - 'until', - 'metro' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + """ # noqa: E501 + + _param = self._find_spot_market_prices_history_serialize( + facility=facility, + plan=plan, + var_from=var_from, + until=until, + metro=metro, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_spot_market_prices_history" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "SpotPricesHistoryReport", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} - # process the path parameters - _path_params = {} + @validate_call + def find_spot_market_prices_history_without_preload_content( + self, + facility: Annotated[StrictStr, Field(description="Facility to check spot market prices")], + plan: Annotated[StrictStr, Field(description="Plan to check spot market prices")], + var_from: Annotated[StrictStr, Field(description="Timestamp from range")], + until: Annotated[StrictStr, Field(description="Timestamp to range")], + metro: Annotated[Optional[StrictStr], Field(description="Metro to check spot market price history")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get spot market prices for a given period of time - # process the query parameters - _query_params = [] - if _params.get('facility') is not None: # noqa: E501 - _query_params.append(('facility', _params['facility'])) + Get spot market prices for a given plan and facility in a fixed period of time *Note: In the `200` response, the property `datapoints` contains arrays of `[float, integer]`.* + + :param facility: Facility to check spot market prices (required) + :type facility: str + :param plan: Plan to check spot market prices (required) + :type plan: str + :param var_from: Timestamp from range (required) + :type var_from: str + :param until: Timestamp to range (required) + :type until: str + :param metro: Metro to check spot market price history + :type metro: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_spot_market_prices_history_serialize( + facility=facility, + plan=plan, + var_from=var_from, + until=until, + metro=metro, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SpotPricesHistoryReport", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - if _params.get('plan') is not None: # noqa: E501 - _query_params.append(('plan', _params['plan'])) - if _params.get('metro') is not None: # noqa: E501 - _query_params.append(('metro', _params['metro'])) + def _find_spot_market_prices_history_serialize( + self, + facility, + plan, + var_from, + until, + metro, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - if _params.get('var_from') is not None: # noqa: E501 - _query_params.append(('from', _params['var_from'])) + _host = None + + _collection_formats: Dict[str, str] = { + } - if _params.get('until') is not None: # noqa: E501 - _query_params.append(('until', _params['until'])) + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + # process the query parameters + if facility is not None: + + _query_params.append(('facility', facility)) + + if plan is not None: + + _query_params.append(('plan', plan)) + + if metro is not None: + + _query_params.append(('metro', metro)) + + if var_from is not None: + + _query_params.append(('from', var_from)) + + if until is not None: + + _query_params.append(('until', until)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "SpotPricesHistoryReport", - '401': "Error", - '422': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/market/spot/prices/history', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/market/spot/prices/history', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_spot_market_request_by_id(self, id : Annotated[StrictStr, Field(..., description="SpotMarketRequest UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> SpotMarketRequest: # noqa: E501 - """Retrieve a spot market request # noqa: E501 - Returns a single spot market request # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_spot_market_request_by_id( + self, + id: Annotated[StrictStr, Field(description="SpotMarketRequest UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SpotMarketRequest: + """Retrieve a spot market request - >>> thread = api.find_spot_market_request_by_id(id, include, async_req=True) - >>> result = thread.get() + Returns a single spot market request :param id: SpotMarketRequest UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: SpotMarketRequest - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_spot_market_request_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_spot_market_request_by_id_with_http_info(id, include, **kwargs) # noqa: E501 - - @validate_arguments - def find_spot_market_request_by_id_with_http_info(self, id : Annotated[StrictStr, Field(..., description="SpotMarketRequest UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve a spot market request # noqa: E501 - - Returns a single spot market request # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_spot_market_request_by_id_with_http_info(id, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_spot_market_request_by_id_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SpotMarketRequest", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_spot_market_request_by_id_with_http_info( + self, + id: Annotated[StrictStr, Field(description="SpotMarketRequest UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SpotMarketRequest]: + """Retrieve a spot market request + + Returns a single spot market request :param id: SpotMarketRequest UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(SpotMarketRequest, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_spot_market_request_by_id_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "SpotMarketRequest", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def find_spot_market_request_by_id_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="SpotMarketRequest UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve a spot market request + + Returns a single spot market request + + :param id: SpotMarketRequest UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_spot_market_request_by_id_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_spot_market_request_by_id" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "SpotMarketRequest", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_spot_market_request_by_id_serialize( + self, + id, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "SpotMarketRequest", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/spot-market-requests/{id}', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/spot-market-requests/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def list_spot_market_requests(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], **kwargs) -> SpotMarketRequestList: # noqa: E501 - """List spot market requests # noqa: E501 - View all spot market requests for a given project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def list_spot_market_requests( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SpotMarketRequestList: + """List spot market requests - >>> thread = api.list_spot_market_requests(id, async_req=True) - >>> result = thread.get() + View all spot market requests for a given project. :param id: Project UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: SpotMarketRequestList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the list_spot_market_requests_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.list_spot_market_requests_with_http_info(id, **kwargs) # noqa: E501 - - @validate_arguments - def list_spot_market_requests_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """List spot market requests # noqa: E501 - - View all spot market requests for a given project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.list_spot_market_requests_with_http_info(id, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._list_spot_market_requests_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SpotMarketRequestList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_spot_market_requests_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SpotMarketRequestList]: + """List spot market requests + + View all spot market requests for a given project. :param id: Project UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(SpotMarketRequestList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._list_spot_market_requests_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "SpotMarketRequestList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def list_spot_market_requests_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List spot market requests + + View all spot market requests for a given project. + + :param id: Project UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_spot_market_requests_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_spot_market_requests" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "SpotMarketRequestList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _list_spot_market_requests_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "SpotMarketRequestList", - '401': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{id}/spot-market-requests', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/projects/{id}/spot-market-requests', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/ssh_keys_api.py b/equinix_metal/equinix_metal/api/ssh_keys_api.py index 84e3de47..ae18e28b 100644 --- a/equinix_metal/equinix_metal/api/ssh_keys_api.py +++ b/equinix_metal/equinix_metal/api/ssh_keys_api.py @@ -12,53 +12,57 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictStr, conlist - -from typing import Optional - +from pydantic import Field, StrictStr +from typing import List, Optional +from typing_extensions import Annotated from equinix_metal.models.ssh_key import SSHKey from equinix_metal.models.ssh_key_create_input import SSHKeyCreateInput from equinix_metal.models.ssh_key_input import SSHKeyInput from equinix_metal.models.ssh_key_list import SSHKeyList -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class SSHKeysApi(object): +class SSHKeysApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def create_project_ssh_key( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + ssh_key_create_input: Annotated[SSHKeyCreateInput, Field(description="ssh key to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SSHKey: + """Create a ssh key for the given project - @validate_arguments - def create_project_ssh_key(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], ssh_key_create_input : Annotated[SSHKeyCreateInput, Field(..., description="ssh key to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> SSHKey: # noqa: E501 - """Create a ssh key for the given project # noqa: E501 - - Creates a ssh key. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_project_ssh_key(id, ssh_key_create_input, include, async_req=True) - >>> result = thread.get() + Creates a ssh key. :param id: Project UUID (required) :type id: str @@ -66,32 +70,76 @@ def create_project_ssh_key(self, id : Annotated[StrictStr, Field(..., descriptio :type ssh_key_create_input: SSHKeyCreateInput :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: SSHKey - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the create_project_ssh_key_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.create_project_ssh_key_with_http_info(id, ssh_key_create_input, include, **kwargs) # noqa: E501 - - @validate_arguments - def create_project_ssh_key_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], ssh_key_create_input : Annotated[SSHKeyCreateInput, Field(..., description="ssh key to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Create a ssh key for the given project # noqa: E501 - - Creates a ssh key. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_project_ssh_key_with_http_info(id, ssh_key_create_input, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._create_project_ssh_key_serialize( + id=id, + ssh_key_create_input=ssh_key_create_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "SSHKey", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_project_ssh_key_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + ssh_key_create_input: Annotated[SSHKeyCreateInput, Field(description="ssh key to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SSHKey]: + """Create a ssh key for the given project + + Creates a ssh key. :param id: Project UUID (required) :type id: str @@ -99,425 +147,788 @@ def create_project_ssh_key_with_http_info(self, id : Annotated[StrictStr, Field( :type ssh_key_create_input: SSHKeyCreateInput :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(SSHKey, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._create_project_ssh_key_serialize( + id=id, + ssh_key_create_input=ssh_key_create_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "SSHKey", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id', - 'ssh_key_create_input', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def create_project_ssh_key_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + ssh_key_create_input: Annotated[SSHKeyCreateInput, Field(description="ssh key to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a ssh key for the given project + + Creates a ssh key. + + :param id: Project UUID (required) + :type id: str + :param ssh_key_create_input: ssh key to create (required) + :type ssh_key_create_input: SSHKeyCreateInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_project_ssh_key_serialize( + id=id, + ssh_key_create_input=ssh_key_create_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_project_ssh_key" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '201': "SSHKey", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _create_project_ssh_key_serialize( + self, + id, + ssh_key_create_input, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['ssh_key_create_input'] is not None: - _body_params = _params['ssh_key_create_input'] + if ssh_key_create_input is not None: + _body_params = ssh_key_create_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '201': "SSHKey", - '401': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{id}/ssh-keys', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/projects/{id}/ssh-keys', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def create_ssh_key(self, ssh_key_create_input : Annotated[SSHKeyCreateInput, Field(..., description="ssh key to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> SSHKey: # noqa: E501 - """Create a ssh key for the current user # noqa: E501 - Creates a ssh key. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def create_ssh_key( + self, + ssh_key_create_input: Annotated[SSHKeyCreateInput, Field(description="ssh key to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SSHKey: + """Create a ssh key for the current user - >>> thread = api.create_ssh_key(ssh_key_create_input, include, async_req=True) - >>> result = thread.get() + Creates a ssh key. :param ssh_key_create_input: ssh key to create (required) :type ssh_key_create_input: SSHKeyCreateInput :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: SSHKey - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the create_ssh_key_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.create_ssh_key_with_http_info(ssh_key_create_input, include, **kwargs) # noqa: E501 - - @validate_arguments - def create_ssh_key_with_http_info(self, ssh_key_create_input : Annotated[SSHKeyCreateInput, Field(..., description="ssh key to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Create a ssh key for the current user # noqa: E501 - - Creates a ssh key. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_ssh_key_with_http_info(ssh_key_create_input, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._create_ssh_key_serialize( + ssh_key_create_input=ssh_key_create_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "SSHKey", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_ssh_key_with_http_info( + self, + ssh_key_create_input: Annotated[SSHKeyCreateInput, Field(description="ssh key to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SSHKey]: + """Create a ssh key for the current user + + Creates a ssh key. :param ssh_key_create_input: ssh key to create (required) :type ssh_key_create_input: SSHKeyCreateInput :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(SSHKey, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._create_ssh_key_serialize( + ssh_key_create_input=ssh_key_create_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "SSHKey", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'ssh_key_create_input', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def create_ssh_key_without_preload_content( + self, + ssh_key_create_input: Annotated[SSHKeyCreateInput, Field(description="ssh key to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a ssh key for the current user + + Creates a ssh key. + + :param ssh_key_create_input: ssh key to create (required) + :type ssh_key_create_input: SSHKeyCreateInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_ssh_key_serialize( + ssh_key_create_input=ssh_key_create_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_ssh_key" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '201': "SSHKey", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} + def _create_ssh_key_serialize( + self, + ssh_key_create_input, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _host = None + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['ssh_key_create_input'] is not None: - _body_params = _params['ssh_key_create_input'] + if ssh_key_create_input is not None: + _body_params = ssh_key_create_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '201': "SSHKey", - '401': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/ssh-keys', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/ssh-keys', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def delete_ssh_key(self, id : Annotated[StrictStr, Field(..., description="ssh key UUID")], **kwargs) -> None: # noqa: E501 - """Delete the ssh key # noqa: E501 - Deletes the ssh key. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def delete_ssh_key( + self, + id: Annotated[StrictStr, Field(description="ssh key UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete the ssh key - >>> thread = api.delete_ssh_key(id, async_req=True) - >>> result = thread.get() + Deletes the ssh key. :param id: ssh key UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the delete_ssh_key_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.delete_ssh_key_with_http_info(id, **kwargs) # noqa: E501 - - @validate_arguments - def delete_ssh_key_with_http_info(self, id : Annotated[StrictStr, Field(..., description="ssh key UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """Delete the ssh key # noqa: E501 - - Deletes the ssh key. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_ssh_key_with_http_info(id, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._delete_ssh_key_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_ssh_key_with_http_info( + self, + id: Annotated[StrictStr, Field(description="ssh key UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete the ssh key + + Deletes the ssh key. :param id: ssh key UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 + + _param = self._delete_ssh_key_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def delete_ssh_key_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="ssh key UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete the ssh key + + Deletes the ssh key. + + :param id: ssh key UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_ssh_key_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_ssh_key" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _delete_ssh_key_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/ssh-keys/{id}', 'DELETE', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='DELETE', + resource_path='/ssh-keys/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_device_ssh_keys(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], search_string : Annotated[Optional[StrictStr], Field(description="Search by key, label, or fingerprint")] = None, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> SSHKeyList: # noqa: E501 - """Retrieve a device's ssh keys # noqa: E501 - Returns a collection of the device's ssh keys. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_device_ssh_keys( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + search_string: Annotated[Optional[StrictStr], Field(description="Search by key, label, or fingerprint")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SSHKeyList: + """Retrieve a device's ssh keys - >>> thread = api.find_device_ssh_keys(id, search_string, include, async_req=True) - >>> result = thread.get() + Returns a collection of the device's ssh keys. :param id: Project UUID (required) :type id: str @@ -525,32 +936,75 @@ def find_device_ssh_keys(self, id : Annotated[StrictStr, Field(..., description= :type search_string: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: SSHKeyList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_device_ssh_keys_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_device_ssh_keys_with_http_info(id, search_string, include, **kwargs) # noqa: E501 - - @validate_arguments - def find_device_ssh_keys_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], search_string : Annotated[Optional[StrictStr], Field(description="Search by key, label, or fingerprint")] = None, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve a device's ssh keys # noqa: E501 - - Returns a collection of the device's ssh keys. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_device_ssh_keys_with_http_info(id, search_string, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_device_ssh_keys_serialize( + id=id, + search_string=search_string, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SSHKeyList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_device_ssh_keys_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + search_string: Annotated[Optional[StrictStr], Field(description="Search by key, label, or fingerprint")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SSHKeyList]: + """Retrieve a device's ssh keys + + Returns a collection of the device's ssh keys. :param id: Project UUID (required) :type id: str @@ -558,123 +1012,217 @@ def find_device_ssh_keys_with_http_info(self, id : Annotated[StrictStr, Field(.. :type search_string: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(SSHKeyList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_device_ssh_keys_serialize( + id=id, + search_string=search_string, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SSHKeyList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id', - 'search_string', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def find_device_ssh_keys_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + search_string: Annotated[Optional[StrictStr], Field(description="Search by key, label, or fingerprint")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve a device's ssh keys + + Returns a collection of the device's ssh keys. + + :param id: Project UUID (required) + :type id: str + :param search_string: Search by key, label, or fingerprint + :type search_string: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_device_ssh_keys_serialize( + id=id, + search_string=search_string, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_device_ssh_keys" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "SSHKeyList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_device_ssh_keys_serialize( + self, + id, + search_string, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('search_string') is not None: # noqa: E501 - _query_params.append(('Search string', _params['search_string'])) + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if search_string is not None: + + _query_params.append(('Search string', search_string)) + + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "SSHKeyList", - '401': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/devices/{id}/ssh-keys', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/devices/{id}/ssh-keys', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_project_ssh_keys(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], query : Annotated[Optional[StrictStr], Field(description="Search by key, label, or fingerprint")] = None, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> SSHKeyList: # noqa: E501 - """Retrieve a project's ssh keys # noqa: E501 - Returns a collection of the project's ssh keys. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_project_ssh_keys( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + query: Annotated[Optional[StrictStr], Field(description="Search by key, label, or fingerprint")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SSHKeyList: + """Retrieve a project's ssh keys - >>> thread = api.find_project_ssh_keys(id, query, include, async_req=True) - >>> result = thread.get() + Returns a collection of the project's ssh keys. :param id: Project UUID (required) :type id: str @@ -682,32 +1230,75 @@ def find_project_ssh_keys(self, id : Annotated[StrictStr, Field(..., description :type query: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: SSHKeyList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_project_ssh_keys_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_project_ssh_keys_with_http_info(id, query, include, **kwargs) # noqa: E501 - - @validate_arguments - def find_project_ssh_keys_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], query : Annotated[Optional[StrictStr], Field(description="Search by key, label, or fingerprint")] = None, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve a project's ssh keys # noqa: E501 - - Returns a collection of the project's ssh keys. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_project_ssh_keys_with_http_info(id, query, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_project_ssh_keys_serialize( + id=id, + query=query, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SSHKeyList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_project_ssh_keys_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + query: Annotated[Optional[StrictStr], Field(description="Search by key, label, or fingerprint")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SSHKeyList]: + """Retrieve a project's ssh keys + + Returns a collection of the project's ssh keys. :param id: Project UUID (required) :type id: str @@ -715,423 +1306,779 @@ def find_project_ssh_keys_with_http_info(self, id : Annotated[StrictStr, Field(. :type query: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(SSHKeyList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_project_ssh_keys_serialize( + id=id, + query=query, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "SSHKeyList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id', - 'query', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def find_project_ssh_keys_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + query: Annotated[Optional[StrictStr], Field(description="Search by key, label, or fingerprint")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve a project's ssh keys + + Returns a collection of the project's ssh keys. + + :param id: Project UUID (required) + :type id: str + :param query: Search by key, label, or fingerprint + :type query: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_project_ssh_keys_serialize( + id=id, + query=query, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_project_ssh_keys" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "SSHKeyList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_project_ssh_keys_serialize( + self, + id, + query, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('query') is not None: # noqa: E501 - _query_params.append(('query', _params['query'])) + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if query is not None: + + _query_params.append(('query', query)) + + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "SSHKeyList", - '401': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{id}/ssh-keys', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/projects/{id}/ssh-keys', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_ssh_key_by_id(self, id : Annotated[StrictStr, Field(..., description="SSH Key UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> SSHKey: # noqa: E501 - """Retrieve a ssh key # noqa: E501 - Returns a single ssh key if the user has access # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_ssh_key_by_id( + self, + id: Annotated[StrictStr, Field(description="SSH Key UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SSHKey: + """Retrieve a ssh key - >>> thread = api.find_ssh_key_by_id(id, include, async_req=True) - >>> result = thread.get() + Returns a single ssh key if the user has access :param id: SSH Key UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: SSHKey - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_ssh_key_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_ssh_key_by_id_with_http_info(id, include, **kwargs) # noqa: E501 - - @validate_arguments - def find_ssh_key_by_id_with_http_info(self, id : Annotated[StrictStr, Field(..., description="SSH Key UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve a ssh key # noqa: E501 - - Returns a single ssh key if the user has access # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_ssh_key_by_id_with_http_info(id, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_ssh_key_by_id_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SSHKey", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_ssh_key_by_id_with_http_info( + self, + id: Annotated[StrictStr, Field(description="SSH Key UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SSHKey]: + """Retrieve a ssh key + + Returns a single ssh key if the user has access :param id: SSH Key UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(SSHKey, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_ssh_key_by_id_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "SSHKey", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def find_ssh_key_by_id_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="SSH Key UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve a ssh key + + Returns a single ssh key if the user has access + + :param id: SSH Key UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_ssh_key_by_id_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_ssh_key_by_id" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "SSHKey", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_ssh_key_by_id_serialize( + self, + id, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "SSHKey", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/ssh-keys/{id}', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/ssh-keys/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_ssh_keys(self, search : Annotated[Optional[StrictStr], Field(description="Search by key, label, or fingerprint")] = None, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> SSHKeyList: # noqa: E501 - """Retrieve all ssh keys # noqa: E501 - Returns a collection of the user’s ssh keys. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_ssh_keys( + self, + search: Annotated[Optional[StrictStr], Field(description="Search by key, label, or fingerprint")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SSHKeyList: + """Retrieve all ssh keys - >>> thread = api.find_ssh_keys(search, include, async_req=True) - >>> result = thread.get() + Returns a collection of the user’s ssh keys. :param search: Search by key, label, or fingerprint :type search: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: SSHKeyList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_ssh_keys_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_ssh_keys_with_http_info(search, include, **kwargs) # noqa: E501 - - @validate_arguments - def find_ssh_keys_with_http_info(self, search : Annotated[Optional[StrictStr], Field(description="Search by key, label, or fingerprint")] = None, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve all ssh keys # noqa: E501 - - Returns a collection of the user’s ssh keys. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_ssh_keys_with_http_info(search, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_ssh_keys_serialize( + search=search, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SSHKeyList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_ssh_keys_with_http_info( + self, + search: Annotated[Optional[StrictStr], Field(description="Search by key, label, or fingerprint")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SSHKeyList]: + """Retrieve all ssh keys + + Returns a collection of the user’s ssh keys. :param search: Search by key, label, or fingerprint :type search: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(SSHKeyList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_ssh_keys_serialize( + search=search, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SSHKeyList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'search', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def find_ssh_keys_without_preload_content( + self, + search: Annotated[Optional[StrictStr], Field(description="Search by key, label, or fingerprint")] = None, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all ssh keys + + Returns a collection of the user’s ssh keys. + + :param search: Search by key, label, or fingerprint + :type search: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_ssh_keys_serialize( + search=search, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_ssh_keys" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "SSHKeyList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} + def _find_ssh_keys_serialize( + self, + search, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the query parameters - _query_params = [] - if _params.get('search') is not None: # noqa: E501 - _query_params.append(('search', _params['search'])) + _host = None - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + # process the query parameters + if search is not None: + + _query_params.append(('search', search)) + + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "SSHKeyList", - '401': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/ssh-keys', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/ssh-keys', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def update_ssh_key(self, id : Annotated[StrictStr, Field(..., description="SSH Key UUID")], ssh_key_input : Annotated[SSHKeyInput, Field(..., description="ssh key to update")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> SSHKey: # noqa: E501 - """Update the ssh key # noqa: E501 - Updates the ssh key. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def update_ssh_key( + self, + id: Annotated[StrictStr, Field(description="SSH Key UUID")], + ssh_key_input: Annotated[SSHKeyInput, Field(description="ssh key to update")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SSHKey: + """Update the ssh key - >>> thread = api.update_ssh_key(id, ssh_key_input, include, async_req=True) - >>> result = thread.get() + Updates the ssh key. :param id: SSH Key UUID (required) :type id: str @@ -1139,32 +2086,78 @@ def update_ssh_key(self, id : Annotated[StrictStr, Field(..., description="SSH K :type ssh_key_input: SSHKeyInput :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: SSHKey - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the update_ssh_key_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.update_ssh_key_with_http_info(id, ssh_key_input, include, **kwargs) # noqa: E501 - - @validate_arguments - def update_ssh_key_with_http_info(self, id : Annotated[StrictStr, Field(..., description="SSH Key UUID")], ssh_key_input : Annotated[SSHKeyInput, Field(..., description="ssh key to update")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Update the ssh key # noqa: E501 - - Updates the ssh key. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.update_ssh_key_with_http_info(id, ssh_key_input, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._update_ssh_key_serialize( + id=id, + ssh_key_input=ssh_key_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SSHKey", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_ssh_key_with_http_info( + self, + id: Annotated[StrictStr, Field(description="SSH Key UUID")], + ssh_key_input: Annotated[SSHKeyInput, Field(description="ssh key to update")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SSHKey]: + """Update the ssh key + + Updates the ssh key. :param id: SSH Key UUID (required) :type id: str @@ -1172,119 +2165,209 @@ def update_ssh_key_with_http_info(self, id : Annotated[StrictStr, Field(..., des :type ssh_key_input: SSHKeyInput :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(SSHKey, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._update_ssh_key_serialize( + id=id, + ssh_key_input=ssh_key_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "SSHKey", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id', - 'ssh_key_input', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def update_ssh_key_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="SSH Key UUID")], + ssh_key_input: Annotated[SSHKeyInput, Field(description="ssh key to update")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update the ssh key + + Updates the ssh key. + + :param id: SSH Key UUID (required) + :type id: str + :param ssh_key_input: ssh key to update (required) + :type ssh_key_input: SSHKeyInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_ssh_key_serialize( + id=id, + ssh_key_input=ssh_key_input, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method update_ssh_key" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "SSHKey", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _update_ssh_key_serialize( + self, + id, + ssh_key_input, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['ssh_key_input'] is not None: - _body_params = _params['ssh_key_input'] + if ssh_key_input is not None: + _body_params = ssh_key_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '200': "SSHKey", - '401': "Error", - '403': "Error", - '404': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/ssh-keys/{id}', 'PUT', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='PUT', + resource_path='/ssh-keys/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/support_request_api.py b/equinix_metal/equinix_metal/api/support_request_api.py index 113490bd..7c3e67ac 100644 --- a/equinix_metal/equinix_metal/api/support_request_api.py +++ b/equinix_metal/equinix_metal/api/support_request_api.py @@ -12,178 +12,309 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated from pydantic import Field - +from typing_extensions import Annotated from equinix_metal.models.support_request_input import SupportRequestInput -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class SupportRequestApi(object): +class SupportRequestApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def request_suppert( + self, + support_request_input: Annotated[SupportRequestInput, Field(description="Support Request to create")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Create a support ticket - @validate_arguments - def request_suppert(self, support_request_input : Annotated[SupportRequestInput, Field(..., description="Support Request to create")], **kwargs) -> None: # noqa: E501 - """Create a support ticket # noqa: E501 - - Support Ticket. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.request_suppert(support_request_input, async_req=True) - >>> result = thread.get() + Support Ticket. :param support_request_input: Support Request to create (required) :type support_request_input: SupportRequestInput - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the request_suppert_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.request_suppert_with_http_info(support_request_input, **kwargs) # noqa: E501 - - @validate_arguments - def request_suppert_with_http_info(self, support_request_input : Annotated[SupportRequestInput, Field(..., description="Support Request to create")], **kwargs) -> ApiResponse: # noqa: E501 - """Create a support ticket # noqa: E501 - - Support Ticket. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.request_suppert_with_http_info(support_request_input, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._request_suppert_serialize( + support_request_input=support_request_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def request_suppert_with_http_info( + self, + support_request_input: Annotated[SupportRequestInput, Field(description="Support Request to create")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Create a support ticket + + Support Ticket. :param support_request_input: Support Request to create (required) :type support_request_input: SupportRequestInput - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 + + _param = self._request_suppert_serialize( + support_request_input=support_request_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'support_request_input' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def request_suppert_without_preload_content( + self, + support_request_input: Annotated[SupportRequestInput, Field(description="Support Request to create")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a support ticket + + Support Ticket. + + :param support_request_input: Support Request to create (required) + :type support_request_input: SupportRequestInput + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._request_suppert_serialize( + support_request_input=support_request_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method request_suppert" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} + def _request_suppert_serialize( + self, + support_request_input, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['support_request_input'] is not None: - _body_params = _params['support_request_input'] + if support_request_input is not None: + _body_params = support_request_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = {} + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/support-requests', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/support-requests', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/transfer_requests_api.py b/equinix_metal/equinix_metal/api/transfer_requests_api.py index 77744a29..6c7067ce 100644 --- a/equinix_metal/equinix_metal/api/transfer_requests_api.py +++ b/equinix_metal/equinix_metal/api/transfer_requests_api.py @@ -12,461 +12,842 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictStr, conlist - -from typing import Optional - +from pydantic import Field, StrictStr +from typing import List, Optional +from typing_extensions import Annotated from equinix_metal.models.transfer_request import TransferRequest -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class TransferRequestsApi(object): +class TransferRequestsApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def accept_transfer_request( + self, + id: Annotated[StrictStr, Field(description="Transfer request UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Accept a transfer request - @validate_arguments - def accept_transfer_request(self, id : Annotated[StrictStr, Field(..., description="Transfer request UUID")], **kwargs) -> None: # noqa: E501 - """Accept a transfer request # noqa: E501 - - Accept a transfer request. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.accept_transfer_request(id, async_req=True) - >>> result = thread.get() + Accept a transfer request. :param id: Transfer request UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the accept_transfer_request_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.accept_transfer_request_with_http_info(id, **kwargs) # noqa: E501 - - @validate_arguments - def accept_transfer_request_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Transfer request UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """Accept a transfer request # noqa: E501 - - Accept a transfer request. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.accept_transfer_request_with_http_info(id, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._accept_transfer_request_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def accept_transfer_request_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Transfer request UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Accept a transfer request + + Accept a transfer request. :param id: Transfer request UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 + + _param = self._accept_transfer_request_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def accept_transfer_request_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Transfer request UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Accept a transfer request + + Accept a transfer request. + + :param id: Transfer request UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._accept_transfer_request_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method accept_transfer_request" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _accept_transfer_request_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/transfers/{id}', 'PUT', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='PUT', + resource_path='/transfers/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def decline_transfer_request(self, id : Annotated[StrictStr, Field(..., description="Transfer request UUID")], **kwargs) -> None: # noqa: E501 - """Decline a transfer request # noqa: E501 - Decline a transfer request. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def decline_transfer_request( + self, + id: Annotated[StrictStr, Field(description="Transfer request UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Decline a transfer request - >>> thread = api.decline_transfer_request(id, async_req=True) - >>> result = thread.get() + Decline a transfer request. :param id: Transfer request UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the decline_transfer_request_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.decline_transfer_request_with_http_info(id, **kwargs) # noqa: E501 - - @validate_arguments - def decline_transfer_request_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Transfer request UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """Decline a transfer request # noqa: E501 - - Decline a transfer request. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.decline_transfer_request_with_http_info(id, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._decline_transfer_request_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def decline_transfer_request_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Transfer request UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Decline a transfer request + + Decline a transfer request. :param id: Transfer request UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 + + _param = self._decline_transfer_request_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def decline_transfer_request_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Transfer request UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Decline a transfer request + + Decline a transfer request. + + :param id: Transfer request UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._decline_transfer_request_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) + return response_data.response - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method decline_transfer_request" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + def _decline_transfer_request_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + _host = None + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/transfers/{id}', 'DELETE', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='DELETE', + resource_path='/transfers/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_transfer_request_by_id(self, id : Annotated[StrictStr, Field(..., description="Transfer request UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> TransferRequest: # noqa: E501 - """View a transfer request # noqa: E501 - Returns a single transfer request. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_transfer_request_by_id( + self, + id: Annotated[StrictStr, Field(description="Transfer request UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> TransferRequest: + """View a transfer request - >>> thread = api.find_transfer_request_by_id(id, include, async_req=True) - >>> result = thread.get() + Returns a single transfer request. :param id: Transfer request UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: TransferRequest - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_transfer_request_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_transfer_request_by_id_with_http_info(id, include, **kwargs) # noqa: E501 - - @validate_arguments - def find_transfer_request_by_id_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Transfer request UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """View a transfer request # noqa: E501 - - Returns a single transfer request. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_transfer_request_by_id_with_http_info(id, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_transfer_request_by_id_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "TransferRequest", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_transfer_request_by_id_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Transfer request UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[TransferRequest]: + """View a transfer request + + Returns a single transfer request. :param id: Transfer request UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(TransferRequest, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_transfer_request_by_id_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "TransferRequest", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def find_transfer_request_by_id_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Transfer request UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """View a transfer request + + Returns a single transfer request. + + :param id: Transfer request UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_transfer_request_by_id_serialize( + id=id, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "TransferRequest", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) + return response_data.response - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_transfer_request_by_id" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + def _find_transfer_request_by_id_serialize( + self, + id, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' - + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "TransferRequest", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/transfers/{id}', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/transfers/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/two_factor_auth_api.py b/equinix_metal/equinix_metal/api/two_factor_auth_api.py index 0890d8c7..a022dddf 100644 --- a/equinix_metal/equinix_metal/api/two_factor_auth_api.py +++ b/equinix_metal/equinix_metal/api/two_factor_auth_api.py @@ -12,547 +12,1007 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class TwoFactorAuthApi(object): +class TwoFactorAuthApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def disable_tfa_app( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Disable two factor authentication - @validate_arguments - def disable_tfa_app(self, **kwargs) -> None: # noqa: E501 - """Disable two factor authentication # noqa: E501 + Disables two factor authentication. - Disables two factor authentication. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 - >>> thread = api.disable_tfa_app(async_req=True) - >>> result = thread.get() + _param = self._disable_tfa_app_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def disable_tfa_app_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Disable two factor authentication + + Disables two factor authentication. - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the disable_tfa_app_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.disable_tfa_app_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - def disable_tfa_app_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 - """Disable two factor authentication # noqa: E501 - - Disables two factor authentication. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.disable_tfa_app_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + """ # noqa: E501 + + _param = self._disable_tfa_app_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def disable_tfa_app_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Disable two factor authentication + + Disables two factor authentication. + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 - _params = locals() + _param = self._disable_tfa_app_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _all_params = [ - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) + return response_data.response - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method disable_tfa_app" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + def _disable_tfa_app_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the path parameters - _path_params = {} + _host = None + + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/user/otp/app', 'DELETE', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='DELETE', + resource_path='/user/otp/app', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def disable_tfa_sms(self, **kwargs) -> None: # noqa: E501 - """Disable two factor authentication # noqa: E501 - Disables two factor authentication. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def disable_tfa_sms( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Disable two factor authentication - >>> thread = api.disable_tfa_sms(async_req=True) - >>> result = thread.get() + Disables two factor authentication. - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the disable_tfa_sms_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.disable_tfa_sms_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - def disable_tfa_sms_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 - """Disable two factor authentication # noqa: E501 - - Disables two factor authentication. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.disable_tfa_sms_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + """ # noqa: E501 + + _param = self._disable_tfa_sms_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def disable_tfa_sms_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Disable two factor authentication + + Disables two factor authentication. + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 - _params = locals() + _param = self._disable_tfa_sms_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _all_params = [ - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def disable_tfa_sms_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Disable two factor authentication + + Disables two factor authentication. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._disable_tfa_sms_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method disable_tfa_sms" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} + def _disable_tfa_sms_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/user/otp/sms', 'DELETE', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='DELETE', + resource_path='/user/otp/sms', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def enable_tfa_app(self, **kwargs) -> None: # noqa: E501 - """Enable two factor auth using app # noqa: E501 - Enables two factor authentication using authenticator app. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def enable_tfa_app( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Enable two factor auth using app - >>> thread = api.enable_tfa_app(async_req=True) - >>> result = thread.get() + Enables two factor authentication using authenticator app. - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the enable_tfa_app_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.enable_tfa_app_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - def enable_tfa_app_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 - """Enable two factor auth using app # noqa: E501 - - Enables two factor authentication using authenticator app. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.enable_tfa_app_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + """ # noqa: E501 + + _param = self._enable_tfa_app_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def enable_tfa_app_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Enable two factor auth using app + + Enables two factor authentication using authenticator app. + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 - _params = locals() + _param = self._enable_tfa_app_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _all_params = [ - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def enable_tfa_app_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Enable two factor auth using app + + Enables two factor authentication using authenticator app. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._enable_tfa_app_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method enable_tfa_app" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} + def _enable_tfa_app_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/user/otp/app', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/user/otp/app', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def enable_tfa_sms(self, **kwargs) -> None: # noqa: E501 - """Enable two factor auth using sms # noqa: E501 - Enables two factor authentication with sms. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def enable_tfa_sms( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Enable two factor auth using sms - >>> thread = api.enable_tfa_sms(async_req=True) - >>> result = thread.get() + Enables two factor authentication with sms. - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the enable_tfa_sms_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.enable_tfa_sms_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - def enable_tfa_sms_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 - """Enable two factor auth using sms # noqa: E501 - - Enables two factor authentication with sms. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.enable_tfa_sms_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + """ # noqa: E501 + + _param = self._enable_tfa_sms_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def enable_tfa_sms_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Enable two factor auth using sms + + Enables two factor authentication with sms. + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 - _params = locals() + _param = self._enable_tfa_sms_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _all_params = [ - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def enable_tfa_sms_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Enable two factor auth using sms + + Enables two factor authentication with sms. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._enable_tfa_sms_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) + return response_data.response - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method enable_tfa_sms" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + def _enable_tfa_sms_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the path parameters - _path_params = {} + _host = None + + _collection_formats: Dict[str, str] = { + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/user/otp/sms', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/user/otp/sms', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/usages_api.py b/equinix_metal/equinix_metal/api/usages_api.py index 3a6358df..ab88d8f7 100644 --- a/equinix_metal/equinix_metal/api/usages_api.py +++ b/equinix_metal/equinix_metal/api/usages_api.py @@ -12,51 +12,55 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated from pydantic import Field, StrictStr - from typing import Optional - +from typing_extensions import Annotated from equinix_metal.models.device_usage_list import DeviceUsageList from equinix_metal.models.project_usage_list import ProjectUsageList -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class UsagesApi(object): +class UsagesApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def find_device_usages( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + created_after: Annotated[Optional[StrictStr], Field(description="Filter usages created after this date")] = None, + created_before: Annotated[Optional[StrictStr], Field(description="Filter usages created before this date")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DeviceUsageList: + """Retrieve all usages for device - @validate_arguments - def find_device_usages(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], created_after : Annotated[Optional[StrictStr], Field(description="Filter usages created after this date")] = None, created_before : Annotated[Optional[StrictStr], Field(description="Filter usages created before this date")] = None, **kwargs) -> DeviceUsageList: # noqa: E501 - """Retrieve all usages for device # noqa: E501 - - Returns all usages for a device. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_device_usages(id, created_after, created_before, async_req=True) - >>> result = thread.get() + Returns all usages for a device. :param id: Device UUID (required) :type id: str @@ -64,32 +68,76 @@ def find_device_usages(self, id : Annotated[StrictStr, Field(..., description="D :type created_after: str :param created_before: Filter usages created before this date :type created_before: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: DeviceUsageList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_device_usages_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_device_usages_with_http_info(id, created_after, created_before, **kwargs) # noqa: E501 - - @validate_arguments - def find_device_usages_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Device UUID")], created_after : Annotated[Optional[StrictStr], Field(description="Filter usages created after this date")] = None, created_before : Annotated[Optional[StrictStr], Field(description="Filter usages created before this date")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve all usages for device # noqa: E501 - - Returns all usages for a device. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_device_usages_with_http_info(id, created_after, created_before, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_device_usages_serialize( + id=id, + created_after=created_after, + created_before=created_before, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DeviceUsageList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_device_usages_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + created_after: Annotated[Optional[StrictStr], Field(description="Filter usages created after this date")] = None, + created_before: Annotated[Optional[StrictStr], Field(description="Filter usages created before this date")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DeviceUsageList]: + """Retrieve all usages for device + + Returns all usages for a device. :param id: Device UUID (required) :type id: str @@ -97,123 +145,218 @@ def find_device_usages_with_http_info(self, id : Annotated[StrictStr, Field(..., :type created_after: str :param created_before: Filter usages created before this date :type created_before: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(DeviceUsageList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_device_usages_serialize( + id=id, + created_after=created_after, + created_before=created_before, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "DeviceUsageList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id', - 'created_after', - 'created_before' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def find_device_usages_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Device UUID")], + created_after: Annotated[Optional[StrictStr], Field(description="Filter usages created after this date")] = None, + created_before: Annotated[Optional[StrictStr], Field(description="Filter usages created before this date")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all usages for device + + Returns all usages for a device. + + :param id: Device UUID (required) + :type id: str + :param created_after: Filter usages created after this date + :type created_after: str + :param created_before: Filter usages created before this date + :type created_before: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_device_usages_serialize( + id=id, + created_after=created_after, + created_before=created_before, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_device_usages" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "DeviceUsageList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_device_usages_serialize( + self, + id, + created_after, + created_before, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('created_after') is not None: # noqa: E501 - _query_params.append(('created[after]', _params['created_after'])) + _collection_formats: Dict[str, str] = { + } - if _params.get('created_before') is not None: # noqa: E501 - _query_params.append(('created[before]', _params['created_before'])) + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if created_after is not None: + + _query_params.append(('created[after]', created_after)) + + if created_before is not None: + + _query_params.append(('created[before]', created_before)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "DeviceUsageList", - '401': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/devices/{id}/usages', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/devices/{id}/usages', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_project_usage(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], created_after : Annotated[Optional[StrictStr], Field(description="Filter usages created after this date")] = None, created_before : Annotated[Optional[StrictStr], Field(description="Filter usages created before this date")] = None, **kwargs) -> ProjectUsageList: # noqa: E501 - """Retrieve all usages for project # noqa: E501 - Returns all usages for a project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_project_usage( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + created_after: Annotated[Optional[StrictStr], Field(description="Filter usages created after this date")] = None, + created_before: Annotated[Optional[StrictStr], Field(description="Filter usages created before this date")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ProjectUsageList: + """Retrieve all usages for project - >>> thread = api.find_project_usage(id, created_after, created_before, async_req=True) - >>> result = thread.get() + Returns all usages for a project. :param id: Project UUID (required) :type id: str @@ -221,32 +364,76 @@ def find_project_usage(self, id : Annotated[StrictStr, Field(..., description="P :type created_after: str :param created_before: Filter usages created before this date :type created_before: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ProjectUsageList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_project_usage_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_project_usage_with_http_info(id, created_after, created_before, **kwargs) # noqa: E501 - - @validate_arguments - def find_project_usage_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], created_after : Annotated[Optional[StrictStr], Field(description="Filter usages created after this date")] = None, created_before : Annotated[Optional[StrictStr], Field(description="Filter usages created before this date")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve all usages for project # noqa: E501 - - Returns all usages for a project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_project_usage_with_http_info(id, created_after, created_before, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_project_usage_serialize( + id=id, + created_after=created_after, + created_before=created_before, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ProjectUsageList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_project_usage_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + created_after: Annotated[Optional[StrictStr], Field(description="Filter usages created after this date")] = None, + created_before: Annotated[Optional[StrictStr], Field(description="Filter usages created before this date")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ProjectUsageList]: + """Retrieve all usages for project + + Returns all usages for a project. :param id: Project UUID (required) :type id: str @@ -254,109 +441,193 @@ def find_project_usage_with_http_info(self, id : Annotated[StrictStr, Field(..., :type created_after: str :param created_before: Filter usages created before this date :type created_before: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ProjectUsageList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_project_usage_serialize( + id=id, + created_after=created_after, + created_before=created_before, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ProjectUsageList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id', - 'created_after', - 'created_before' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def find_project_usage_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + created_after: Annotated[Optional[StrictStr], Field(description="Filter usages created after this date")] = None, + created_before: Annotated[Optional[StrictStr], Field(description="Filter usages created before this date")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all usages for project + + Returns all usages for a project. + + :param id: Project UUID (required) + :type id: str + :param created_after: Filter usages created after this date + :type created_after: str + :param created_before: Filter usages created before this date + :type created_before: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_project_usage_serialize( + id=id, + created_after=created_after, + created_before=created_before, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_project_usage" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "ProjectUsageList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_project_usage_serialize( + self, + id, + created_after, + created_before, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('created_after') is not None: # noqa: E501 - _query_params.append(('created[after]', _params['created_after'])) + _collection_formats: Dict[str, str] = { + } - if _params.get('created_before') is not None: # noqa: E501 - _query_params.append(('created[before]', _params['created_before'])) + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if created_after is not None: + + _query_params.append(('created[after]', created_after)) + + if created_before is not None: + + _query_params.append(('created[before]', created_before)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "ProjectUsageList", - '401': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{id}/usages', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/projects/{id}/usages', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/user_verification_tokens_api.py b/equinix_metal/equinix_metal/api/user_verification_tokens_api.py index f62bda9a..3760e5aa 100644 --- a/equinix_metal/equinix_metal/api/user_verification_tokens_api.py +++ b/equinix_metal/equinix_metal/api/user_verification_tokens_api.py @@ -12,335 +12,604 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictStr, conlist - -from typing import Optional - +from pydantic import Field, StrictStr +from typing import List, Optional +from typing_extensions import Annotated from equinix_metal.models.verify_email import VerifyEmail -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class UserVerificationTokensApi(object): +class UserVerificationTokensApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def consume_verification_request( + self, + verify_email: Annotated[VerifyEmail, Field(description="Email to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Verify a user using an email verification token - @validate_arguments - def consume_verification_request(self, verify_email : Annotated[VerifyEmail, Field(..., description="Email to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> None: # noqa: E501 - """Verify a user using an email verification token # noqa: E501 - - Consumes an email verification token and verifies the user associated with it. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.consume_verification_request(verify_email, include, async_req=True) - >>> result = thread.get() + Consumes an email verification token and verifies the user associated with it. :param verify_email: Email to create (required) :type verify_email: VerifyEmail :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the consume_verification_request_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.consume_verification_request_with_http_info(verify_email, include, **kwargs) # noqa: E501 - - @validate_arguments - def consume_verification_request_with_http_info(self, verify_email : Annotated[VerifyEmail, Field(..., description="Email to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Verify a user using an email verification token # noqa: E501 - - Consumes an email verification token and verifies the user associated with it. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.consume_verification_request_with_http_info(verify_email, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._consume_verification_request_serialize( + verify_email=verify_email, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def consume_verification_request_with_http_info( + self, + verify_email: Annotated[VerifyEmail, Field(description="Email to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Verify a user using an email verification token + + Consumes an email verification token and verifies the user associated with it. :param verify_email: Email to create (required) :type verify_email: VerifyEmail :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 + + _param = self._consume_verification_request_serialize( + verify_email=verify_email, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'verify_email', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def consume_verification_request_without_preload_content( + self, + verify_email: Annotated[VerifyEmail, Field(description="Email to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Verify a user using an email verification token + + Consumes an email verification token and verifies the user associated with it. + + :param verify_email: Email to create (required) + :type verify_email: VerifyEmail + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._consume_verification_request_serialize( + verify_email=verify_email, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method consume_verification_request" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} + def _consume_verification_request_serialize( + self, + verify_email, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['verify_email'] is not None: - _body_params = _params['verify_email'] + if verify_email is not None: + _body_params = verify_email + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = {} + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/verify-email', 'PUT', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='PUT', + resource_path='/verify-email', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def create_validation_request(self, login : Annotated[StrictStr, Field(..., description="Email for verification request")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> None: # noqa: E501 - """Create an email verification request # noqa: E501 - Creates an email verification request # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def create_validation_request( + self, + login: Annotated[StrictStr, Field(description="Email for verification request")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Create an email verification request - >>> thread = api.create_validation_request(login, include, async_req=True) - >>> result = thread.get() + Creates an email verification request :param login: Email for verification request (required) :type login: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the create_validation_request_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.create_validation_request_with_http_info(login, include, **kwargs) # noqa: E501 - - @validate_arguments - def create_validation_request_with_http_info(self, login : Annotated[StrictStr, Field(..., description="Email for verification request")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Create an email verification request # noqa: E501 - - Creates an email verification request # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_validation_request_with_http_info(login, include, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._create_validation_request_serialize( + login=login, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': None, + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_validation_request_with_http_info( + self, + login: Annotated[StrictStr, Field(description="Email for verification request")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Create an email verification request + + Creates an email verification request :param login: Email for verification request (required) :type login: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 + + _param = self._create_validation_request_serialize( + login=login, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '201': None, + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'login', - 'include' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def create_validation_request_without_preload_content( + self, + login: Annotated[StrictStr, Field(description="Email for verification request")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create an email verification request + + Creates an email verification request + + :param login: Email for verification request (required) + :type login: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_validation_request_serialize( + login=login, + include=include, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_validation_request" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '201': None, + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} + def _create_validation_request_serialize( + self, + login, + include, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the query parameters - _query_params = [] - if _params.get('login') is not None: # noqa: E501 - _query_params.append(('login', _params['login'])) + _host = None - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if login is not None: + + _query_params.append(('login', login)) + + if include is not None: + + _query_params.append(('include', include)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/verify-email', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/verify-email', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/userdata_api.py b/equinix_metal/equinix_metal/api/userdata_api.py index d89ad956..f20e831f 100644 --- a/equinix_metal/equinix_metal/api/userdata_api.py +++ b/equinix_metal/equinix_metal/api/userdata_api.py @@ -12,172 +12,292 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated from pydantic import Field, StrictStr - from typing import Optional +from typing_extensions import Annotated - -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class UserdataApi(object): +class UserdataApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def validate_userdata( + self, + userdata: Annotated[Optional[StrictStr], Field(description="Userdata to validate")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Validate user data - @validate_arguments - def validate_userdata(self, userdata : Annotated[Optional[StrictStr], Field(description="Userdata to validate")] = None, **kwargs) -> None: # noqa: E501 - """Validate user data # noqa: E501 - - Validates user data (Userdata) # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.validate_userdata(userdata, async_req=True) - >>> result = thread.get() + Validates user data (Userdata) :param userdata: Userdata to validate :type userdata: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the validate_userdata_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.validate_userdata_with_http_info(userdata, **kwargs) # noqa: E501 - - @validate_arguments - def validate_userdata_with_http_info(self, userdata : Annotated[Optional[StrictStr], Field(description="Userdata to validate")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Validate user data # noqa: E501 - - Validates user data (Userdata) # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.validate_userdata_with_http_info(userdata, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._validate_userdata_serialize( + userdata=userdata, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def validate_userdata_with_http_info( + self, + userdata: Annotated[Optional[StrictStr], Field(description="Userdata to validate")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Validate user data + + Validates user data (Userdata) :param userdata: Userdata to validate :type userdata: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 + + _param = self._validate_userdata_serialize( + userdata=userdata, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'userdata' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def validate_userdata_without_preload_content( + self, + userdata: Annotated[Optional[StrictStr], Field(description="Userdata to validate")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Validate user data + + Validates user data (Userdata) + + :param userdata: Userdata to validate + :type userdata: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._validate_userdata_serialize( + userdata=userdata, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method validate_userdata" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} + def _validate_userdata_serialize( + self, + userdata, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the query parameters - _query_params = [] - if _params.get('userdata') is not None: # noqa: E501 - _query_params.append(('userdata', _params['userdata'])) + _host = None + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if userdata is not None: + + _query_params.append(('userdata', userdata)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/userdata/validate', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/userdata/validate', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/users_api.py b/equinix_metal/equinix_metal/api/users_api.py index ac365e50..8f362987 100644 --- a/equinix_metal/equinix_metal/api/users_api.py +++ b/equinix_metal/equinix_metal/api/users_api.py @@ -12,54 +12,135 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictStr, conint, conlist - -from typing import Optional - +from pydantic import Field, StrictStr +from typing import List, Optional +from typing_extensions import Annotated from equinix_metal.models.invitation_list import InvitationList from equinix_metal.models.user import User from equinix_metal.models.user_create_input import UserCreateInput from equinix_metal.models.user_list import UserList from equinix_metal.models.user_update_input import UserUpdateInput -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class UsersApi(object): +class UsersApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def create_user( + self, + user_create_input: Annotated[UserCreateInput, Field(description="User to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> User: + """Create a user - @validate_arguments - def create_user(self, user_create_input : Annotated[UserCreateInput, Field(..., description="User to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> User: # noqa: E501 - """Create a user # noqa: E501 + Creates a user. - Creates a user. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + :param user_create_input: User to create (required) + :type user_create_input: UserCreateInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_user_serialize( + user_create_input=user_create_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - >>> thread = api.create_user(user_create_input, include, exclude, async_req=True) - >>> result = thread.get() + _response_types_map: Dict[str, Optional[str]] = { + '201': "User", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_user_with_http_info( + self, + user_create_input: Annotated[UserCreateInput, Field(description="User to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[User]: + """Create a user + + Creates a user. :param user_create_input: User to create (required) :type user_create_input: UserCreateInput @@ -67,32 +148,76 @@ def create_user(self, user_create_input : Annotated[UserCreateInput, Field(..., :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: User - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the create_user_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.create_user_with_http_info(user_create_input, include, exclude, **kwargs) # noqa: E501 + """ # noqa: E501 + + _param = self._create_user_serialize( + user_create_input=user_create_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - @validate_arguments - def create_user_with_http_info(self, user_create_input : Annotated[UserCreateInput, Field(..., description="User to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Create a user # noqa: E501 + _response_types_map: Dict[str, Optional[str]] = { + '201': "User", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - Creates a user. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_user_with_http_info(user_create_input, include, exclude, async_req=True) - >>> result = thread.get() + @validate_call + def create_user_without_preload_content( + self, + user_create_input: Annotated[UserCreateInput, Field(description="User to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a user + + Creates a user. :param user_create_input: User to create (required) :type user_create_input: UserCreateInput @@ -100,282 +225,436 @@ def create_user_with_http_info(self, user_create_input : Annotated[UserCreateInp :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(User, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() + """ # noqa: E501 + + _param = self._create_user_serialize( + user_create_input=user_create_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _all_params = [ - 'user_create_input', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + _response_types_map: Dict[str, Optional[str]] = { + '201': "User", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) + return response_data.response - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_user" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + def _create_user_serialize( + self, + user_create_input, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the path parameters - _path_params = {} + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['user_create_input'] is not None: - _body_params = _params['user_create_input'] + if user_create_input is not None: + _body_params = user_create_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '201': "User", - '401': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/users', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/users', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_current_user(self, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> User: # noqa: E501 - """Retrieve the current user # noqa: E501 - Returns the user object for the currently logged-in user. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_current_user( + self, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> User: + """Retrieve the current user - >>> thread = api.find_current_user(include, exclude, async_req=True) - >>> result = thread.get() + Returns the user object for the currently logged-in user. :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: User - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_current_user_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_current_user_with_http_info(include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def find_current_user_with_http_info(self, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve the current user # noqa: E501 + """ # noqa: E501 + + _param = self._find_current_user_serialize( + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Returns the user object for the currently logged-in user. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "User", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_current_user_with_http_info( + self, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[User]: + """Retrieve the current user - >>> thread = api.find_current_user_with_http_info(include, exclude, async_req=True) - >>> result = thread.get() + Returns the user object for the currently logged-in user. :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(User, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_current_user_serialize( + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "User", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def find_current_user_without_preload_content( + self, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve the current user + + Returns the user object for the currently logged-in user. + + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_current_user_serialize( + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_current_user" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "User", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} + def _find_current_user_serialize( + self, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "User", - '401': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/user', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/user', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_invitations(self, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> InvitationList: # noqa: E501 - """Retrieve current user invitations # noqa: E501 - Returns all invitations in current user. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_invitations( + self, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> InvitationList: + """Retrieve current user invitations - >>> thread = api.find_invitations(include, page, per_page, async_req=True) - >>> result = thread.get() + Returns all invitations in current user. :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] @@ -383,32 +662,77 @@ def find_invitations(self, include : Annotated[Optional[conlist(StrictStr)], Fie :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: InvitationList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_invitations_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_invitations_with_http_info(include, page, per_page, **kwargs) # noqa: E501 - - @validate_arguments - def find_invitations_with_http_info(self, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve current user invitations # noqa: E501 + """ # noqa: E501 + + _param = self._find_invitations_serialize( + include=include, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Returns all invitations in current user. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "InvitationList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_invitations_with_http_info( + self, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[InvitationList]: + """Retrieve current user invitations - >>> thread = api.find_invitations_with_http_info(include, page, per_page, async_req=True) - >>> result = thread.get() + Returns all invitations in current user. :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] @@ -416,125 +740,223 @@ def find_invitations_with_http_info(self, include : Annotated[Optional[conlist(S :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(InvitationList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_invitations_serialize( + include=include, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "InvitationList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'include', - 'page', - 'per_page' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def find_invitations_without_preload_content( + self, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve current user invitations + + Returns all invitations in current user. + + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param page: Page to return + :type page: int + :param per_page: Items returned per page + :type per_page: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_invitations_serialize( + include=include, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_invitations" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "InvitationList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} + def _find_invitations_serialize( + self, + include, + page, + per_page, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _host = None - if _params.get('page') is not None: # noqa: E501 - _query_params.append(('page', _params['page'])) + _collection_formats: Dict[str, str] = { + 'include': 'csv', + } - if _params.get('per_page') is not None: # noqa: E501 - _query_params.append(('per_page', _params['per_page'])) + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if page is not None: + + _query_params.append(('page', page)) + + if per_page is not None: + + _query_params.append(('per_page', per_page)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "InvitationList", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/invitations', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/invitations', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_user_by_id(self, id : Annotated[StrictStr, Field(..., description="User UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> User: # noqa: E501 - """Retrieve a user # noqa: E501 - Returns a single user if the user has access # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_user_by_id( + self, + id: Annotated[StrictStr, Field(description="User UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> User: + """Retrieve a user - >>> thread = api.find_user_by_id(id, include, exclude, async_req=True) - >>> result = thread.get() + Returns a single user if the user has access :param id: User UUID (required) :type id: str @@ -542,32 +964,77 @@ def find_user_by_id(self, id : Annotated[StrictStr, Field(..., description="User :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: User - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_user_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_user_by_id_with_http_info(id, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def find_user_by_id_with_http_info(self, id : Annotated[StrictStr, Field(..., description="User UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve a user # noqa: E501 + """ # noqa: E501 + + _param = self._find_user_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Returns a single user if the user has access # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "User", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_user_by_id_with_http_info( + self, + id: Annotated[StrictStr, Field(description="User UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[User]: + """Retrieve a user - >>> thread = api.find_user_by_id_with_http_info(id, include, exclude, async_req=True) - >>> result = thread.get() + Returns a single user if the user has access :param id: User UUID (required) :type id: str @@ -575,255 +1042,467 @@ def find_user_by_id_with_http_info(self, id : Annotated[StrictStr, Field(..., de :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(User, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_user_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "User", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def find_user_by_id_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="User UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve a user + + Returns a single user if the user has access + + :param id: User UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_user_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_user_by_id" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "User", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_user_by_id_serialize( + self, + id, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "User", - '401': "Error", - '403': "Error", - '404': "Error", - } + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/users/{id}', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/users/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_user_customdata(self, id : Annotated[StrictStr, Field(..., description="User UUID")], **kwargs) -> None: # noqa: E501 - """Retrieve the custom metadata of a user # noqa: E501 - Provides the custom metadata stored for this user in json format # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_user_customdata( + self, + id: Annotated[StrictStr, Field(description="User UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Retrieve the custom metadata of a user - >>> thread = api.find_user_customdata(id, async_req=True) - >>> result = thread.get() + Provides the custom metadata stored for this user in json format :param id: User UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_user_customdata_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_user_customdata_with_http_info(id, **kwargs) # noqa: E501 - - @validate_arguments - def find_user_customdata_with_http_info(self, id : Annotated[StrictStr, Field(..., description="User UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve the custom metadata of a user # noqa: E501 + """ # noqa: E501 + + _param = self._find_user_customdata_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Provides the custom metadata stored for this user in json format # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_user_customdata_with_http_info( + self, + id: Annotated[StrictStr, Field(description="User UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Retrieve the custom metadata of a user - >>> thread = api.find_user_customdata_with_http_info(id, async_req=True) - >>> result = thread.get() + Provides the custom metadata stored for this user in json format :param id: User UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 + + _param = self._find_user_customdata_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def find_user_customdata_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="User UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve the custom metadata of a user + + Provides the custom metadata stored for this user in json format + + :param id: User UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_user_customdata_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_user_customdata" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_user_customdata_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/users/{id}/customdata', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/users/{id}/customdata', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_users_all_pages(self, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> UserList: # noqa: E501 + + @validate_call + def find_users_all_pages(self, include : Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, per_page : Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, **kwargs) -> UserList: # noqa: E501 """Retrieve all users # noqa: E501 This method is the same as find_users, but fetches resources from all the pages. @@ -871,19 +1550,32 @@ def find_users_all_pages(self, include : Annotated[Optional[conlist(StrictStr)], if page_response.meta.next is None: break page += 1 - - return all_pages - @validate_arguments - def find_users(self, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> UserList: # noqa: E501 - """Retrieve all users # noqa: E501 + return all_pages - Returns a list of users that the are accessible to the current user (all users in the current user’s projects, essentially). # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_users( + self, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> UserList: + """Retrieve all users - >>> thread = api.find_users(include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + Returns a list of users that the are accessible to the current user (all users in the current user’s projects, essentially). :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] @@ -893,32 +1585,77 @@ def find_users(self, include : Annotated[Optional[conlist(StrictStr)], Field(des :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: UserList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_users_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_users_with_http_info(include, exclude, page, per_page, **kwargs) # noqa: E501 - - @validate_arguments - def find_users_with_http_info(self, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, page : Annotated[Optional[conint(strict=True, le=100000, ge=1)], Field(description="Page to return")] = None, per_page : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="Items returned per page")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve all users # noqa: E501 + """ # noqa: E501 + + _param = self._find_users_serialize( + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Returns a list of users that the are accessible to the current user (all users in the current user’s projects, essentially). # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_users_with_http_info( + self, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[UserList]: + """Retrieve all users - >>> thread = api.find_users_with_http_info(include, exclude, page, per_page, async_req=True) - >>> result = thread.get() + Returns a list of users that the are accessible to the current user (all users in the current user’s projects, essentially). :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] @@ -928,128 +1665,230 @@ def find_users_with_http_info(self, include : Annotated[Optional[conlist(StrictS :type page: int :param per_page: Items returned per page :type per_page: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(UserList, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'include', - 'exclude', - 'page', - 'per_page' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + """ # noqa: E501 + + _param = self._find_users_serialize( + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_users" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} - # process the path parameters - _path_params = {} + @validate_call + def find_users_without_preload_content( + self, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=1)]], Field(description="Page to return")] = None, + per_page: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Items returned per page")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all users - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + Returns a list of users that the are accessible to the current user (all users in the current user’s projects, essentially). - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param page: Page to return + :type page: int + :param per_page: Items returned per page + :type per_page: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_users_serialize( + include=include, + exclude=exclude, + page=page, + per_page=per_page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - if _params.get('page') is not None: # noqa: E501 - _query_params.append(('page', _params['page'])) + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserList", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _find_users_serialize( + self, + include, + exclude, + page, + per_page, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('per_page') is not None: # noqa: E501 - _query_params.append(('per_page', _params['per_page'])) + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + + if page is not None: + + _query_params.append(('page', page)) + + if per_page is not None: + + _query_params.append(('per_page', per_page)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "UserList", - '401': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/users', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/users', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def update_current_user(self, user_update_input : Annotated[UserUpdateInput, Field(..., description="User to update")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> User: # noqa: E501 - """Update the current user # noqa: E501 - Updates the currently logged-in user. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def update_current_user( + self, + user_update_input: Annotated[UserUpdateInput, Field(description="User to update")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> User: + """Update the current user - >>> thread = api.update_current_user(user_update_input, include, exclude, async_req=True) - >>> result = thread.get() + Updates the currently logged-in user. :param user_update_input: User to update (required) :type user_update_input: UserUpdateInput @@ -1057,32 +1896,76 @@ def update_current_user(self, user_update_input : Annotated[UserUpdateInput, Fie :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: User - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the update_current_user_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.update_current_user_with_http_info(user_update_input, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def update_current_user_with_http_info(self, user_update_input : Annotated[UserUpdateInput, Field(..., description="User to update")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Update the current user # noqa: E501 + """ # noqa: E501 + + _param = self._update_current_user_serialize( + user_update_input=user_update_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Updates the currently logged-in user. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "User", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_current_user_with_http_info( + self, + user_update_input: Annotated[UserUpdateInput, Field(description="User to update")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[User]: + """Update the current user - >>> thread = api.update_current_user_with_http_info(user_update_input, include, exclude, async_req=True) - >>> result = thread.get() + Updates the currently logged-in user. :param user_update_input: User to update (required) :type user_update_input: UserUpdateInput @@ -1090,118 +1973,208 @@ def update_current_user_with_http_info(self, user_update_input : Annotated[UserU :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(User, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._update_current_user_serialize( + user_update_input=user_update_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "User", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'user_update_input', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def update_current_user_without_preload_content( + self, + user_update_input: Annotated[UserUpdateInput, Field(description="User to update")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update the current user + + Updates the currently logged-in user. + + :param user_update_input: User to update (required) + :type user_update_input: UserUpdateInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_current_user_serialize( + user_update_input=user_update_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method update_current_user" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "User", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} + def _update_current_user_serialize( + self, + user_update_input, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['user_update_input'] is not None: - _body_params = _params['user_update_input'] + if user_update_input is not None: + _body_params = user_update_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '200': "User", - '401': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/user', 'PUT', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='PUT', + resource_path='/user', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/vlans_api.py b/equinix_metal/equinix_metal/api/vlans_api.py index 048d8459..2b3298ff 100644 --- a/equinix_metal/equinix_metal/api/vlans_api.py +++ b/equinix_metal/equinix_metal/api/vlans_api.py @@ -12,52 +12,57 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictStr, conlist - -from typing import Optional - +from pydantic import Field, StrictStr +from typing import List, Optional +from typing_extensions import Annotated from equinix_metal.models.virtual_network import VirtualNetwork from equinix_metal.models.virtual_network_create_input import VirtualNetworkCreateInput from equinix_metal.models.virtual_network_list import VirtualNetworkList -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class VLANsApi(object): +class VLANsApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def create_virtual_network( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + virtual_network_create_input: Annotated[VirtualNetworkCreateInput, Field(description="Virtual Network to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VirtualNetwork: + """Create a virtual network - @validate_arguments - def create_virtual_network(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], virtual_network_create_input : Annotated[VirtualNetworkCreateInput, Field(..., description="Virtual Network to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> VirtualNetwork: # noqa: E501 - """Create a virtual network # noqa: E501 - - Creates an virtual network. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_virtual_network(id, virtual_network_create_input, include, exclude, async_req=True) - >>> result = thread.get() + Creates an virtual network. :param id: Project UUID (required) :type id: str @@ -67,32 +72,80 @@ def create_virtual_network(self, id : Annotated[StrictStr, Field(..., descriptio :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: VirtualNetwork - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the create_virtual_network_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.create_virtual_network_with_http_info(id, virtual_network_create_input, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def create_virtual_network_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], virtual_network_create_input : Annotated[VirtualNetworkCreateInput, Field(..., description="Virtual Network to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Create a virtual network # noqa: E501 - - Creates an virtual network. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_virtual_network_with_http_info(id, virtual_network_create_input, include, exclude, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._create_virtual_network_serialize( + id=id, + virtual_network_create_input=virtual_network_create_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "VirtualNetwork", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_virtual_network_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + virtual_network_create_input: Annotated[VirtualNetworkCreateInput, Field(description="Virtual Network to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VirtualNetwork]: + """Create a virtual network + + Creates an virtual network. :param id: Project UUID (required) :type id: str @@ -102,138 +155,245 @@ def create_virtual_network_with_http_info(self, id : Annotated[StrictStr, Field( :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(VirtualNetwork, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'id', - 'virtual_network_create_input', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + """ # noqa: E501 + + _param = self._create_virtual_network_serialize( + id=id, + virtual_network_create_input=virtual_network_create_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_virtual_network" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '201': "VirtualNetwork", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + @validate_call + def create_virtual_network_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + virtual_network_create_input: Annotated[VirtualNetworkCreateInput, Field(description="Virtual Network to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a virtual network + Creates an virtual network. - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + :param id: Project UUID (required) + :type id: str + :param virtual_network_create_input: Virtual Network to create (required) + :type virtual_network_create_input: VirtualNetworkCreateInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_virtual_network_serialize( + id=id, + virtual_network_create_input=virtual_network_create_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _response_types_map: Dict[str, Optional[str]] = { + '201': "VirtualNetwork", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_virtual_network_serialize( + self, + id, + virtual_network_create_input, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['virtual_network_create_input'] is not None: - _body_params = _params['virtual_network_create_input'] + if virtual_network_create_input is not None: + _body_params = virtual_network_create_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '201': "VirtualNetwork", - '401': "Error", - '403': "Error", - '404': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{id}/virtual-networks', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/projects/{id}/virtual-networks', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def delete_virtual_network(self, id : Annotated[StrictStr, Field(..., description="Virtual Network UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> VirtualNetwork: # noqa: E501 - """Delete a virtual network # noqa: E501 - Deletes a virtual network. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def delete_virtual_network( + self, + id: Annotated[StrictStr, Field(description="Virtual Network UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VirtualNetwork: + """Delete a virtual network - >>> thread = api.delete_virtual_network(id, include, exclude, async_req=True) - >>> result = thread.get() + Deletes a virtual network. :param id: Virtual Network UUID (required) :type id: str @@ -241,32 +401,78 @@ def delete_virtual_network(self, id : Annotated[StrictStr, Field(..., descriptio :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: VirtualNetwork - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the delete_virtual_network_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.delete_virtual_network_with_http_info(id, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def delete_virtual_network_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Virtual Network UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Delete a virtual network # noqa: E501 - - Deletes a virtual network. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_virtual_network_with_http_info(id, include, exclude, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._delete_virtual_network_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "VirtualNetwork", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_virtual_network_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Virtual Network UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VirtualNetwork]: + """Delete a virtual network + + Deletes a virtual network. :param id: Virtual Network UUID (required) :type id: str @@ -274,127 +480,226 @@ def delete_virtual_network_with_http_info(self, id : Annotated[StrictStr, Field( :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(VirtualNetwork, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._delete_virtual_network_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "VirtualNetwork", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + @validate_call + def delete_virtual_network_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Virtual Network UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete a virtual network + + Deletes a virtual network. + + :param id: Virtual Network UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_virtual_network_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_virtual_network" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "VirtualNetwork", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _delete_virtual_network_serialize( + self, + id, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "VirtualNetwork", - '401': "Error", - '403': "Error", - '404': "Error", - '422': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/virtual-networks/{id}', 'DELETE', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='DELETE', + resource_path='/virtual-networks/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_virtual_networks(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, facility : Annotated[Optional[StrictStr], Field(description="Filter by Facility ID (uuid) or Facility Code")] = None, metro : Annotated[Optional[StrictStr], Field(description="Filter by Metro ID (uuid) or Metro Code")] = None, **kwargs) -> VirtualNetworkList: # noqa: E501 - """Retrieve all virtual networks # noqa: E501 - Provides a list of virtual networks for a single project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_virtual_networks( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + facility: Annotated[Optional[StrictStr], Field(description="Filter by Facility ID (uuid) or Facility Code")] = None, + metro: Annotated[Optional[StrictStr], Field(description="Filter by Metro ID (uuid) or Metro Code")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VirtualNetworkList: + """Retrieve all virtual networks - >>> thread = api.find_virtual_networks(id, include, exclude, facility, metro, async_req=True) - >>> result = thread.get() + Provides a list of virtual networks for a single project. :param id: Project UUID (required) :type id: str @@ -406,32 +711,81 @@ def find_virtual_networks(self, id : Annotated[StrictStr, Field(..., description :type facility: str :param metro: Filter by Metro ID (uuid) or Metro Code :type metro: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: VirtualNetworkList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_virtual_networks_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_virtual_networks_with_http_info(id, include, exclude, facility, metro, **kwargs) # noqa: E501 - - @validate_arguments - def find_virtual_networks_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, facility : Annotated[Optional[StrictStr], Field(description="Filter by Facility ID (uuid) or Facility Code")] = None, metro : Annotated[Optional[StrictStr], Field(description="Filter by Metro ID (uuid) or Metro Code")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve all virtual networks # noqa: E501 - - Provides a list of virtual networks for a single project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_virtual_networks_with_http_info(id, include, exclude, facility, metro, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_virtual_networks_serialize( + id=id, + include=include, + exclude=exclude, + facility=facility, + metro=metro, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "VirtualNetworkList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_virtual_networks_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + facility: Annotated[Optional[StrictStr], Field(description="Filter by Facility ID (uuid) or Facility Code")] = None, + metro: Annotated[Optional[StrictStr], Field(description="Filter by Metro ID (uuid) or Metro Code")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VirtualNetworkList]: + """Retrieve all virtual networks + + Provides a list of virtual networks for a single project. :param id: Project UUID (required) :type id: str @@ -443,134 +797,242 @@ def find_virtual_networks_with_http_info(self, id : Annotated[StrictStr, Field(. :type facility: str :param metro: Filter by Metro ID (uuid) or Metro Code :type metro: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(VirtualNetworkList, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'id', - 'include', - 'exclude', - 'facility', - 'metro' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] + """ # noqa: E501 + + _param = self._find_virtual_networks_serialize( + id=id, + include=include, + exclude=exclude, + facility=facility, + metro=metro, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_virtual_networks" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} + _response_types_map: Dict[str, Optional[str]] = { + '200': "VirtualNetworkList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + @validate_call + def find_virtual_networks_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + facility: Annotated[Optional[StrictStr], Field(description="Filter by Facility ID (uuid) or Facility Code")] = None, + metro: Annotated[Optional[StrictStr], Field(description="Filter by Metro ID (uuid) or Metro Code")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all virtual networks - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + Provides a list of virtual networks for a single project. - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + :param id: Project UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param facility: Filter by Facility ID (uuid) or Facility Code + :type facility: str + :param metro: Filter by Metro ID (uuid) or Metro Code + :type metro: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_virtual_networks_serialize( + id=id, + include=include, + exclude=exclude, + facility=facility, + metro=metro, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - if _params.get('facility') is not None: # noqa: E501 - _query_params.append(('facility', _params['facility'])) + _response_types_map: Dict[str, Optional[str]] = { + '200': "VirtualNetworkList", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _find_virtual_networks_serialize( + self, + id, + include, + exclude, + facility, + metro, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('metro') is not None: # noqa: E501 - _query_params.append(('metro', _params['metro'])) + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + + if facility is not None: + + _query_params.append(('facility', facility)) + + if metro is not None: + + _query_params.append(('metro', metro)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "VirtualNetworkList", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{id}/virtual-networks', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/projects/{id}/virtual-networks', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def get_virtual_network(self, id : Annotated[StrictStr, Field(..., description="Virtual Network UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> VirtualNetwork: # noqa: E501 - """Get a virtual network # noqa: E501 - Get a virtual network. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def get_virtual_network( + self, + id: Annotated[StrictStr, Field(description="Virtual Network UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VirtualNetwork: + """Get a virtual network - >>> thread = api.get_virtual_network(id, include, exclude, async_req=True) - >>> result = thread.get() + Get a virtual network. :param id: Virtual Network UUID (required) :type id: str @@ -578,32 +1040,78 @@ def get_virtual_network(self, id : Annotated[StrictStr, Field(..., description=" :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: VirtualNetwork - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the get_virtual_network_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.get_virtual_network_with_http_info(id, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def get_virtual_network_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Virtual Network UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Get a virtual network # noqa: E501 - - Get a virtual network. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.get_virtual_network_with_http_info(id, include, exclude, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._get_virtual_network_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "VirtualNetwork", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_virtual_network_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Virtual Network UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VirtualNetwork]: + """Get a virtual network + + Get a virtual network. :param id: Virtual Network UUID (required) :type id: str @@ -611,113 +1119,199 @@ def get_virtual_network_with_http_info(self, id : Annotated[StrictStr, Field(... :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(VirtualNetwork, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._get_virtual_network_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "VirtualNetwork", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' + + @validate_call + def get_virtual_network_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Virtual Network UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get a virtual network + + Get a virtual network. + + :param id: Virtual Network UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_virtual_network_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_virtual_network" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "VirtualNetwork", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _get_virtual_network_serialize( + self, + id, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "VirtualNetwork", - '401': "Error", - '403': "Error", - '404': "Error", - '422': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/virtual-networks/{id}', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/virtual-networks/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api/vrfs_api.py b/equinix_metal/equinix_metal/api/vrfs_api.py index 750d4730..98fd38fd 100644 --- a/equinix_metal/equinix_metal/api/vrfs_api.py +++ b/equinix_metal/equinix_metal/api/vrfs_api.py @@ -12,18 +12,14 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictStr, conlist - -from typing import Optional - +from pydantic import Field, StrictStr +from typing import List, Optional +from typing_extensions import Annotated from equinix_metal.models.bgp_dynamic_neighbor import BgpDynamicNeighbor from equinix_metal.models.bgp_dynamic_neighbor_create_input import BgpDynamicNeighborCreateInput from equinix_metal.models.bgp_dynamic_neighbor_list import BgpDynamicNeighborList @@ -38,36 +34,121 @@ from equinix_metal.models.vrf_route_update_input import VrfRouteUpdateInput from equinix_metal.models.vrf_update_input import VrfUpdateInput -from equinix_metal.api_client import ApiClient +from equinix_metal.api_client import ApiClient, RequestSerialized from equinix_metal.api_response import ApiResponse -from equinix_metal.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from equinix_metal.rest import RESTResponseType -class VRFsApi(object): +class VRFsApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def bgp_dynamic_neighbors_id_get( + self, + id: Annotated[StrictStr, Field(description="BGP Dynamic Neighbor UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> BgpDynamicNeighbor: + """Retrieve a BGP Dynamic Neighbor - @validate_arguments - def bgp_dynamic_neighbors_id_get(self, id : Annotated[StrictStr, Field(..., description="BGP Dynamic Neighbor UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> BgpDynamicNeighbor: # noqa: E501 - """Retrieve a BGP Dynamic Neighbor # noqa: E501 + Return a single BGP Dynamic Neighbor resource + + :param id: BGP Dynamic Neighbor UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._bgp_dynamic_neighbors_id_get_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Return a single BGP Dynamic Neighbor resource # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "BgpDynamicNeighbor", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def bgp_dynamic_neighbors_id_get_with_http_info( + self, + id: Annotated[StrictStr, Field(description="BGP Dynamic Neighbor UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[BgpDynamicNeighbor]: + """Retrieve a BGP Dynamic Neighbor - >>> thread = api.bgp_dynamic_neighbors_id_get(id, include, exclude, async_req=True) - >>> result = thread.get() + Return a single BGP Dynamic Neighbor resource :param id: BGP Dynamic Neighbor UUID (required) :type id: str @@ -75,32 +156,76 @@ def bgp_dynamic_neighbors_id_get(self, id : Annotated[StrictStr, Field(..., desc :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: BgpDynamicNeighbor - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the bgp_dynamic_neighbors_id_get_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.bgp_dynamic_neighbors_id_get_with_http_info(id, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def bgp_dynamic_neighbors_id_get_with_http_info(self, id : Annotated[StrictStr, Field(..., description="BGP Dynamic Neighbor UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve a BGP Dynamic Neighbor # noqa: E501 - - Return a single BGP Dynamic Neighbor resource # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.bgp_dynamic_neighbors_id_get_with_http_info(id, include, exclude, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._bgp_dynamic_neighbors_id_get_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BgpDynamicNeighbor", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def bgp_dynamic_neighbors_id_get_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="BGP Dynamic Neighbor UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve a BGP Dynamic Neighbor + + Return a single BGP Dynamic Neighbor resource :param id: BGP Dynamic Neighbor UUID (required) :type id: str @@ -108,125 +233,144 @@ def bgp_dynamic_neighbors_id_get_with_http_info(self, id : Annotated[StrictStr, :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(BgpDynamicNeighbor, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() + """ # noqa: E501 + + _param = self._bgp_dynamic_neighbors_id_get_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _all_params = [ - 'id', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method bgp_dynamic_neighbors_id_get" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "BgpDynamicNeighbor", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _bgp_dynamic_neighbors_id_get_serialize( + self, + id, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "BgpDynamicNeighbor", - '401': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/bgp-dynamic-neighbors/{id}', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/bgp-dynamic-neighbors/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def create_bgp_dynamic_neighbor(self, id : Annotated[StrictStr, Field(..., description="Metal Gateway UUID")], bgp_dynamic_neighbor_create_input : BgpDynamicNeighborCreateInput, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> BgpDynamicNeighbor: # noqa: E501 - """Create a VRF BGP Dynamic Neighbor range # noqa: E501 - Create a VRF BGP Dynamic Neighbor range. BGP Dynamic Neighbor records are limited to 2 per Virtual Network. Notice: VRFs are a test feature currently under active development, and only available to certain users. Please contact Customer Success for more information. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def create_bgp_dynamic_neighbor( + self, + id: Annotated[StrictStr, Field(description="Metal Gateway UUID")], + bgp_dynamic_neighbor_create_input: BgpDynamicNeighborCreateInput, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> BgpDynamicNeighbor: + """Create a VRF BGP Dynamic Neighbor range - >>> thread = api.create_bgp_dynamic_neighbor(id, bgp_dynamic_neighbor_create_input, include, exclude, async_req=True) - >>> result = thread.get() + Create a VRF BGP Dynamic Neighbor range. BGP Dynamic Neighbor records are limited to 2 per Virtual Network. Notice: VRFs are a test feature currently under active development, and only available to certain users. Please contact Customer Success for more information. :param id: Metal Gateway UUID (required) :type id: str @@ -236,32 +380,80 @@ def create_bgp_dynamic_neighbor(self, id : Annotated[StrictStr, Field(..., descr :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: BgpDynamicNeighbor - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the create_bgp_dynamic_neighbor_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.create_bgp_dynamic_neighbor_with_http_info(id, bgp_dynamic_neighbor_create_input, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def create_bgp_dynamic_neighbor_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Metal Gateway UUID")], bgp_dynamic_neighbor_create_input : BgpDynamicNeighborCreateInput, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Create a VRF BGP Dynamic Neighbor range # noqa: E501 - - Create a VRF BGP Dynamic Neighbor range. BGP Dynamic Neighbor records are limited to 2 per Virtual Network. Notice: VRFs are a test feature currently under active development, and only available to certain users. Please contact Customer Success for more information. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_bgp_dynamic_neighbor_with_http_info(id, bgp_dynamic_neighbor_create_input, include, exclude, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._create_bgp_dynamic_neighbor_serialize( + id=id, + bgp_dynamic_neighbor_create_input=bgp_dynamic_neighbor_create_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "BgpDynamicNeighbor", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_bgp_dynamic_neighbor_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Metal Gateway UUID")], + bgp_dynamic_neighbor_create_input: BgpDynamicNeighborCreateInput, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[BgpDynamicNeighbor]: + """Create a VRF BGP Dynamic Neighbor range + + Create a VRF BGP Dynamic Neighbor range. BGP Dynamic Neighbor records are limited to 2 per Virtual Network. Notice: VRFs are a test feature currently under active development, and only available to certain users. Please contact Customer Success for more information. :param id: Metal Gateway UUID (required) :type id: str @@ -271,138 +463,246 @@ def create_bgp_dynamic_neighbor_with_http_info(self, id : Annotated[StrictStr, F :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(BgpDynamicNeighbor, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'id', - 'bgp_dynamic_neighbor_create_input', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_bgp_dynamic_neighbor" % _key - ) - _params[_key] = _val - del _params['kwargs'] + """ # noqa: E501 + + _param = self._create_bgp_dynamic_neighbor_serialize( + id=id, + bgp_dynamic_neighbor_create_input=bgp_dynamic_neighbor_create_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "BgpDynamicNeighbor", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + @validate_call + def create_bgp_dynamic_neighbor_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Metal Gateway UUID")], + bgp_dynamic_neighbor_create_input: BgpDynamicNeighborCreateInput, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a VRF BGP Dynamic Neighbor range + Create a VRF BGP Dynamic Neighbor range. BGP Dynamic Neighbor records are limited to 2 per Virtual Network. Notice: VRFs are a test feature currently under active development, and only available to certain users. Please contact Customer Success for more information. - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + :param id: Metal Gateway UUID (required) + :type id: str + :param bgp_dynamic_neighbor_create_input: (required) + :type bgp_dynamic_neighbor_create_input: BgpDynamicNeighborCreateInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_bgp_dynamic_neighbor_serialize( + id=id, + bgp_dynamic_neighbor_create_input=bgp_dynamic_neighbor_create_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "BgpDynamicNeighbor", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_bgp_dynamic_neighbor_serialize( + self, + id, + bgp_dynamic_neighbor_create_input, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['bgp_dynamic_neighbor_create_input'] is not None: - _body_params = _params['bgp_dynamic_neighbor_create_input'] + if bgp_dynamic_neighbor_create_input is not None: + _body_params = bgp_dynamic_neighbor_create_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '201': "BgpDynamicNeighbor", - '401': "Error", - '403': "Error", - '404': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/metal-gateways/{id}/bgp-dynamic-neighbors', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/metal-gateways/{id}/bgp-dynamic-neighbors', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def create_vrf(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], vrf_create_input : Annotated[VrfCreateInput, Field(..., description="VRF to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> Vrf: # noqa: E501 - """Create a new VRF in the specified project # noqa: E501 - Creates a new VRF in the specified project # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def create_vrf( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + vrf_create_input: Annotated[VrfCreateInput, Field(description="VRF to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Vrf: + """Create a new VRF in the specified project - >>> thread = api.create_vrf(id, vrf_create_input, include, exclude, async_req=True) - >>> result = thread.get() + Creates a new VRF in the specified project :param id: Project UUID (required) :type id: str @@ -412,32 +712,79 @@ def create_vrf(self, id : Annotated[StrictStr, Field(..., description="Project U :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Vrf - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the create_vrf_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.create_vrf_with_http_info(id, vrf_create_input, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def create_vrf_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], vrf_create_input : Annotated[VrfCreateInput, Field(..., description="VRF to create")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Create a new VRF in the specified project # noqa: E501 - - Creates a new VRF in the specified project # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_vrf_with_http_info(id, vrf_create_input, include, exclude, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._create_vrf_serialize( + id=id, + vrf_create_input=vrf_create_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "Vrf", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_vrf_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + vrf_create_input: Annotated[VrfCreateInput, Field(description="VRF to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Vrf]: + """Create a new VRF in the specified project + + Creates a new VRF in the specified project :param id: Project UUID (required) :type id: str @@ -447,137 +794,244 @@ def create_vrf_with_http_info(self, id : Annotated[StrictStr, Field(..., descrip :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Vrf, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'id', - 'vrf_create_input', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_vrf" % _key - ) - _params[_key] = _val - del _params['kwargs'] + """ # noqa: E501 + + _param = self._create_vrf_serialize( + id=id, + vrf_create_input=vrf_create_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "Vrf", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + @validate_call + def create_vrf_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + vrf_create_input: Annotated[VrfCreateInput, Field(description="VRF to create")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a new VRF in the specified project + Creates a new VRF in the specified project - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + :param id: Project UUID (required) + :type id: str + :param vrf_create_input: VRF to create (required) + :type vrf_create_input: VrfCreateInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_vrf_serialize( + id=id, + vrf_create_input=vrf_create_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _response_types_map: Dict[str, Optional[str]] = { + '201': "Vrf", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_vrf_serialize( + self, + id, + vrf_create_input, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['vrf_create_input'] is not None: - _body_params = _params['vrf_create_input'] + if vrf_create_input is not None: + _body_params = vrf_create_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '201': "Vrf", - '403': "Error", - '404': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{id}/vrfs', 'POST', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='POST', + resource_path='/projects/{id}/vrfs', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def create_vrf_route(self, id : Annotated[StrictStr, Field(..., description="VRF UUID")], vrf_route_create_input : VrfRouteCreateInput, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> VrfRoute: # noqa: E501 - """Create a VRF route # noqa: E501 - Create a route in a VRF. Currently only static default routes are supported. Notice: VRFs are a test feature currently under active development, and only available to certain users. Please contact Customer Success for more information. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def create_vrf_route( + self, + id: Annotated[StrictStr, Field(description="VRF UUID")], + vrf_route_create_input: VrfRouteCreateInput, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VrfRoute: + """Create a VRF route - >>> thread = api.create_vrf_route(id, vrf_route_create_input, include, exclude, async_req=True) - >>> result = thread.get() + Create a route in a VRF. Currently only static default routes are supported. Notice: VRFs are a test feature currently under active development, and only available to certain users. Please contact Customer Success for more information. :param id: VRF UUID (required) :type id: str @@ -587,32 +1041,80 @@ def create_vrf_route(self, id : Annotated[StrictStr, Field(..., description="VRF :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: VrfRoute - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the create_vrf_route_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.create_vrf_route_with_http_info(id, vrf_route_create_input, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def create_vrf_route_with_http_info(self, id : Annotated[StrictStr, Field(..., description="VRF UUID")], vrf_route_create_input : VrfRouteCreateInput, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Create a VRF route # noqa: E501 - - Create a route in a VRF. Currently only static default routes are supported. Notice: VRFs are a test feature currently under active development, and only available to certain users. Please contact Customer Success for more information. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_vrf_route_with_http_info(id, vrf_route_create_input, include, exclude, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._create_vrf_route_serialize( + id=id, + vrf_route_create_input=vrf_route_create_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "VrfRoute", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_vrf_route_with_http_info( + self, + id: Annotated[StrictStr, Field(description="VRF UUID")], + vrf_route_create_input: VrfRouteCreateInput, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VrfRoute]: + """Create a VRF route + + Create a route in a VRF. Currently only static default routes are supported. Notice: VRFs are a test feature currently under active development, and only available to certain users. Please contact Customer Success for more information. :param id: VRF UUID (required) :type id: str @@ -622,138 +1124,245 @@ def create_vrf_route_with_http_info(self, id : Annotated[StrictStr, Field(..., d :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(VrfRoute, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'id', - 'vrf_route_create_input', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_vrf_route" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] - - - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' - - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' - - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params['vrf_route_create_input'] is not None: - _body_params = _params['vrf_route_create_input'] - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list - - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 + """ # noqa: E501 + + _param = self._create_vrf_route_serialize( + id=id, + vrf_route_create_input=vrf_route_create_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _response_types_map = { + _response_types_map: Dict[str, Optional[str]] = { '200': "VrfRoute", '401': "Error", '403': "Error", '404': "Error", '422': "Error", } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - return self.api_client.call_api( - '/vrfs/{id}/routes', 'POST', - _path_params, - _query_params, - _header_params, + + @validate_call + def create_vrf_route_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="VRF UUID")], + vrf_route_create_input: VrfRouteCreateInput, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a VRF route + + Create a route in a VRF. Currently only static default routes are supported. Notice: VRFs are a test feature currently under active development, and only available to certain users. Please contact Customer Success for more information. + + :param id: VRF UUID (required) + :type id: str + :param vrf_route_create_input: (required) + :type vrf_route_create_input: VrfRouteCreateInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_vrf_route_serialize( + id=id, + vrf_route_create_input=vrf_route_create_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "VrfRoute", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_vrf_route_serialize( + self, + id, + vrf_route_create_input, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + + # process the header parameters + # process the form parameters + # process the body parameter + if vrf_route_create_input is not None: + _body_params = vrf_route_create_input + + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/vrfs/{id}/routes', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def delete_bgp_dynamic_neighbor_by_id(self, id : Annotated[StrictStr, Field(..., description="BGP Dynamic Neighbor UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> BgpDynamicNeighbor: # noqa: E501 - """Delete a VRF BGP Dynamic Neighbor # noqa: E501 - Trigger the removal of a BGP Neighbor range from a VRF # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def delete_bgp_dynamic_neighbor_by_id( + self, + id: Annotated[StrictStr, Field(description="BGP Dynamic Neighbor UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> BgpDynamicNeighbor: + """Delete a VRF BGP Dynamic Neighbor - >>> thread = api.delete_bgp_dynamic_neighbor_by_id(id, include, exclude, async_req=True) - >>> result = thread.get() + Trigger the removal of a BGP Neighbor range from a VRF :param id: BGP Dynamic Neighbor UUID (required) :type id: str @@ -761,32 +1370,77 @@ def delete_bgp_dynamic_neighbor_by_id(self, id : Annotated[StrictStr, Field(..., :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: BgpDynamicNeighbor - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the delete_bgp_dynamic_neighbor_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.delete_bgp_dynamic_neighbor_by_id_with_http_info(id, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def delete_bgp_dynamic_neighbor_by_id_with_http_info(self, id : Annotated[StrictStr, Field(..., description="BGP Dynamic Neighbor UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Delete a VRF BGP Dynamic Neighbor # noqa: E501 - - Trigger the removal of a BGP Neighbor range from a VRF # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_bgp_dynamic_neighbor_by_id_with_http_info(id, include, exclude, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._delete_bgp_dynamic_neighbor_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': "BgpDynamicNeighbor", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_bgp_dynamic_neighbor_by_id_with_http_info( + self, + id: Annotated[StrictStr, Field(description="BGP Dynamic Neighbor UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[BgpDynamicNeighbor]: + """Delete a VRF BGP Dynamic Neighbor + + Trigger the removal of a BGP Neighbor range from a VRF :param id: BGP Dynamic Neighbor UUID (required) :type id: str @@ -794,263 +1448,487 @@ def delete_bgp_dynamic_neighbor_by_id_with_http_info(self, id : Annotated[Strict :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(BgpDynamicNeighbor, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._delete_bgp_dynamic_neighbor_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '202': "BgpDynamicNeighbor", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_bgp_dynamic_neighbor_by_id" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + @validate_call + def delete_bgp_dynamic_neighbor_by_id_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="BGP Dynamic Neighbor UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete a VRF BGP Dynamic Neighbor - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + Trigger the removal of a BGP Neighbor range from a VRF + :param id: BGP Dynamic Neighbor UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_bgp_dynamic_neighbor_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': "BgpDynamicNeighbor", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + def _delete_bgp_dynamic_neighbor_by_id_serialize( + self, + id, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '202': "BgpDynamicNeighbor", - '401': "Error", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/bgp-dynamic-neighbors/{id}', 'DELETE', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='DELETE', + resource_path='/bgp-dynamic-neighbors/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def delete_vrf(self, id : Annotated[StrictStr, Field(..., description="VRF UUID")], **kwargs) -> None: # noqa: E501 - """Delete the VRF # noqa: E501 - Deletes the VRF # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def delete_vrf( + self, + id: Annotated[StrictStr, Field(description="VRF UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete the VRF - >>> thread = api.delete_vrf(id, async_req=True) - >>> result = thread.get() + Deletes the VRF :param id: VRF UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the delete_vrf_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.delete_vrf_with_http_info(id, **kwargs) # noqa: E501 - - @validate_arguments - def delete_vrf_with_http_info(self, id : Annotated[StrictStr, Field(..., description="VRF UUID")], **kwargs) -> ApiResponse: # noqa: E501 - """Delete the VRF # noqa: E501 - - Deletes the VRF # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_vrf_with_http_info(id, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._delete_vrf_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_vrf_with_http_info( + self, + id: Annotated[StrictStr, Field(description="VRF UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete the VRF + + Deletes the VRF :param id: VRF UUID (required) :type id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 + + _param = self._delete_vrf_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_vrf" % _key - ) - _params[_key] = _val - del _params['kwargs'] + @validate_call + def delete_vrf_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="VRF UUID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete the VRF - _collection_formats = {} + Deletes the VRF + + :param id: VRF UUID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_vrf_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _delete_vrf_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = {} + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/vrfs/{id}', 'DELETE', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='DELETE', + resource_path='/vrfs/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def delete_vrf_route_by_id(self, id : Annotated[StrictStr, Field(..., description="VRF Route UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> VrfRoute: # noqa: E501 - """Delete a VRF Route # noqa: E501 - Trigger the deletion of a VRF Route resource. The status of the route will update to 'deleting', and the route resource will remain accessible while background operations remove the route from the network. Once the route has been removed from the network, the resource will be fully deleted. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def delete_vrf_route_by_id( + self, + id: Annotated[StrictStr, Field(description="VRF Route UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VrfRoute: + """Delete a VRF Route - >>> thread = api.delete_vrf_route_by_id(id, include, exclude, async_req=True) - >>> result = thread.get() + Trigger the deletion of a VRF Route resource. The status of the route will update to 'deleting', and the route resource will remain accessible while background operations remove the route from the network. Once the route has been removed from the network, the resource will be fully deleted. :param id: VRF Route UUID (required) :type id: str @@ -1058,32 +1936,77 @@ def delete_vrf_route_by_id(self, id : Annotated[StrictStr, Field(..., descriptio :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: VrfRoute - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the delete_vrf_route_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.delete_vrf_route_by_id_with_http_info(id, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def delete_vrf_route_by_id_with_http_info(self, id : Annotated[StrictStr, Field(..., description="VRF Route UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Delete a VRF Route # noqa: E501 - - Trigger the deletion of a VRF Route resource. The status of the route will update to 'deleting', and the route resource will remain accessible while background operations remove the route from the network. Once the route has been removed from the network, the resource will be fully deleted. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_vrf_route_by_id_with_http_info(id, include, exclude, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._delete_vrf_route_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': "VrfRoute", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_vrf_route_by_id_with_http_info( + self, + id: Annotated[StrictStr, Field(description="VRF Route UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VrfRoute]: + """Delete a VRF Route + + Trigger the deletion of a VRF Route resource. The status of the route will update to 'deleting', and the route resource will remain accessible while background operations remove the route from the network. Once the route has been removed from the network, the resource will be fully deleted. :param id: VRF Route UUID (required) :type id: str @@ -1091,645 +2014,1288 @@ def delete_vrf_route_by_id_with_http_info(self, id : Annotated[StrictStr, Field( :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(VrfRoute, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._delete_vrf_route_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '202': "VrfRoute", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_vrf_route_by_id" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + @validate_call + def delete_vrf_route_by_id_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="VRF Route UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete a VRF Route - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + Trigger the deletion of a VRF Route resource. The status of the route will update to 'deleting', and the route resource will remain accessible while background operations remove the route from the network. Once the route has been removed from the network, the resource will be fully deleted. + + :param id: VRF Route UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_vrf_route_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': "VrfRoute", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + def _delete_vrf_route_by_id_serialize( + self, + id, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 + _auth_settings: List[str] = [ + 'x_auth_token' + ] - _response_types_map = { - '202': "VrfRoute", + return self.api_client.param_serialize( + method='DELETE', + resource_path='/routes/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + @validate_call + def find_vrf_by_id( + self, + id: Annotated[StrictStr, Field(description="VRF UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Vrf: + """Retrieve a VRF + + Returns a single VRF resource + + :param id: VRF UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_vrf_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Vrf", '401': "Error", '403': "Error", '404': "Error", } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_vrf_by_id_with_http_info( + self, + id: Annotated[StrictStr, Field(description="VRF UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Vrf]: + """Retrieve a VRF + + Returns a single VRF resource + + :param id: VRF UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_vrf_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Vrf", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def find_vrf_by_id_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="VRF UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve a VRF + + Returns a single VRF resource + + :param id: VRF UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_vrf_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Vrf", + '401': "Error", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _find_vrf_by_id_serialize( + self, + id, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None - return self.api_client.call_api( - '/routes/{id}', 'DELETE', - _path_params, - _query_params, - _header_params, + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/vrfs/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_vrf_by_id(self, id : Annotated[StrictStr, Field(..., description="VRF UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> Vrf: # noqa: E501 - """Retrieve a VRF # noqa: E501 - Returns a single VRF resource # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_vrf_ip_reservation( + self, + vrf_id: Annotated[StrictStr, Field(description="VRF UUID")], + id: Annotated[StrictStr, Field(description="IP UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VrfIpReservation: + """Retrieve all VRF IP Reservations in the VRF - >>> thread = api.find_vrf_by_id(id, include, exclude, async_req=True) - >>> result = thread.get() + Returns the IP Reservation for the VRF. - :param id: VRF UUID (required) + :param vrf_id: VRF UUID (required) + :type vrf_id: str + :param id: IP UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Vrf - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_vrf_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_vrf_by_id_with_http_info(id, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def find_vrf_by_id_with_http_info(self, id : Annotated[StrictStr, Field(..., description="VRF UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve a VRF # noqa: E501 - - Returns a single VRF resource # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_vrf_by_id_with_http_info(id, include, exclude, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_vrf_ip_reservation_serialize( + vrf_id=vrf_id, + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - :param id: VRF UUID (required) + _response_types_map: Dict[str, Optional[str]] = { + '200': "VrfIpReservation", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_vrf_ip_reservation_with_http_info( + self, + vrf_id: Annotated[StrictStr, Field(description="VRF UUID")], + id: Annotated[StrictStr, Field(description="IP UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VrfIpReservation]: + """Retrieve all VRF IP Reservations in the VRF + + Returns the IP Reservation for the VRF. + + :param vrf_id: VRF UUID (required) + :type vrf_id: str + :param id: IP UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Vrf, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._find_vrf_ip_reservation_serialize( + vrf_id=vrf_id, + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _params = locals() + _response_types_map: Dict[str, Optional[str]] = { + '200': "VrfIpReservation", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _all_params = [ - 'id', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_vrf_by_id" % _key - ) - _params[_key] = _val - del _params['kwargs'] - _collection_formats = {} + @validate_call + def find_vrf_ip_reservation_without_preload_content( + self, + vrf_id: Annotated[StrictStr, Field(description="VRF UUID")], + id: Annotated[StrictStr, Field(description="IP UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all VRF IP Reservations in the VRF - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + Returns the IP Reservation for the VRF. + :param vrf_id: VRF UUID (required) + :type vrf_id: str + :param id: IP UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_vrf_ip_reservation_serialize( + vrf_id=vrf_id, + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _response_types_map: Dict[str, Optional[str]] = { + '200': "VrfIpReservation", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _find_vrf_ip_reservation_serialize( + self, + vrf_id, + id, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'multi', + 'exclude': 'multi', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if vrf_id is not None: + _path_params['vrf_id'] = vrf_id + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 + _auth_settings: List[str] = [ + 'x_auth_token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/vrfs/{vrf_id}/ips/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + @validate_call + def find_vrf_ip_reservations( + self, + id: Annotated[StrictStr, Field(description="VRF UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VrfIpReservationList: + """Retrieve all VRF IP Reservations in the VRF + + Returns the list of VRF IP Reservations for the VRF. + + :param id: VRF UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_vrf_ip_reservations_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _response_types_map = { - '200': "Vrf", - '401': "Error", + _response_types_map: Dict[str, Optional[str]] = { + '200': "VrfIpReservationList", '403': "Error", '404': "Error", } - - return self.api_client.call_api( - '/vrfs/{id}', 'GET', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - def find_vrf_ip_reservation(self, vrf_id : Annotated[StrictStr, Field(..., description="VRF UUID")], id : Annotated[StrictStr, Field(..., description="IP UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> VrfIpReservation: # noqa: E501 - """Retrieve all VRF IP Reservations in the VRF # noqa: E501 - - Returns the IP Reservation for the VRF. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + ).data + + + @validate_call + def find_vrf_ip_reservations_with_http_info( + self, + id: Annotated[StrictStr, Field(description="VRF UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VrfIpReservationList]: + """Retrieve all VRF IP Reservations in the VRF - >>> thread = api.find_vrf_ip_reservation(vrf_id, id, include, exclude, async_req=True) - >>> result = thread.get() + Returns the list of VRF IP Reservations for the VRF. - :param vrf_id: VRF UUID (required) - :type vrf_id: str - :param id: IP UUID (required) + :param id: VRF UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: VrfIpReservation - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_vrf_ip_reservation_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_vrf_ip_reservation_with_http_info(vrf_id, id, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def find_vrf_ip_reservation_with_http_info(self, vrf_id : Annotated[StrictStr, Field(..., description="VRF UUID")], id : Annotated[StrictStr, Field(..., description="IP UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve all VRF IP Reservations in the VRF # noqa: E501 - - Returns the IP Reservation for the VRF. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_vrf_ip_reservation_with_http_info(vrf_id, id, include, exclude, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_vrf_ip_reservations_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - :param vrf_id: VRF UUID (required) - :type vrf_id: str - :param id: IP UUID (required) + _response_types_map: Dict[str, Optional[str]] = { + '200': "VrfIpReservationList", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def find_vrf_ip_reservations_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="VRF UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all VRF IP Reservations in the VRF + + Returns the list of VRF IP Reservations for the VRF. + + :param id: VRF UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(VrfIpReservation, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'vrf_id', - 'id', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_vrf_ip_reservation" % _key - ) - _params[_key] = _val - del _params['kwargs'] + """ # noqa: E501 + + _param = self._find_vrf_ip_reservations_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _collection_formats = {} + _response_types_map: Dict[str, Optional[str]] = { + '200': "VrfIpReservationList", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - # process the path parameters - _path_params = {} - if _params['vrf_id']: - _path_params['vrf_id'] = _params['vrf_id'] - if _params['id']: - _path_params['id'] = _params['id'] + def _find_vrf_ip_reservations_serialize( + self, + id, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'multi' + _collection_formats: Dict[str, str] = { + 'include': 'multi', + 'exclude': 'multi', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'multi' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "VrfIpReservation", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/vrfs/{vrf_id}/ips/{id}', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/vrfs/{id}/ips', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_vrf_ip_reservations(self, id : Annotated[StrictStr, Field(..., description="VRF UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> VrfIpReservationList: # noqa: E501 - """Retrieve all VRF IP Reservations in the VRF # noqa: E501 - Returns the list of VRF IP Reservations for the VRF. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_vrf_route_by_id( + self, + id: Annotated[StrictStr, Field(description="VRF Route UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VrfRoute: + """Retrieve a VRF Route - >>> thread = api.find_vrf_ip_reservations(id, include, exclude, async_req=True) - >>> result = thread.get() + Returns a single VRF Route resource - :param id: VRF UUID (required) + :param id: VRF Route UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: VrfIpReservationList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_vrf_ip_reservations_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_vrf_ip_reservations_with_http_info(id, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def find_vrf_ip_reservations_with_http_info(self, id : Annotated[StrictStr, Field(..., description="VRF UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve all VRF IP Reservations in the VRF # noqa: E501 - - Returns the list of VRF IP Reservations for the VRF. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_vrf_ip_reservations_with_http_info(id, include, exclude, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_vrf_route_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - :param id: VRF UUID (required) + _response_types_map: Dict[str, Optional[str]] = { + '200': "VrfRoute", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_vrf_route_by_id_with_http_info( + self, + id: Annotated[StrictStr, Field(description="VRF Route UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VrfRoute]: + """Retrieve a VRF Route + + Returns a single VRF Route resource + + :param id: VRF Route UUID (required) :type id: str :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(VrfIpReservationList, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'id', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_vrf_ip_reservations" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] - - - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'multi' - - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'multi' - - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 + """ # noqa: E501 + + _param = self._find_vrf_route_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _response_types_map = { - '200': "VrfIpReservationList", - '403': "Error", + _response_types_map: Dict[str, Optional[str]] = { + '200': "VrfRoute", + '401': "Error", '404': "Error", } - - return self.api_client.call_api( - '/vrfs/{id}/ips', 'GET', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - def find_vrf_route_by_id(self, id : Annotated[StrictStr, Field(..., description="VRF Route UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> VrfRoute: # noqa: E501 - """Retrieve a VRF Route # noqa: E501 + ) - Returns a single VRF Route resource # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.find_vrf_route_by_id(id, include, exclude, async_req=True) - >>> result = thread.get() + @validate_call + def find_vrf_route_by_id_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="VRF Route UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve a VRF Route - :param id: VRF Route UUID (required) - :type id: str - :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. - :type include: List[str] - :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. - :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: VrfRoute - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_vrf_route_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_vrf_route_by_id_with_http_info(id, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def find_vrf_route_by_id_with_http_info(self, id : Annotated[StrictStr, Field(..., description="VRF Route UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve a VRF Route # noqa: E501 - - Returns a single VRF Route resource # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_vrf_route_by_id_with_http_info(id, include, exclude, async_req=True) - >>> result = thread.get() + Returns a single VRF Route resource :param id: VRF Route UUID (required) :type id: str @@ -1737,125 +3303,144 @@ def find_vrf_route_by_id_with_http_info(self, id : Annotated[StrictStr, Field(.. :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(VrfRoute, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() + """ # noqa: E501 + + _param = self._find_vrf_route_by_id_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _all_params = [ - 'id', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_vrf_route_by_id" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "VrfRoute", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _find_vrf_route_by_id_serialize( + self, + id, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "VrfRoute", - '401': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/routes/{id}', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/routes/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def find_vrfs(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, metro : Annotated[Optional[StrictStr], Field(description="Filter by Metro ID (uuid) or Metro Code")] = None, **kwargs) -> VrfList: # noqa: E501 - """Retrieve all VRFs in the project # noqa: E501 - Returns the list of VRFs for a single project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def find_vrfs( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + metro: Annotated[Optional[StrictStr], Field(description="Filter by Metro ID (uuid) or Metro Code")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VrfList: + """Retrieve all VRFs in the project - >>> thread = api.find_vrfs(id, include, exclude, metro, async_req=True) - >>> result = thread.get() + Returns the list of VRFs for a single project. :param id: Project UUID (required) :type id: str @@ -1865,32 +3450,78 @@ def find_vrfs(self, id : Annotated[StrictStr, Field(..., description="Project UU :type exclude: List[str] :param metro: Filter by Metro ID (uuid) or Metro Code :type metro: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: VrfList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the find_vrfs_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.find_vrfs_with_http_info(id, include, exclude, metro, **kwargs) # noqa: E501 - - @validate_arguments - def find_vrfs_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Project UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, metro : Annotated[Optional[StrictStr], Field(description="Filter by Metro ID (uuid) or Metro Code")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve all VRFs in the project # noqa: E501 - - Returns the list of VRFs for a single project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_vrfs_with_http_info(id, include, exclude, metro, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._find_vrfs_serialize( + id=id, + include=include, + exclude=exclude, + metro=metro, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "VrfList", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def find_vrfs_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + metro: Annotated[Optional[StrictStr], Field(description="Filter by Metro ID (uuid) or Metro Code")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VrfList]: + """Retrieve all VRFs in the project + + Returns the list of VRFs for a single project. :param id: Project UUID (required) :type id: str @@ -1900,129 +3531,307 @@ def find_vrfs_with_http_info(self, id : Annotated[StrictStr, Field(..., descript :type exclude: List[str] :param metro: Filter by Metro ID (uuid) or Metro Code :type metro: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(VrfList, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'id', - 'include', - 'exclude', - 'metro' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_vrfs" % _key - ) - _params[_key] = _val - del _params['kwargs'] + """ # noqa: E501 + + _param = self._find_vrfs_serialize( + id=id, + include=include, + exclude=exclude, + metro=metro, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "VrfList", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + @validate_call + def find_vrfs_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Project UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + metro: Annotated[Optional[StrictStr], Field(description="Filter by Metro ID (uuid) or Metro Code")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all VRFs in the project + Returns the list of VRFs for a single project. - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + :param id: Project UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param metro: Filter by Metro ID (uuid) or Metro Code + :type metro: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._find_vrfs_serialize( + id=id, + include=include, + exclude=exclude, + metro=metro, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _response_types_map: Dict[str, Optional[str]] = { + '200': "VrfList", + '403': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _find_vrfs_serialize( + self, + id, + include, + exclude, + metro, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('metro') is not None: # noqa: E501 - _query_params.append(('metro', _params['metro'])) + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + + if metro is not None: + + _query_params.append(('metro', metro)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "VrfList", - '403': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/projects/{id}/vrfs', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/projects/{id}/vrfs', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + + @validate_call + def get_bgp_dynamic_neighbors( + self, + id: Annotated[StrictStr, Field(description="Metal Gateway UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> BgpDynamicNeighborList: + """List BGP Dynamic Neighbors + + Returns the list of VRF BGP Dynamic Neighbors for this Metal Gateway - @validate_arguments - def get_bgp_dynamic_neighbors(self, id : Annotated[StrictStr, Field(..., description="Metal Gateway UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> BgpDynamicNeighborList: # noqa: E501 - """List BGP Dynamic Neighbors # noqa: E501 + :param id: Metal Gateway UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_bgp_dynamic_neighbors_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - Returns the list of VRF BGP Dynamic Neighbors for this Metal Gateway # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + '200': "BgpDynamicNeighborList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_bgp_dynamic_neighbors_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Metal Gateway UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[BgpDynamicNeighborList]: + """List BGP Dynamic Neighbors - >>> thread = api.get_bgp_dynamic_neighbors(id, include, exclude, async_req=True) - >>> result = thread.get() + Returns the list of VRF BGP Dynamic Neighbors for this Metal Gateway :param id: Metal Gateway UUID (required) :type id: str @@ -2030,32 +3839,76 @@ def get_bgp_dynamic_neighbors(self, id : Annotated[StrictStr, Field(..., descrip :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: BgpDynamicNeighborList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the get_bgp_dynamic_neighbors_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.get_bgp_dynamic_neighbors_with_http_info(id, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def get_bgp_dynamic_neighbors_with_http_info(self, id : Annotated[StrictStr, Field(..., description="Metal Gateway UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """List BGP Dynamic Neighbors # noqa: E501 - - Returns the list of VRF BGP Dynamic Neighbors for this Metal Gateway # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.get_bgp_dynamic_neighbors_with_http_info(id, include, exclude, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._get_bgp_dynamic_neighbors_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BgpDynamicNeighborList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_bgp_dynamic_neighbors_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Metal Gateway UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List BGP Dynamic Neighbors + + Returns the list of VRF BGP Dynamic Neighbors for this Metal Gateway :param id: Metal Gateway UUID (required) :type id: str @@ -2063,125 +3916,143 @@ def get_bgp_dynamic_neighbors_with_http_info(self, id : Annotated[StrictStr, Fie :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(BgpDynamicNeighborList, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() + """ # noqa: E501 + + _param = self._get_bgp_dynamic_neighbors_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) - _all_params = [ - 'id', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_bgp_dynamic_neighbors" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _response_types_map: Dict[str, Optional[str]] = { + '200': "BgpDynamicNeighborList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + def _get_bgp_dynamic_neighbors_serialize( + self, + id, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "BgpDynamicNeighborList", - '401': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/metal-gateways/{id}/bgp-dynamic-neighbors', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/metal-gateways/{id}/bgp-dynamic-neighbors', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def get_vrf_routes(self, id : Annotated[StrictStr, Field(..., description="VRF UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> VrfRouteList: # noqa: E501 - """Retrieve all routes in the VRF # noqa: E501 - Returns the list of routes for the VRF # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def get_vrf_routes( + self, + id: Annotated[StrictStr, Field(description="VRF UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VrfRouteList: + """Retrieve all routes in the VRF - >>> thread = api.get_vrf_routes(id, include, exclude, async_req=True) - >>> result = thread.get() + Returns the list of routes for the VRF :param id: VRF UUID (required) :type id: str @@ -2189,32 +4060,76 @@ def get_vrf_routes(self, id : Annotated[StrictStr, Field(..., description="VRF U :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: VrfRouteList - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the get_vrf_routes_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.get_vrf_routes_with_http_info(id, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def get_vrf_routes_with_http_info(self, id : Annotated[StrictStr, Field(..., description="VRF UUID")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Retrieve all routes in the VRF # noqa: E501 - - Returns the list of routes for the VRF # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.get_vrf_routes_with_http_info(id, include, exclude, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._get_vrf_routes_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "VrfRouteList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_vrf_routes_with_http_info( + self, + id: Annotated[StrictStr, Field(description="VRF UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VrfRouteList]: + """Retrieve all routes in the VRF + + Returns the list of routes for the VRF :param id: VRF UUID (required) :type id: str @@ -2222,125 +4137,221 @@ def get_vrf_routes_with_http_info(self, id : Annotated[StrictStr, Field(..., des :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(VrfRouteList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 + + _param = self._get_vrf_routes_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "VrfRouteList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _params = locals() - _all_params = [ - 'id', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_vrf_routes" % _key - ) - _params[_key] = _val - del _params['kwargs'] + @validate_call + def get_vrf_routes_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="VRF UUID")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all routes in the VRF - _collection_formats = {} + Returns the list of routes for the VRF - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + :param id: VRF UUID (required) + :type id: str + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_vrf_routes_serialize( + id=id, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "VrfRouteList", + '401': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + def _get_vrf_routes_serialize( + self, + id, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) - # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - _response_types_map = { - '200': "VrfRouteList", - '401': "Error", - '404': "Error", - } + # authentication setting + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/vrfs/{id}/routes', 'GET', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='GET', + resource_path='/vrfs/{id}/routes', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def update_vrf(self, id : Annotated[StrictStr, Field(..., description="VRF UUID")], vrf_update_input : Annotated[VrfUpdateInput, Field(..., description="VRF to update")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> Vrf: # noqa: E501 - """Update the VRF # noqa: E501 - Updates the VRF. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def update_vrf( + self, + id: Annotated[StrictStr, Field(description="VRF UUID")], + vrf_update_input: Annotated[VrfUpdateInput, Field(description="VRF to update")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Vrf: + """Update the VRF - >>> thread = api.update_vrf(id, vrf_update_input, include, exclude, async_req=True) - >>> result = thread.get() + Updates the VRF. :param id: VRF UUID (required) :type id: str @@ -2350,32 +4361,80 @@ def update_vrf(self, id : Annotated[StrictStr, Field(..., description="VRF UUID" :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Vrf - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the update_vrf_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.update_vrf_with_http_info(id, vrf_update_input, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def update_vrf_with_http_info(self, id : Annotated[StrictStr, Field(..., description="VRF UUID")], vrf_update_input : Annotated[VrfUpdateInput, Field(..., description="VRF to update")], include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Update the VRF # noqa: E501 - - Updates the VRF. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.update_vrf_with_http_info(id, vrf_update_input, include, exclude, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._update_vrf_serialize( + id=id, + vrf_update_input=vrf_update_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Vrf", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_vrf_with_http_info( + self, + id: Annotated[StrictStr, Field(description="VRF UUID")], + vrf_update_input: Annotated[VrfUpdateInput, Field(description="VRF to update")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Vrf]: + """Update the VRF + + Updates the VRF. :param id: VRF UUID (required) :type id: str @@ -2385,138 +4444,246 @@ def update_vrf_with_http_info(self, id : Annotated[StrictStr, Field(..., descrip :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Vrf, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'id', - 'vrf_update_input', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method update_vrf" % _key - ) - _params[_key] = _val - del _params['kwargs'] + """ # noqa: E501 + + _param = self._update_vrf_serialize( + id=id, + vrf_update_input=vrf_update_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Vrf", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + @validate_call + def update_vrf_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="VRF UUID")], + vrf_update_input: Annotated[VrfUpdateInput, Field(description="VRF to update")], + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update the VRF + Updates the VRF. - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + :param id: VRF UUID (required) + :type id: str + :param vrf_update_input: VRF to update (required) + :type vrf_update_input: VrfUpdateInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_vrf_serialize( + id=id, + vrf_update_input=vrf_update_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Vrf", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_vrf_serialize( + self, + id, + vrf_update_input, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['vrf_update_input'] is not None: - _body_params = _params['vrf_update_input'] + if vrf_update_input is not None: + _body_params = vrf_update_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '200': "Vrf", - '401': "Error", - '403': "Error", - '404': "Error", - '422': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/vrfs/{id}', 'PUT', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='PUT', + resource_path='/vrfs/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) - @validate_arguments - def update_vrf_route_by_id(self, id : Annotated[StrictStr, Field(..., description="VRF Route UUID")], vrf_route_update_input : VrfRouteUpdateInput, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> VrfRoute: # noqa: E501 - """Update a VRF Route # noqa: E501 - Requests a VRF Route be redeployed across the network. Updating the prefix or next-hop address on a route is not currently supported. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def update_vrf_route_by_id( + self, + id: Annotated[StrictStr, Field(description="VRF Route UUID")], + vrf_route_update_input: VrfRouteUpdateInput, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VrfRoute: + """Update a VRF Route - >>> thread = api.update_vrf_route_by_id(id, vrf_route_update_input, include, exclude, async_req=True) - >>> result = thread.get() + Requests a VRF Route be redeployed across the network. Updating the prefix or next-hop address on a route is not currently supported. :param id: VRF Route UUID (required) :type id: str @@ -2526,32 +4693,81 @@ def update_vrf_route_by_id(self, id : Annotated[StrictStr, Field(..., descriptio :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: VrfRoute - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the update_vrf_route_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.update_vrf_route_by_id_with_http_info(id, vrf_route_update_input, include, exclude, **kwargs) # noqa: E501 - - @validate_arguments - def update_vrf_route_by_id_with_http_info(self, id : Annotated[StrictStr, Field(..., description="VRF Route UUID")], vrf_route_update_input : VrfRouteUpdateInput, include : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, exclude : Annotated[Optional[conlist(StrictStr)], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Update a VRF Route # noqa: E501 - - Requests a VRF Route be redeployed across the network. Updating the prefix or next-hop address on a route is not currently supported. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.update_vrf_route_by_id_with_http_info(id, vrf_route_update_input, include, exclude, async_req=True) - >>> result = thread.get() + """ # noqa: E501 + + _param = self._update_vrf_route_by_id_serialize( + id=id, + vrf_route_update_input=vrf_route_update_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': "VrfRoute", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + '429': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_vrf_route_by_id_with_http_info( + self, + id: Annotated[StrictStr, Field(description="VRF Route UUID")], + vrf_route_update_input: VrfRouteUpdateInput, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VrfRoute]: + """Update a VRF Route + + Requests a VRF Route be redeployed across the network. Updating the prefix or next-hop address on a route is not currently supported. :param id: VRF Route UUID (required) :type id: str @@ -2561,125 +4777,222 @@ def update_vrf_route_by_id_with_http_info(self, id : Annotated[StrictStr, Field( :type include: List[str] :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. :type exclude: List[str] - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(VrfRoute, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'id', - 'vrf_route_update_input', - 'include', - 'exclude' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method update_vrf_route_by_id" % _key - ) - _params[_key] = _val - del _params['kwargs'] + """ # noqa: E501 + + _param = self._update_vrf_route_by_id_serialize( + id=id, + vrf_route_update_input=vrf_route_update_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': "VrfRoute", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + '429': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params['id']: - _path_params['id'] = _params['id'] + @validate_call + def update_vrf_route_by_id_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="VRF Route UUID")], + vrf_route_update_input: VrfRouteUpdateInput, + include: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects.")] = None, + exclude: Annotated[Optional[List[StrictStr]], Field(description="Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update a VRF Route + Requests a VRF Route be redeployed across the network. Updating the prefix or next-hop address on a route is not currently supported. - # process the query parameters - _query_params = [] - if _params.get('include') is not None: # noqa: E501 - _query_params.append(('include', _params['include'])) - _collection_formats['include'] = 'csv' + :param id: VRF Route UUID (required) + :type id: str + :param vrf_route_update_input: (required) + :type vrf_route_update_input: VrfRouteUpdateInput + :param include: Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. + :type include: List[str] + :param exclude: Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. + :type exclude: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_vrf_route_by_id_serialize( + id=id, + vrf_route_update_input=vrf_route_update_input, + include=include, + exclude=exclude, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': "VrfRoute", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + '429': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_vrf_route_by_id_serialize( + self, + id, + vrf_route_update_input, + include, + exclude, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'include': 'csv', + 'exclude': 'csv', + } - if _params.get('exclude') is not None: # noqa: E501 - _query_params.append(('exclude', _params['exclude'])) - _collection_formats['exclude'] = 'csv' + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include is not None: + + _query_params.append(('include', include)) + + if exclude is not None: + + _query_params.append(('exclude', exclude)) + # process the header parameters - _header_params = dict(_params.get('_headers', {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params['vrf_route_update_input'] is not None: - _body_params = _params['vrf_route_update_input'] + if vrf_route_update_input is not None: + _body_params = vrf_route_update_input + # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + [ + 'application/json' + ] + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings = ['x_auth_token'] # noqa: E501 - - _response_types_map = { - '202': "VrfRoute", - '401': "Error", - '403': "Error", - '404': "Error", - '422': "Error", - '429': "Error", - } + _auth_settings: List[str] = [ + 'x_auth_token' + ] - return self.api_client.call_api( - '/routes/{id}', 'PUT', - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method='PUT', + resource_path='/routes/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/equinix_metal/equinix_metal/api_client.py b/equinix_metal/equinix_metal/api_client.py index 3e39afd7..7400caef 100644 --- a/equinix_metal/equinix_metal/api_client.py +++ b/equinix_metal/equinix_metal/api_client.py @@ -13,26 +13,35 @@ """ # noqa: E501 -import atexit import datetime from dateutil.parser import parse +from enum import Enum import json import mimetypes -from multiprocessing.pool import ThreadPool import os import re import tempfile from urllib.parse import quote +from typing import Tuple, Optional, List, Dict from equinix_metal.configuration import Configuration -from equinix_metal.api_response import ApiResponse +from equinix_metal.api_response import ApiResponse, T as ApiResponseT import equinix_metal.models from equinix_metal import rest -from equinix_metal.exceptions import ApiValueError, ApiException - - -class ApiClient(object): +from equinix_metal.exceptions import ( + ApiValueError, + ApiException, + BadRequestException, + UnauthorizedException, + ForbiddenException, + NotFoundException, + ServiceException +) + +RequestSerialized = Tuple[str, str, Dict[str, str], Optional[str], List[str]] + +class ApiClient: """Generic API client for OpenAPI client library builds. OpenAPI generic API client. This client handles the client- @@ -46,8 +55,6 @@ class ApiClient(object): the API. :param cookie: a cookie to include in the header when making calls to the API - :param pool_threads: The number of threads to use for async requests - to the API. More threads means more concurrent API requests. """ PRIMITIVE_TYPES = (float, bool, bytes, str, int) @@ -63,13 +70,17 @@ class ApiClient(object): } _pool = None - def __init__(self, configuration=None, header_name=None, header_value=None, - cookie=None, pool_threads=1): + def __init__( + self, + configuration=None, + header_name=None, + header_value=None, + cookie=None + ) -> None: # use default configuration if none is provided if configuration is None: configuration = Configuration.get_default() self.configuration = configuration - self.pool_threads = pool_threads self.rest_client = rest.RESTClientObject(configuration) self.default_headers = {} @@ -84,25 +95,7 @@ def __enter__(self): return self def __exit__(self, exc_type, exc_value, traceback): - self.close() - - def close(self): - if self._pool: - self._pool.close() - self._pool.join() - self._pool = None - if hasattr(atexit, 'unregister'): - atexit.unregister(self.close) - - @property - def pool(self): - """Create thread pool on first request - avoids instantiating unused threadpool for blocking clients. - """ - if self._pool is None: - atexit.register(self.close) - self._pool = ThreadPool(self.pool_threads) - return self._pool + pass @property def user_agent(self): @@ -143,13 +136,42 @@ def set_default(cls, default): """ cls._default = default - def __call_api( - self, resource_path, method, path_params=None, - query_params=None, header_params=None, body=None, post_params=None, - files=None, response_types_map=None, auth_settings=None, - _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None, _host=None, - _request_auth=None): + def param_serialize( + self, + method, + resource_path, + path_params=None, + query_params=None, + header_params=None, + body=None, + post_params=None, + files=None, auth_settings=None, + collection_formats=None, + _host=None, + _request_auth=None + ) -> RequestSerialized: + + """Builds the HTTP request params needed by the request. + :param method: Method to call. + :param resource_path: Path to method endpoint. + :param path_params: Path parameters in the url. + :param query_params: Query parameters in the url. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param auth_settings list: Auth Settings names for the request. + :param files dict: key -> filename, value -> filepath, + for `multipart/form-data`. + :param collection_formats: dict of collection formats for path, query, + header, and post parameters. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :return: tuple of form (path, http_method, query_params, header_params, + body, post_params, files) + """ config = self.configuration @@ -160,14 +182,17 @@ def __call_api( header_params['Cookie'] = self.cookie if header_params: header_params = self.sanitize_for_serialization(header_params) - header_params = dict(self.parameters_to_tuples(header_params, - collection_formats)) + header_params = dict( + self.parameters_to_tuples(header_params,collection_formats) + ) # path parameters if path_params: path_params = self.sanitize_for_serialization(path_params) - path_params = self.parameters_to_tuples(path_params, - collection_formats) + path_params = self.parameters_to_tuples( + path_params, + collection_formats + ) for k, v in path_params: # specified safe chars, encode everything resource_path = resource_path.replace( @@ -179,15 +204,22 @@ def __call_api( if post_params or files: post_params = post_params if post_params else [] post_params = self.sanitize_for_serialization(post_params) - post_params = self.parameters_to_tuples(post_params, - collection_formats) + post_params = self.parameters_to_tuples( + post_params, + collection_formats + ) post_params.extend(self.files_parameters(files)) # auth setting self.update_params_for_auth( - header_params, query_params, auth_settings, - resource_path, method, body, - request_auth=_request_auth) + header_params, + query_params, + auth_settings, + resource_path, + method, + body, + request_auth=_request_auth + ) # body if body: @@ -203,56 +235,99 @@ def __call_api( # query parameters if query_params: query_params = self.sanitize_for_serialization(query_params) - url_query = self.parameters_to_url_query(query_params, - collection_formats) + url_query = self.parameters_to_url_query( + query_params, + collection_formats + ) url += "?" + url_query + return method, url, header_params, body, post_params + + + def call_api( + self, + method, + url, + header_params=None, + body=None, + post_params=None, + _request_timeout=None + ) -> rest.RESTResponse: + """Makes the HTTP request (synchronous) + :param method: Method to call. + :param url: Path to method endpoint. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param _request_timeout: timeout setting for this request. + :return: RESTResponse + """ + try: # perform request and return response - response_data = self.request( + response_data = self.rest_client.request( method, url, - query_params=query_params, headers=header_params, - post_params=post_params, body=body, - _preload_content=_preload_content, - _request_timeout=_request_timeout) + body=body, post_params=post_params, + _request_timeout=_request_timeout + ) + except ApiException as e: - if e.body: - e.body = e.body.decode('utf-8') raise e - self.last_response = response_data - - return_data = None # assuming derialization is not needed - # data needs deserialization or returns HTTP data (deserialized) only - if _preload_content or _return_http_data_only: - response_type = response_types_map.get(str(response_data.status), None) - - if response_type == "bytearray": - response_data.data = response_data.data - else: - match = None - content_type = response_data.getheader('content-type') - if content_type is not None: - match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) - encoding = match.group(1) if match else "utf-8" - response_data.data = response_data.data.decode(encoding) - - # deserialize response data - if response_type == "bytearray": - return_data = response_data.data - elif response_type: - return_data = self.deserialize(response_data, response_type) - else: - return_data = None - - if _return_http_data_only: - return return_data - else: - return ApiResponse(status_code = response_data.status, - data = return_data, - headers = response_data.getheaders(), - raw_data = response_data.data) + return response_data + + def response_deserialize( + self, + response_data: rest.RESTResponse, + response_types_map: Optional[Dict[str, ApiResponseT]]=None + ) -> ApiResponse[ApiResponseT]: + """Deserializes response into an object. + :param response_data: RESTResponse object to be deserialized. + :param response_types_map: dict of response types. + :return: ApiResponse + """ + + msg = "RESTResponse.read() must be called before passing it to response_deserialize()" + assert response_data.data is not None, msg + + response_type = response_types_map.get(str(response_data.status), None) + if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599: + # if not found, look for '1XX', '2XX', etc. + response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) + + # deserialize response data + response_text = None + return_data = None + try: + if response_type == "bytearray": + return_data = response_data.data + elif response_type == "file": + return_data = self.__deserialize_file(response_data) + elif response_type is not None: + match = None + content_type = response_data.getheader('content-type') + if content_type is not None: + match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) + encoding = match.group(1) if match else "utf-8" + response_text = response_data.data.decode(encoding) + return_data = self.deserialize(response_text, response_type) + finally: + if not 200 <= response_data.status <= 299: + raise ApiException.from_response( + http_resp=response_data, + body=response_text, + data=return_data, + ) + + return ApiResponse( + status_code = response_data.status, + data = return_data, + headers = response_data.getheaders(), + raw_data = response_data.data + ) def sanitize_for_serialization(self, obj): """Builds a JSON POST object. @@ -273,15 +348,17 @@ def sanitize_for_serialization(self, obj): elif isinstance(obj, self.PRIMITIVE_TYPES): return obj elif isinstance(obj, list): - return [self.sanitize_for_serialization(sub_obj) - for sub_obj in obj] + return [ + self.sanitize_for_serialization(sub_obj) for sub_obj in obj + ] elif isinstance(obj, tuple): - return tuple(self.sanitize_for_serialization(sub_obj) - for sub_obj in obj) + return tuple( + self.sanitize_for_serialization(sub_obj) for sub_obj in obj + ) elif isinstance(obj, (datetime.datetime, datetime.date)): return obj.isoformat() - if isinstance(obj, dict): + elif isinstance(obj, dict): obj_dict = obj else: # Convert model obj to dict except @@ -291,10 +368,12 @@ def sanitize_for_serialization(self, obj): # model definition for request. obj_dict = obj.to_dict() - return {key: self.sanitize_for_serialization(val) - for key, val in obj_dict.items()} + return { + key: self.sanitize_for_serialization(val) + for key, val in obj_dict.items() + } - def deserialize(self, response, response_type): + def deserialize(self, response_text, response_type): """Deserializes response into an object. :param response: RESTResponse object to be deserialized. @@ -303,16 +382,12 @@ def deserialize(self, response, response_type): :return: deserialized object. """ - # handle file downloading - # save response body into a tmp file and return the instance - if response_type == "file": - return self.__deserialize_file(response) # fetch data from response object try: - data = json.loads(response.data) + data = json.loads(response_text) except ValueError: - data = response.data + data = response_text return self.__deserialize(data, response_type) @@ -327,14 +402,18 @@ def __deserialize(self, data, klass): if data is None: return None - if type(klass) == str: + if isinstance(klass, str): if klass.startswith('List['): - sub_kls = re.match(r'List\[(.*)]', klass).group(1) + m = re.match(r'List\[(.*)]', klass) + assert m is not None, "Malformed List type definition" + sub_kls = m.group(1) return [self.__deserialize(sub_data, sub_kls) for sub_data in data] if klass.startswith('Dict['): - sub_kls = re.match(r'Dict\[([^,]*), (.*)]', klass).group(2) + m = re.match(r'Dict\[([^,]*), (.*)]', klass) + assert m is not None, "Malformed Dict type definition" + sub_kls = m.group(2) return {k: self.__deserialize(v, sub_kls) for k, v in data.items()} @@ -352,138 +431,11 @@ def __deserialize(self, data, klass): return self.__deserialize_date(data) elif klass == datetime.datetime: return self.__deserialize_datetime(data) + elif issubclass(klass, Enum): + return self.__deserialize_enum(data, klass) else: return self.__deserialize_model(data, klass) - def call_api(self, resource_path, method, - path_params=None, query_params=None, header_params=None, - body=None, post_params=None, files=None, - response_types_map=None, auth_settings=None, - async_req=None, _return_http_data_only=None, - collection_formats=None, _preload_content=True, - _request_timeout=None, _host=None, _request_auth=None): - """Makes the HTTP request (synchronous) and returns deserialized data. - - To make an async_req request, set the async_req parameter. - - :param resource_path: Path to method endpoint. - :param method: Method to call. - :param path_params: Path parameters in the url. - :param query_params: Query parameters in the url. - :param header_params: Header parameters to be - placed in the request header. - :param body: Request body. - :param post_params dict: Request post form parameters, - for `application/x-www-form-urlencoded`, `multipart/form-data`. - :param auth_settings list: Auth Settings names for the request. - :param response: Response data type. - :param files dict: key -> filename, value -> filepath, - for `multipart/form-data`. - :param async_req bool: execute request asynchronously - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :param collection_formats: dict of collection formats for path, query, - header, and post parameters. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_token: dict, optional - :return: - If async_req parameter is True, - the request will be called asynchronously. - The method will return the request thread. - If parameter async_req is False or missing, - then the method will return the response directly. - """ - if not async_req: - return self.__call_api(resource_path, method, - path_params, query_params, header_params, - body, post_params, files, - response_types_map, auth_settings, - _return_http_data_only, collection_formats, - _preload_content, _request_timeout, _host, - _request_auth) - - return self.pool.apply_async(self.__call_api, (resource_path, - method, path_params, - query_params, - header_params, body, - post_params, files, - response_types_map, - auth_settings, - _return_http_data_only, - collection_formats, - _preload_content, - _request_timeout, - _host, _request_auth)) - - def request(self, method, url, query_params=None, headers=None, - post_params=None, body=None, _preload_content=True, - _request_timeout=None): - """Makes the HTTP request using RESTClient.""" - if method == "GET": - return self.rest_client.get_request(url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers) - elif method == "HEAD": - return self.rest_client.head_request(url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers) - elif method == "OPTIONS": - return self.rest_client.options_request(url, - query_params=query_params, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout) - elif method == "POST": - return self.rest_client.post_request(url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - elif method == "PUT": - return self.rest_client.put_request(url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - elif method == "PATCH": - return self.rest_client.patch_request(url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - elif method == "DELETE": - return self.rest_client.delete_request(url, - query_params=query_params, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - else: - raise ApiValueError( - "http method must be `GET`, `HEAD`, `OPTIONS`," - " `POST`, `PATCH`, `PUT` or `DELETE`." - ) - def parameters_to_tuples(self, params, collection_formats): """Get parameters as list of tuples, formatting collections. @@ -491,10 +443,10 @@ def parameters_to_tuples(self, params, collection_formats): :param dict collection_formats: Parameter collection formats :return: Parameters as list of tuples, collections formatted """ - new_params = [] + new_params: List[Tuple[str, str]] = [] if collection_formats is None: collection_formats = {} - for k, v in params.items() if isinstance(params, dict) else params: # noqa: E501 + for k, v in params.items() if isinstance(params, dict) else params: if k in collection_formats: collection_format = collection_formats[k] if collection_format == 'multi': @@ -521,21 +473,21 @@ def parameters_to_url_query(self, params, collection_formats): :param dict collection_formats: Parameter collection formats :return: URL query string (e.g. a=Hello%20World&b=123) """ - new_params = [] + new_params: List[Tuple[str, str]] = [] if collection_formats is None: collection_formats = {} - for k, v in params.items() if isinstance(params, dict) else params: # noqa: E501 - if isinstance(v, (int, float)): - v = str(v) + for k, v in params.items() if isinstance(params, dict) else params: if isinstance(v, bool): v = str(v).lower() + if isinstance(v, (int, float)): + v = str(v) if isinstance(v, dict): v = json.dumps(v) if k in collection_formats: collection_format = collection_formats[k] if collection_format == 'multi': - new_params.extend((k, value) for value in v) + new_params.extend((k, str(value)) for value in v) else: if collection_format == 'ssv': delimiter = ' ' @@ -546,11 +498,12 @@ def parameters_to_url_query(self, params, collection_formats): else: # csv is the default delimiter = ',' new_params.append( - (k, delimiter.join(quote(str(value)) for value in v))) + (k, delimiter.join(quote(str(value)) for value in v)) + ) else: new_params.append((k, quote(str(v)))) - return "&".join(["=".join(item) for item in new_params]) + return "&".join(["=".join(map(str, item)) for item in new_params]) def files_parameters(self, files=None): """Builds form parameters. @@ -569,21 +522,24 @@ def files_parameters(self, files=None): with open(n, 'rb') as f: filename = os.path.basename(f.name) filedata = f.read() - mimetype = (mimetypes.guess_type(filename)[0] or - 'application/octet-stream') + mimetype = ( + mimetypes.guess_type(filename)[0] + or 'application/octet-stream' + ) params.append( - tuple([k, tuple([filename, filedata, mimetype])])) + tuple([k, tuple([filename, filedata, mimetype])]) + ) return params - def select_header_accept(self, accepts): + def select_header_accept(self, accepts: List[str]) -> Optional[str]: """Returns `Accept` based on an array of accepts provided. :param accepts: List of headers. :return: Accept (e.g. application/json). """ if not accepts: - return + return None for accept in accepts: if re.search('json', accept, re.IGNORECASE): @@ -606,9 +562,16 @@ def select_header_content_type(self, content_types): return content_types[0] - def update_params_for_auth(self, headers, queries, auth_settings, - resource_path, method, body, - request_auth=None): + def update_params_for_auth( + self, + headers, + queries, + auth_settings, + resource_path, + method, + body, + request_auth=None + ) -> None: """Updates header and query params based on authentication setting. :param headers: Header parameters dict to be updated. @@ -625,21 +588,36 @@ def update_params_for_auth(self, headers, queries, auth_settings, return if request_auth: - self._apply_auth_params(headers, queries, - resource_path, method, body, - request_auth) - return - - for auth in auth_settings: - auth_setting = self.configuration.auth_settings().get(auth) - if auth_setting: - self._apply_auth_params(headers, queries, - resource_path, method, body, - auth_setting) - - def _apply_auth_params(self, headers, queries, - resource_path, method, body, - auth_setting): + self._apply_auth_params( + headers, + queries, + resource_path, + method, + body, + request_auth + ) + else: + for auth in auth_settings: + auth_setting = self.configuration.auth_settings().get(auth) + if auth_setting: + self._apply_auth_params( + headers, + queries, + resource_path, + method, + body, + auth_setting + ) + + def _apply_auth_params( + self, + headers, + queries, + resource_path, + method, + body, + auth_setting + ) -> None: """Updates the request parameters based on a single auth_setting :param headers: Header parameters dict to be updated. @@ -668,6 +646,9 @@ def __deserialize_file(self, response): Saves response body into a file in a temporary folder, using the filename from the `Content-Disposition` header if provided. + handle file downloading + save response body into a tmp file and return the instance + :param response: RESTResponse. :return: file path. """ @@ -677,8 +658,12 @@ def __deserialize_file(self, response): content_disposition = response.getheader("Content-Disposition") if content_disposition: - filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', - content_disposition).group(1) + m = re.search( + r'filename=[\'"]?([^\'"\s]+)[\'"]?', + content_disposition + ) + assert m is not None, "Unexpected 'content-disposition' header value" + filename = m.group(1) path = os.path.join(os.path.dirname(path), filename) with open(path, "wb") as f: @@ -745,6 +730,24 @@ def __deserialize_datetime(self, string): ) ) + def __deserialize_enum(self, data, klass): + """Deserializes primitive type to enum. + + :param data: primitive type. + :param klass: class literal. + :return: enum value. + """ + try: + return klass(data) + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as `{1}`" + .format(data, klass) + ) + ) + def __deserialize_model(self, data, klass): """Deserializes list or dict to model. diff --git a/equinix_metal/equinix_metal/api_response.py b/equinix_metal/equinix_metal/api_response.py index d81c2ff5..9bc7c11f 100644 --- a/equinix_metal/equinix_metal/api_response.py +++ b/equinix_metal/equinix_metal/api_response.py @@ -1,25 +1,21 @@ """API response object.""" from __future__ import annotations -from typing import Any, Dict, Optional -from pydantic import Field, StrictInt, StrictStr +from typing import Optional, Generic, Mapping, TypeVar +from pydantic import Field, StrictInt, StrictBytes, BaseModel -class ApiResponse: +T = TypeVar("T") + +class ApiResponse(BaseModel, Generic[T]): """ API response object """ - status_code: Optional[StrictInt] = Field(None, description="HTTP status code") - headers: Optional[Dict[StrictStr, StrictStr]] = Field(None, description="HTTP headers") - data: Optional[Any] = Field(None, description="Deserialized data given the data type") - raw_data: Optional[Any] = Field(None, description="Raw data (HTTP response body)") + status_code: StrictInt = Field(description="HTTP status code") + headers: Optional[Mapping[str, str]] = Field(None, description="HTTP headers") + data: T = Field(description="Deserialized data given the data type") + raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") - def __init__(self, - status_code=None, - headers=None, - data=None, - raw_data=None): - self.status_code = status_code - self.headers = headers - self.data = data - self.raw_data = raw_data + model_config = { + "arbitrary_types_allowed": True + } diff --git a/equinix_metal/equinix_metal/configuration.py b/equinix_metal/equinix_metal/configuration.py index e90ca44b..48c6c24e 100644 --- a/equinix_metal/equinix_metal/configuration.py +++ b/equinix_metal/equinix_metal/configuration.py @@ -15,12 +15,13 @@ import copy import logging +from logging import FileHandler import multiprocessing import sys +from typing import Optional import urllib3 import http.client as httplib -from equinix_metal.exceptions import ApiValueError JSON_SCHEMA_VALIDATION_KEYWORDS = { 'multipleOf', 'maximum', 'exclusiveMaximum', @@ -28,7 +29,7 @@ 'minLength', 'pattern', 'maxItems', 'minItems' } -class Configuration(object): +class Configuration: """This class contains various settings of the API client. :param host: Base url. @@ -50,7 +51,8 @@ class Configuration(object): configuration. :param server_operation_variables: Mapping from operation ID to a mapping with string values to replace variables in templated server configuration. - The validation of enums is performed for variables with defined enum values before. + The validation of enums is performed for variables with defined enum + values before. :param ssl_ca_cert: str - the path to a file of concatenated CA certificates in PEM format. @@ -85,7 +87,7 @@ def __init__(self, host=None, server_index=None, server_variables=None, server_operation_index=None, server_operation_variables=None, ssl_ca_cert=None, - ): + ) -> None: """Constructor """ self._base_path = "https://api.equinix.com/metal/v1" if host is None else host @@ -136,7 +138,7 @@ def __init__(self, host=None, self.logger_stream_handler = None """Log stream handler """ - self.logger_file_handler = None + self.logger_file_handler: Optional[FileHandler] = None """Log file handler """ self.logger_file = None @@ -176,7 +178,7 @@ def __init__(self, host=None, cpu_count * 5 is used as default value to increase performance. """ - self.proxy = None + self.proxy: Optional[str] = None """Proxy URL """ self.proxy_headers = None diff --git a/equinix_metal/equinix_metal/exceptions.py b/equinix_metal/equinix_metal/exceptions.py index 3ea3bf44..ba5b724b 100644 --- a/equinix_metal/equinix_metal/exceptions.py +++ b/equinix_metal/equinix_metal/exceptions.py @@ -12,6 +12,8 @@ Do not edit the class manually. """ # noqa: E501 +from typing import Any, Optional +from typing_extensions import Self class OpenApiException(Exception): """The base exception class for all OpenAPIExceptions""" @@ -19,7 +21,7 @@ class OpenApiException(Exception): class ApiTypeError(OpenApiException, TypeError): def __init__(self, msg, path_to_item=None, valid_classes=None, - key_type=None): + key_type=None) -> None: """ Raises an exception for TypeErrors Args: @@ -47,7 +49,7 @@ def __init__(self, msg, path_to_item=None, valid_classes=None, class ApiValueError(OpenApiException, ValueError): - def __init__(self, msg, path_to_item=None): + def __init__(self, msg, path_to_item=None) -> None: """ Args: msg (str): the exception message @@ -65,7 +67,7 @@ def __init__(self, msg, path_to_item=None): class ApiAttributeError(OpenApiException, AttributeError): - def __init__(self, msg, path_to_item=None): + def __init__(self, msg, path_to_item=None) -> None: """ Raised when an attribute reference or assignment fails. @@ -84,7 +86,7 @@ def __init__(self, msg, path_to_item=None): class ApiKeyError(OpenApiException, KeyError): - def __init__(self, msg, path_to_item=None): + def __init__(self, msg, path_to_item=None) -> None: """ Args: msg (str): the exception message @@ -102,17 +104,56 @@ def __init__(self, msg, path_to_item=None): class ApiException(OpenApiException): - def __init__(self, status=None, reason=None, http_resp=None): + def __init__( + self, + status=None, + reason=None, + http_resp=None, + *, + body: Optional[str] = None, + data: Optional[Any] = None, + ) -> None: + self.status = status + self.reason = reason + self.body = body + self.data = data + self.headers = None + if http_resp: - self.status = http_resp.status - self.reason = http_resp.reason - self.body = http_resp.data + if self.status is None: + self.status = http_resp.status + if self.reason is None: + self.reason = http_resp.reason + if self.body is None: + try: + self.body = http_resp.data.decode('utf-8') + except Exception: + pass self.headers = http_resp.getheaders() - else: - self.status = status - self.reason = reason - self.body = None - self.headers = None + + @classmethod + def from_response( + cls, + *, + http_resp, + body: Optional[str], + data: Optional[Any], + ) -> Self: + if http_resp.status == 400: + raise BadRequestException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 401: + raise UnauthorizedException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 403: + raise ForbiddenException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 404: + raise NotFoundException(http_resp=http_resp, body=body, data=data) + + if 500 <= http_resp.status <= 599: + raise ServiceException(http_resp=http_resp, body=body, data=data) + raise ApiException(http_resp=http_resp, body=body, data=data) def __str__(self): """Custom error messages for exception""" @@ -122,38 +163,30 @@ def __str__(self): error_message += "HTTP response headers: {0}\n".format( self.headers) - if self.body: - error_message += "HTTP response body: {0}\n".format(self.body) + if self.data or self.body: + error_message += "HTTP response body: {0}\n".format(self.data or self.body) return error_message + class BadRequestException(ApiException): + pass - def __init__(self, status=None, reason=None, http_resp=None): - super(BadRequestException, self).__init__(status, reason, http_resp) class NotFoundException(ApiException): - - def __init__(self, status=None, reason=None, http_resp=None): - super(NotFoundException, self).__init__(status, reason, http_resp) + pass class UnauthorizedException(ApiException): - - def __init__(self, status=None, reason=None, http_resp=None): - super(UnauthorizedException, self).__init__(status, reason, http_resp) + pass class ForbiddenException(ApiException): - - def __init__(self, status=None, reason=None, http_resp=None): - super(ForbiddenException, self).__init__(status, reason, http_resp) + pass class ServiceException(ApiException): - - def __init__(self, status=None, reason=None, http_resp=None): - super(ServiceException, self).__init__(status, reason, http_resp) + pass def render_path(path_to_item): diff --git a/equinix_metal/equinix_metal/models/activate_hardware_reservation_request.py b/equinix_metal/equinix_metal/models/activate_hardware_reservation_request.py index 19feb13d..e4034996 100644 --- a/equinix_metal/equinix_metal/models/activate_hardware_reservation_request.py +++ b/equinix_metal/equinix_metal/models/activate_hardware_reservation_request.py @@ -18,54 +18,70 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class ActivateHardwareReservationRequest(BaseModel): """ ActivateHardwareReservationRequest - """ + """ # noqa: E501 description: Optional[StrictStr] = None href: Optional[StrictStr] = None - __properties = ["description", "href"] + __properties: ClassVar[List[str]] = ["description", "href"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> ActivateHardwareReservationRequest: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ActivateHardwareReservationRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> ActivateHardwareReservationRequest: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ActivateHardwareReservationRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ActivateHardwareReservationRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = ActivateHardwareReservationRequest.parse_obj({ + _obj = cls.model_validate({ "description": obj.get("description"), "href": obj.get("href") }) diff --git a/equinix_metal/equinix_metal/models/address.py b/equinix_metal/equinix_metal/models/address.py index f42388e2..a71ea49c 100644 --- a/equinix_metal/equinix_metal/models/address.py +++ b/equinix_metal/equinix_metal/models/address.py @@ -18,15 +18,16 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.coordinates import Coordinates +from typing import Optional, Set +from typing_extensions import Self class Address(BaseModel): """ Address - """ + """ # noqa: E501 address: Optional[StrictStr] = None address2: Optional[StrictStr] = None city: Optional[StrictStr] = None @@ -35,51 +36,66 @@ class Address(BaseModel): href: Optional[StrictStr] = None state: Optional[StrictStr] = None zip_code: Optional[StrictStr] = None - __properties = ["address", "address2", "city", "coordinates", "country", "href", "state", "zip_code"] + __properties: ClassVar[List[str]] = ["address", "address2", "city", "coordinates", "country", "href", "state", "zip_code"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> Address: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Address from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of coordinates if self.coordinates: _dict['coordinates'] = self.coordinates.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> Address: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Address from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Address.parse_obj(obj) + return cls.model_validate(obj) - _obj = Address.parse_obj({ + _obj = cls.model_validate({ "address": obj.get("address"), "address2": obj.get("address2"), "city": obj.get("city"), - "coordinates": Coordinates.from_dict(obj.get("coordinates")) if obj.get("coordinates") is not None else None, + "coordinates": Coordinates.from_dict(obj["coordinates"]) if obj.get("coordinates") is not None else None, "country": obj.get("country"), "href": obj.get("href"), "state": obj.get("state"), diff --git a/equinix_metal/equinix_metal/models/attribute.py b/equinix_metal/equinix_metal/models/attribute.py index 481d3f0f..ba2ef543 100644 --- a/equinix_metal/equinix_metal/models/attribute.py +++ b/equinix_metal/equinix_metal/models/attribute.py @@ -19,65 +19,85 @@ import json from datetime import datetime -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.attribute_data import AttributeData +from typing import Optional, Set +from typing_extensions import Self class Attribute(BaseModel): """ Attribute - """ - created_at: Optional[datetime] = Field(None, description="Datetime when the block was created.") + """ # noqa: E501 + created_at: Optional[datetime] = Field(default=None, description="Datetime when the block was created.") data: Optional[AttributeData] = None href: Optional[StrictStr] = None - namespace: Optional[StrictStr] = Field(None, description="Attribute namespace") - updated_at: Optional[datetime] = Field(None, description="Datetime when the block was updated.") - __properties = ["created_at", "data", "href", "namespace", "updated_at"] + namespace: Optional[StrictStr] = Field(default=None, description="Attribute namespace") + updated_at: Optional[datetime] = Field(default=None, description="Datetime when the block was updated.") + __properties: ClassVar[List[str]] = ["created_at", "data", "href", "namespace", "updated_at"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> Attribute: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Attribute from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - "created_at", - "namespace", - "updated_at", - }, - exclude_none=True) + 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. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "created_at", + "namespace", + "updated_at", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict['data'] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> Attribute: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Attribute from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Attribute.parse_obj(obj) + return cls.model_validate(obj) - _obj = Attribute.parse_obj({ + _obj = cls.model_validate({ "created_at": obj.get("created_at"), - "data": AttributeData.from_dict(obj.get("data")) if obj.get("data") is not None else None, + "data": AttributeData.from_dict(obj["data"]) if obj.get("data") is not None else None, "href": obj.get("href"), "namespace": obj.get("namespace"), "updated_at": obj.get("updated_at") diff --git a/equinix_metal/equinix_metal/models/attribute_data.py b/equinix_metal/equinix_metal/models/attribute_data.py index 37478766..7ccfb3c4 100644 --- a/equinix_metal/equinix_metal/models/attribute_data.py +++ b/equinix_metal/equinix_metal/models/attribute_data.py @@ -18,61 +18,81 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictBool, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class AttributeData(BaseModel): """ AttributeData - """ + """ # noqa: E501 href: Optional[StrictStr] = None - latest: Optional[StrictBool] = Field(None, description="Boolean flag to know if the firmware set is the latest for the model and vendor") - model: Optional[StrictStr] = Field(None, description="Model on which this firmware set can be applied") - plan: Optional[StrictStr] = Field(None, description="Plan where the firmware set can be applied") - vendor: Optional[StrictStr] = Field(None, description="Vendor on which this firmware set can be applied") - __properties = ["href", "latest", "model", "plan", "vendor"] + latest: Optional[StrictBool] = Field(default=None, description="Boolean flag to know if the firmware set is the latest for the model and vendor") + model: Optional[StrictStr] = Field(default=None, description="Model on which this firmware set can be applied") + plan: Optional[StrictStr] = Field(default=None, description="Plan where the firmware set can be applied") + vendor: Optional[StrictStr] = Field(default=None, description="Vendor on which this firmware set can be applied") + __properties: ClassVar[List[str]] = ["href", "latest", "model", "plan", "vendor"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> AttributeData: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of AttributeData from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - "latest", - "model", - "plan", - "vendor", - }, - exclude_none=True) + 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. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "latest", + "model", + "plan", + "vendor", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> AttributeData: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of AttributeData from a dict""" if obj is None: return None if not isinstance(obj, dict): - return AttributeData.parse_obj(obj) + return cls.model_validate(obj) - _obj = AttributeData.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), "latest": obj.get("latest"), "model": obj.get("model"), diff --git a/equinix_metal/equinix_metal/models/auth_token.py b/equinix_metal/equinix_metal/models/auth_token.py index 50834d67..406b56df 100644 --- a/equinix_metal/equinix_metal/models/auth_token.py +++ b/equinix_metal/equinix_metal/models/auth_token.py @@ -19,17 +19,19 @@ import json from datetime import datetime -from typing import Optional -from pydantic import BaseModel, Field, StrictBool, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.auth_token_project import AuthTokenProject from equinix_metal.models.auth_token_user import AuthTokenUser +from typing import Optional, Set +from typing_extensions import Self class AuthToken(BaseModel): """ AuthToken - """ + """ # noqa: E501 created_at: Optional[datetime] = None - description: Optional[StrictStr] = Field(None, description="Available only for API keys") + description: Optional[StrictStr] = Field(default=None, description="Available only for API keys") href: Optional[StrictStr] = None id: Optional[StrictStr] = None project: Optional[AuthTokenProject] = None @@ -37,32 +39,47 @@ class AuthToken(BaseModel): token: Optional[StrictStr] = None updated_at: Optional[datetime] = None user: Optional[AuthTokenUser] = None - __properties = ["created_at", "description", "href", "id", "project", "read_only", "token", "updated_at", "user"] + __properties: ClassVar[List[str]] = ["created_at", "description", "href", "id", "project", "read_only", "token", "updated_at", "user"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> AuthToken: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of AuthToken from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of project if self.project: _dict['project'] = self.project.to_dict() @@ -72,24 +89,24 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> AuthToken: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of AuthToken from a dict""" if obj is None: return None if not isinstance(obj, dict): - return AuthToken.parse_obj(obj) + return cls.model_validate(obj) - _obj = AuthToken.parse_obj({ + _obj = cls.model_validate({ "created_at": obj.get("created_at"), "description": obj.get("description"), "href": obj.get("href"), "id": obj.get("id"), - "project": AuthTokenProject.from_dict(obj.get("project")) if obj.get("project") is not None else None, + "project": AuthTokenProject.from_dict(obj["project"]) if obj.get("project") is not None else None, "read_only": obj.get("read_only"), "token": obj.get("token"), "updated_at": obj.get("updated_at"), - "user": AuthTokenUser.from_dict(obj.get("user")) if obj.get("user") is not None else None + "user": AuthTokenUser.from_dict(obj["user"]) if obj.get("user") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/auth_token_input.py b/equinix_metal/equinix_metal/models/auth_token_input.py index 3f5cc56e..adb19b1a 100644 --- a/equinix_metal/equinix_metal/models/auth_token_input.py +++ b/equinix_metal/equinix_metal/models/auth_token_input.py @@ -18,55 +18,71 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictBool, StrictStr +from pydantic import BaseModel, ConfigDict, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class AuthTokenInput(BaseModel): """ AuthTokenInput - """ + """ # noqa: E501 description: Optional[StrictStr] = None href: Optional[StrictStr] = None read_only: Optional[StrictBool] = None - __properties = ["description", "href", "read_only"] + __properties: ClassVar[List[str]] = ["description", "href", "read_only"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> AuthTokenInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of AuthTokenInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> AuthTokenInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of AuthTokenInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return AuthTokenInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = AuthTokenInput.parse_obj({ + _obj = cls.model_validate({ "description": obj.get("description"), "href": obj.get("href"), "read_only": obj.get("read_only") diff --git a/equinix_metal/equinix_metal/models/auth_token_list.py b/equinix_metal/equinix_metal/models/auth_token_list.py index ca6b212a..124f874a 100644 --- a/equinix_metal/equinix_metal/models/auth_token_list.py +++ b/equinix_metal/equinix_metal/models/auth_token_list.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.auth_token import AuthToken +from typing import Optional, Set +from typing_extensions import Self class AuthTokenList(BaseModel): """ AuthTokenList - """ - api_keys: Optional[conlist(AuthToken)] = None + """ # noqa: E501 + api_keys: Optional[List[AuthToken]] = None href: Optional[StrictStr] = None - __properties = ["api_keys", "href"] + __properties: ClassVar[List[str]] = ["api_keys", "href"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> AuthTokenList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of AuthTokenList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in api_keys (list) _items = [] if self.api_keys: @@ -65,16 +81,16 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> AuthTokenList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of AuthTokenList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return AuthTokenList.parse_obj(obj) + return cls.model_validate(obj) - _obj = AuthTokenList.parse_obj({ - "api_keys": [AuthToken.from_dict(_item) for _item in obj.get("api_keys")] if obj.get("api_keys") is not None else None, + _obj = cls.model_validate({ + "api_keys": [AuthToken.from_dict(_item) for _item in obj["api_keys"]] if obj.get("api_keys") is not None else None, "href": obj.get("href") }) return _obj diff --git a/equinix_metal/equinix_metal/models/auth_token_project.py b/equinix_metal/equinix_metal/models/auth_token_project.py index 2394f6dd..e131e08a 100644 --- a/equinix_metal/equinix_metal/models/auth_token_project.py +++ b/equinix_metal/equinix_metal/models/auth_token_project.py @@ -19,70 +19,88 @@ import json from datetime import datetime -from typing import Any, Dict, List, Optional -from pydantic import BaseModel, Field, StrictBool, StrictStr, conlist, constr, validator +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated from equinix_metal.models.href import Href +from typing import Optional, Set +from typing_extensions import Self class AuthTokenProject(BaseModel): """ AuthTokenProject - """ + """ # noqa: E501 backend_transfer_enabled: Optional[StrictBool] = None bgp_config: Optional[Href] = None created_at: Optional[datetime] = None customdata: Optional[Dict[str, Any]] = None - devices: Optional[conlist(Href)] = None + devices: Optional[List[Href]] = None href: Optional[StrictStr] = None id: Optional[StrictStr] = None - invitations: Optional[conlist(Href)] = None + invitations: Optional[List[Href]] = None max_devices: Optional[Dict[str, Any]] = None - members: Optional[conlist(Href)] = None - memberships: Optional[conlist(Href)] = None - name: Optional[constr(strict=True, max_length=80, min_length=1)] = Field(None, description="The name of the project. Cannot contain characters encoded in greater than 3 bytes such as emojis.") + members: Optional[List[Href]] = None + memberships: Optional[List[Href]] = None + name: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=80)]] = Field(default=None, description="The name of the project. Cannot contain characters encoded in greater than 3 bytes such as emojis.") network_status: Optional[Dict[str, Any]] = None organization: Optional[Href] = None payment_method: Optional[Href] = None - ssh_keys: Optional[conlist(Href)] = None - tags: Optional[conlist(StrictStr)] = None - type: Optional[StrictStr] = Field(None, description="The type of the project. Projects of type `vmce` are part of an in development feature and not available to all customers.") + ssh_keys: Optional[List[Href]] = None + tags: Optional[List[StrictStr]] = None + type: Optional[StrictStr] = Field(default=None, description="The type of the project. Projects of type `vmce` are part of an in development feature and not available to all customers.") updated_at: Optional[datetime] = None - volumes: Optional[conlist(Href)] = None - __properties = ["backend_transfer_enabled", "bgp_config", "created_at", "customdata", "devices", "href", "id", "invitations", "max_devices", "members", "memberships", "name", "network_status", "organization", "payment_method", "ssh_keys", "tags", "type", "updated_at", "volumes"] + volumes: Optional[List[Href]] = None + __properties: ClassVar[List[str]] = ["backend_transfer_enabled", "bgp_config", "created_at", "customdata", "devices", "href", "id", "invitations", "max_devices", "members", "memberships", "name", "network_status", "organization", "payment_method", "ssh_keys", "tags", "type", "updated_at", "volumes"] - @validator('type') + @field_validator('type') def type_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('default', 'vmce'): + if value not in set(['default', 'vmce']): raise ValueError("must be one of enum values ('default', 'vmce')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> AuthTokenProject: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of AuthTokenProject from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of bgp_config if self.bgp_config: _dict['bgp_config'] = self.bgp_config.to_dict() @@ -137,35 +155,35 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> AuthTokenProject: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of AuthTokenProject from a dict""" if obj is None: return None if not isinstance(obj, dict): - return AuthTokenProject.parse_obj(obj) + return cls.model_validate(obj) - _obj = AuthTokenProject.parse_obj({ + _obj = cls.model_validate({ "backend_transfer_enabled": obj.get("backend_transfer_enabled"), - "bgp_config": Href.from_dict(obj.get("bgp_config")) if obj.get("bgp_config") is not None else None, + "bgp_config": Href.from_dict(obj["bgp_config"]) if obj.get("bgp_config") is not None else None, "created_at": obj.get("created_at"), "customdata": obj.get("customdata"), - "devices": [Href.from_dict(_item) for _item in obj.get("devices")] if obj.get("devices") is not None else None, + "devices": [Href.from_dict(_item) for _item in obj["devices"]] if obj.get("devices") is not None else None, "href": obj.get("href"), "id": obj.get("id"), - "invitations": [Href.from_dict(_item) for _item in obj.get("invitations")] if obj.get("invitations") is not None else None, + "invitations": [Href.from_dict(_item) for _item in obj["invitations"]] if obj.get("invitations") is not None else None, "max_devices": obj.get("max_devices"), - "members": [Href.from_dict(_item) for _item in obj.get("members")] if obj.get("members") is not None else None, - "memberships": [Href.from_dict(_item) for _item in obj.get("memberships")] if obj.get("memberships") is not None else None, + "members": [Href.from_dict(_item) for _item in obj["members"]] if obj.get("members") is not None else None, + "memberships": [Href.from_dict(_item) for _item in obj["memberships"]] if obj.get("memberships") is not None else None, "name": obj.get("name"), "network_status": obj.get("network_status"), - "organization": Href.from_dict(obj.get("organization")) if obj.get("organization") is not None else None, - "payment_method": Href.from_dict(obj.get("payment_method")) if obj.get("payment_method") is not None else None, - "ssh_keys": [Href.from_dict(_item) for _item in obj.get("ssh_keys")] if obj.get("ssh_keys") is not None else None, + "organization": Href.from_dict(obj["organization"]) if obj.get("organization") is not None else None, + "payment_method": Href.from_dict(obj["payment_method"]) if obj.get("payment_method") is not None else None, + "ssh_keys": [Href.from_dict(_item) for _item in obj["ssh_keys"]] if obj.get("ssh_keys") is not None else None, "tags": obj.get("tags"), "type": obj.get("type"), "updated_at": obj.get("updated_at"), - "volumes": [Href.from_dict(_item) for _item in obj.get("volumes")] if obj.get("volumes") is not None else None + "volumes": [Href.from_dict(_item) for _item in obj["volumes"]] if obj.get("volumes") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/auth_token_user.py b/equinix_metal/equinix_metal/models/auth_token_user.py index c5e382ca..73c5cd82 100644 --- a/equinix_metal/equinix_metal/models/auth_token_user.py +++ b/equinix_metal/equinix_metal/models/auth_token_user.py @@ -19,14 +19,16 @@ import json from datetime import datetime -from typing import Any, Dict, List, Optional -from pydantic import BaseModel, StrictInt, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.href import Href +from typing import Optional, Set +from typing_extensions import Self class AuthTokenUser(BaseModel): """ AuthTokenUser - """ + """ # noqa: E501 avatar_thumb_url: Optional[StrictStr] = None avatar_url: Optional[StrictStr] = None created_at: Optional[datetime] = None @@ -34,7 +36,7 @@ class AuthTokenUser(BaseModel): default_organization_id: Optional[StrictStr] = None default_project_id: Optional[StrictStr] = None email: Optional[StrictStr] = None - emails: Optional[conlist(Href)] = None + emails: Optional[List[Href]] = None first_name: Optional[StrictStr] = None fraud_score: Optional[StrictStr] = None full_name: Optional[StrictStr] = None @@ -49,32 +51,47 @@ class AuthTokenUser(BaseModel): timezone: Optional[StrictStr] = None two_factor_auth: Optional[StrictStr] = None updated_at: Optional[datetime] = None - __properties = ["avatar_thumb_url", "avatar_url", "created_at", "customdata", "default_organization_id", "default_project_id", "email", "emails", "first_name", "fraud_score", "full_name", "href", "id", "last_login_at", "last_name", "max_organizations", "max_projects", "phone_number", "short_id", "timezone", "two_factor_auth", "updated_at"] + __properties: ClassVar[List[str]] = ["avatar_thumb_url", "avatar_url", "created_at", "customdata", "default_organization_id", "default_project_id", "email", "emails", "first_name", "fraud_score", "full_name", "href", "id", "last_login_at", "last_name", "max_organizations", "max_projects", "phone_number", "short_id", "timezone", "two_factor_auth", "updated_at"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> AuthTokenUser: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of AuthTokenUser from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in emails (list) _items = [] if self.emails: @@ -85,15 +102,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> AuthTokenUser: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of AuthTokenUser from a dict""" if obj is None: return None if not isinstance(obj, dict): - return AuthTokenUser.parse_obj(obj) + return cls.model_validate(obj) - _obj = AuthTokenUser.parse_obj({ + _obj = cls.model_validate({ "avatar_thumb_url": obj.get("avatar_thumb_url"), "avatar_url": obj.get("avatar_url"), "created_at": obj.get("created_at"), @@ -101,7 +118,7 @@ def from_dict(cls, obj: dict) -> AuthTokenUser: "default_organization_id": obj.get("default_organization_id"), "default_project_id": obj.get("default_project_id"), "email": obj.get("email"), - "emails": [Href.from_dict(_item) for _item in obj.get("emails")] if obj.get("emails") is not None else None, + "emails": [Href.from_dict(_item) for _item in obj["emails"]] if obj.get("emails") is not None else None, "first_name": obj.get("first_name"), "fraud_score": obj.get("fraud_score"), "full_name": obj.get("full_name"), diff --git a/equinix_metal/equinix_metal/models/aws_fabric_provider.py b/equinix_metal/equinix_metal/models/aws_fabric_provider.py index b91a706d..e909fe82 100644 --- a/equinix_metal/equinix_metal/models/aws_fabric_provider.py +++ b/equinix_metal/equinix_metal/models/aws_fabric_provider.py @@ -18,63 +18,79 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr, validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class AWSFabricProvider(BaseModel): """ AWSFabricProvider - """ - account_id: StrictStr = Field(..., description="AWS Account ID") + """ # noqa: E501 + account_id: StrictStr = Field(description="AWS Account ID") href: Optional[StrictStr] = None location: Optional[StrictStr] = None - type: StrictStr = Field(...) - __properties = ["account_id", "href", "location", "type"] + type: StrictStr + __properties: ClassVar[List[str]] = ["account_id", "href", "location", "type"] - @validator('type') + @field_validator('type') def type_validate_enum(cls, value): """Validates the enum""" - if value not in ('CSP_AWS'): + if value not in set(['CSP_AWS']): raise ValueError("must be one of enum values ('CSP_AWS')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> AWSFabricProvider: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of AWSFabricProvider from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> AWSFabricProvider: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of AWSFabricProvider from a dict""" if obj is None: return None if not isinstance(obj, dict): - return AWSFabricProvider.parse_obj(obj) + return cls.model_validate(obj) - _obj = AWSFabricProvider.parse_obj({ + _obj = cls.model_validate({ "account_id": obj.get("account_id"), "href": obj.get("href"), "location": obj.get("location"), diff --git a/equinix_metal/equinix_metal/models/batch.py b/equinix_metal/equinix_metal/models/batch.py index 7c7314b4..650264e0 100644 --- a/equinix_metal/equinix_metal/models/batch.py +++ b/equinix_metal/equinix_metal/models/batch.py @@ -19,49 +19,66 @@ import json from datetime import datetime -from typing import List, Optional -from pydantic import BaseModel, StrictInt, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.href import Href +from typing import Optional, Set +from typing_extensions import Self class Batch(BaseModel): """ Batch - """ + """ # noqa: E501 created_at: Optional[datetime] = None - devices: Optional[conlist(Href)] = None - error_messages: Optional[conlist(StrictStr)] = None + devices: Optional[List[Href]] = None + error_messages: Optional[List[StrictStr]] = None href: Optional[StrictStr] = None id: Optional[StrictStr] = None project: Optional[Href] = None quantity: Optional[StrictInt] = None state: Optional[StrictStr] = None updated_at: Optional[datetime] = None - __properties = ["created_at", "devices", "error_messages", "href", "id", "project", "quantity", "state", "updated_at"] + __properties: ClassVar[List[str]] = ["created_at", "devices", "error_messages", "href", "id", "project", "quantity", "state", "updated_at"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> Batch: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Batch from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in devices (list) _items = [] if self.devices: @@ -75,21 +92,21 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> Batch: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Batch from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Batch.parse_obj(obj) + return cls.model_validate(obj) - _obj = Batch.parse_obj({ + _obj = cls.model_validate({ "created_at": obj.get("created_at"), - "devices": [Href.from_dict(_item) for _item in obj.get("devices")] if obj.get("devices") is not None else None, + "devices": [Href.from_dict(_item) for _item in obj["devices"]] if obj.get("devices") is not None else None, "error_messages": obj.get("error_messages"), "href": obj.get("href"), "id": obj.get("id"), - "project": Href.from_dict(obj.get("project")) if obj.get("project") is not None else None, + "project": Href.from_dict(obj["project"]) if obj.get("project") is not None else None, "quantity": obj.get("quantity"), "state": obj.get("state"), "updated_at": obj.get("updated_at") diff --git a/equinix_metal/equinix_metal/models/batches_list.py b/equinix_metal/equinix_metal/models/batches_list.py index 0bbaee53..967937e2 100644 --- a/equinix_metal/equinix_metal/models/batches_list.py +++ b/equinix_metal/equinix_metal/models/batches_list.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.batch import Batch +from typing import Optional, Set +from typing_extensions import Self class BatchesList(BaseModel): """ BatchesList - """ - batches: Optional[conlist(Batch)] = None + """ # noqa: E501 + batches: Optional[List[Batch]] = None href: Optional[StrictStr] = None - __properties = ["batches", "href"] + __properties: ClassVar[List[str]] = ["batches", "href"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> BatchesList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BatchesList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in batches (list) _items = [] if self.batches: @@ -65,16 +81,16 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> BatchesList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BatchesList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return BatchesList.parse_obj(obj) + return cls.model_validate(obj) - _obj = BatchesList.parse_obj({ - "batches": [Batch.from_dict(_item) for _item in obj.get("batches")] if obj.get("batches") is not None else None, + _obj = cls.model_validate({ + "batches": [Batch.from_dict(_item) for _item in obj["batches"]] if obj.get("batches") is not None else None, "href": obj.get("href") }) return _obj diff --git a/equinix_metal/equinix_metal/models/bgp_config.py b/equinix_metal/equinix_metal/models/bgp_config.py index be63c886..8cfcf755 100644 --- a/equinix_metal/equinix_metal/models/bgp_config.py +++ b/equinix_metal/equinix_metal/models/bgp_config.py @@ -19,75 +19,92 @@ import json from datetime import datetime -from typing import List, Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.bgp_session import BgpSession from equinix_metal.models.global_bgp_range import GlobalBgpRange from equinix_metal.models.href import Href +from typing import Optional, Set +from typing_extensions import Self class BgpConfig(BaseModel): """ BgpConfig - """ - asn: Optional[StrictInt] = Field(None, description="Autonomous System Number. ASN is required with Global BGP. With Local BGP the private ASN, 65000, is assigned.") + """ # noqa: E501 + asn: Optional[StrictInt] = Field(default=None, description="Autonomous System Number. ASN is required with Global BGP. With Local BGP the private ASN, 65000, is assigned.") created_at: Optional[datetime] = None - deployment_type: Optional[StrictStr] = Field(None, description="In a Local BGP deployment, a customer uses an internal ASN to control routes within a single Equinix Metal datacenter. This means that the routes are never advertised to the global Internet. Global BGP, on the other hand, requires a customer to have a registered ASN and IP space. ") + deployment_type: Optional[StrictStr] = Field(default=None, description="In a Local BGP deployment, a customer uses an internal ASN to control routes within a single Equinix Metal datacenter. This means that the routes are never advertised to the global Internet. Global BGP, on the other hand, requires a customer to have a registered ASN and IP space. ") href: Optional[StrictStr] = None id: Optional[StrictStr] = None - max_prefix: Optional[StrictInt] = Field(10, description="The maximum number of route filters allowed per server") - md5: Optional[StrictStr] = Field(None, description="(Optional) Password for BGP session in plaintext (not a checksum)") + max_prefix: Optional[StrictInt] = Field(default=10, description="The maximum number of route filters allowed per server") + md5: Optional[StrictStr] = Field(default=None, description="(Optional) Password for BGP session in plaintext (not a checksum)") project: Optional[Href] = None - ranges: Optional[conlist(GlobalBgpRange)] = Field(None, description="The IP block ranges associated to the ASN (Populated in Global BGP only)") + ranges: Optional[List[GlobalBgpRange]] = Field(default=None, description="The IP block ranges associated to the ASN (Populated in Global BGP only)") requested_at: Optional[datetime] = None - route_object: Optional[StrictStr] = Field(None, description="Specifies AS-MACRO (aka AS-SET) to use when building client route filters") - sessions: Optional[conlist(BgpSession)] = Field(None, description="The direct connections between neighboring routers that want to exchange routing information.") - status: Optional[StrictStr] = Field(None, description="Status of the BGP Config. Status \"requested\" is valid only with the \"global\" deployment_type.") - __properties = ["asn", "created_at", "deployment_type", "href", "id", "max_prefix", "md5", "project", "ranges", "requested_at", "route_object", "sessions", "status"] + route_object: Optional[StrictStr] = Field(default=None, description="Specifies AS-MACRO (aka AS-SET) to use when building client route filters") + sessions: Optional[List[BgpSession]] = Field(default=None, description="The direct connections between neighboring routers that want to exchange routing information.") + status: Optional[StrictStr] = Field(default=None, description="Status of the BGP Config. Status \"requested\" is valid only with the \"global\" deployment_type.") + __properties: ClassVar[List[str]] = ["asn", "created_at", "deployment_type", "href", "id", "max_prefix", "md5", "project", "ranges", "requested_at", "route_object", "sessions", "status"] - @validator('deployment_type') + @field_validator('deployment_type') def deployment_type_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('global', 'local'): + if value not in set(['global', 'local']): raise ValueError("must be one of enum values ('global', 'local')") return value - @validator('status') + @field_validator('status') def status_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('requested', 'enabled', 'disabled'): + if value not in set(['requested', 'enabled', 'disabled']): raise ValueError("must be one of enum values ('requested', 'enabled', 'disabled')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> BgpConfig: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BgpConfig from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of project if self.project: _dict['project'] = self.project.to_dict() @@ -106,22 +123,22 @@ def to_dict(self): _items.append(_item.to_dict()) _dict['sessions'] = _items # set to None if md5 (nullable) is None - # and __fields_set__ contains the field - if self.md5 is None and "md5" in self.__fields_set__: + # and model_fields_set contains the field + if self.md5 is None and "md5" in self.model_fields_set: _dict['md5'] = None return _dict @classmethod - def from_dict(cls, obj: dict) -> BgpConfig: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BgpConfig from a dict""" if obj is None: return None if not isinstance(obj, dict): - return BgpConfig.parse_obj(obj) + return cls.model_validate(obj) - _obj = BgpConfig.parse_obj({ + _obj = cls.model_validate({ "asn": obj.get("asn"), "created_at": obj.get("created_at"), "deployment_type": obj.get("deployment_type"), @@ -129,11 +146,11 @@ def from_dict(cls, obj: dict) -> BgpConfig: "id": obj.get("id"), "max_prefix": obj.get("max_prefix") if obj.get("max_prefix") is not None else 10, "md5": obj.get("md5"), - "project": Href.from_dict(obj.get("project")) if obj.get("project") is not None else None, - "ranges": [GlobalBgpRange.from_dict(_item) for _item in obj.get("ranges")] if obj.get("ranges") is not None else None, + "project": Href.from_dict(obj["project"]) if obj.get("project") is not None else None, + "ranges": [GlobalBgpRange.from_dict(_item) for _item in obj["ranges"]] if obj.get("ranges") is not None else None, "requested_at": obj.get("requested_at"), "route_object": obj.get("route_object"), - "sessions": [BgpSession.from_dict(_item) for _item in obj.get("sessions")] if obj.get("sessions") is not None else None, + "sessions": [BgpSession.from_dict(_item) for _item in obj["sessions"]] if obj.get("sessions") is not None else None, "status": obj.get("status") }) return _obj diff --git a/equinix_metal/equinix_metal/models/bgp_config_request_input.py b/equinix_metal/equinix_metal/models/bgp_config_request_input.py index 3869e7c6..aa4a0deb 100644 --- a/equinix_metal/equinix_metal/models/bgp_config_request_input.py +++ b/equinix_metal/equinix_metal/models/bgp_config_request_input.py @@ -18,29 +18,31 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr, conint, constr, validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self class BgpConfigRequestInput(BaseModel): """ BgpConfigRequestInput - """ - asn: conint(strict=True, le=4294967295, ge=0) = Field(..., description="Autonomous System Number for local BGP deployment.") - deployment_type: StrictStr = Field(..., description="Wether the BGP deployment is local or global. Local deployments are configured immediately. Global deployments will need to be reviewed by Equinix Metal engineers.") + """ # noqa: E501 + asn: Annotated[int, Field(le=4294967295, strict=True, ge=0)] = Field(description="Autonomous System Number for local BGP deployment.") + deployment_type: StrictStr = Field(description="Wether the BGP deployment is local or global. Local deployments are configured immediately. Global deployments will need to be reviewed by Equinix Metal engineers.") href: Optional[StrictStr] = None - md5: Optional[constr(strict=True)] = Field(None, description="The plaintext password to share between BGP neighbors as an MD5 checksum: * must be 10-20 characters long * may not include punctuation * must be a combination of numbers and letters * must contain at least one lowercase, uppercase, and digit character ") - use_case: Optional[StrictStr] = Field(None, description="A use case explanation (necessary for global BGP request review).") - __properties = ["asn", "deployment_type", "href", "md5", "use_case"] + md5: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="The plaintext password to share between BGP neighbors as an MD5 checksum: * must be 10-20 characters long * may not include punctuation * must be a combination of numbers and letters * must contain at least one lowercase, uppercase, and digit character ") + use_case: Optional[StrictStr] = Field(default=None, description="A use case explanation (necessary for global BGP request review).") + __properties: ClassVar[List[str]] = ["asn", "deployment_type", "href", "md5", "use_case"] - @validator('deployment_type') + @field_validator('deployment_type') def deployment_type_validate_enum(cls, value): """Validates the enum""" - if value not in ('local', 'global'): + if value not in set(['local', 'global']): raise ValueError("must be one of enum values ('local', 'global')") return value - @validator('md5') + @field_validator('md5') def md5_validate_regular_expression(cls, value): """Validates the regular expression""" if value is None: @@ -50,42 +52,57 @@ def md5_validate_regular_expression(cls, value): raise ValueError(r"must validate the regular expression /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{10,20}$/") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> BgpConfigRequestInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BgpConfigRequestInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> BgpConfigRequestInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BgpConfigRequestInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return BgpConfigRequestInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = BgpConfigRequestInput.parse_obj({ + _obj = cls.model_validate({ "asn": obj.get("asn"), "deployment_type": obj.get("deployment_type"), "href": obj.get("href"), diff --git a/equinix_metal/equinix_metal/models/bgp_dynamic_neighbor.py b/equinix_metal/equinix_metal/models/bgp_dynamic_neighbor.py index 553a73a2..ec21c425 100644 --- a/equinix_metal/equinix_metal/models/bgp_dynamic_neighbor.py +++ b/equinix_metal/equinix_metal/models/bgp_dynamic_neighbor.py @@ -19,66 +19,88 @@ import json from datetime import datetime -from typing import List, Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.user_limited import UserLimited from equinix_metal.models.vrf_metal_gateway import VrfMetalGateway +from typing import Optional, Set +from typing_extensions import Self class BgpDynamicNeighbor(BaseModel): """ BgpDynamicNeighbor - """ - bgp_neighbor_asn: Optional[StrictInt] = Field(None, description="The ASN of the dynamic BGP neighbor") - bgp_neighbor_range: Optional[StrictStr] = Field(None, description="Network range of the dynamic BGP neighbor in CIDR format") + """ # noqa: E501 + bgp_neighbor_asn: Optional[StrictInt] = Field(default=None, description="The ASN of the dynamic BGP neighbor") + bgp_neighbor_range: Optional[StrictStr] = Field(default=None, description="Network range of the dynamic BGP neighbor in CIDR format") created_at: Optional[datetime] = None created_by: Optional[UserLimited] = None href: Optional[StrictStr] = None - id: Optional[StrictStr] = Field(None, description="The unique identifier for the resource") + id: Optional[StrictStr] = Field(default=None, description="The unique identifier for the resource") metal_gateway: Optional[VrfMetalGateway] = None state: Optional[StrictStr] = None - tags: Optional[conlist(StrictStr)] = None + tags: Optional[List[StrictStr]] = None updated_at: Optional[datetime] = None - __properties = ["bgp_neighbor_asn", "bgp_neighbor_range", "created_at", "created_by", "href", "id", "metal_gateway", "state", "tags", "updated_at"] + __properties: ClassVar[List[str]] = ["bgp_neighbor_asn", "bgp_neighbor_range", "created_at", "created_by", "href", "id", "metal_gateway", "state", "tags", "updated_at"] - @validator('state') + @field_validator('state') def state_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('active', 'deleting', 'pending', 'ready'): + if value not in set(['active', 'deleting', 'pending', 'ready']): raise ValueError("must be one of enum values ('active', 'deleting', 'pending', 'ready')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> BgpDynamicNeighbor: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BgpDynamicNeighbor from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - "created_at", - "href", - "id", - "state", - "updated_at", - }, - exclude_none=True) + 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. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "created_at", + "href", + "id", + "state", + "updated_at", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of created_by if self.created_by: _dict['created_by'] = self.created_by.to_dict() @@ -88,22 +110,22 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> BgpDynamicNeighbor: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BgpDynamicNeighbor from a dict""" if obj is None: return None if not isinstance(obj, dict): - return BgpDynamicNeighbor.parse_obj(obj) + return cls.model_validate(obj) - _obj = BgpDynamicNeighbor.parse_obj({ + _obj = cls.model_validate({ "bgp_neighbor_asn": obj.get("bgp_neighbor_asn"), "bgp_neighbor_range": obj.get("bgp_neighbor_range"), "created_at": obj.get("created_at"), - "created_by": UserLimited.from_dict(obj.get("created_by")) if obj.get("created_by") is not None else None, + "created_by": UserLimited.from_dict(obj["created_by"]) if obj.get("created_by") is not None else None, "href": obj.get("href"), "id": obj.get("id"), - "metal_gateway": VrfMetalGateway.from_dict(obj.get("metal_gateway")) if obj.get("metal_gateway") is not None else None, + "metal_gateway": VrfMetalGateway.from_dict(obj["metal_gateway"]) if obj.get("metal_gateway") is not None else None, "state": obj.get("state"), "tags": obj.get("tags"), "updated_at": obj.get("updated_at") diff --git a/equinix_metal/equinix_metal/models/bgp_dynamic_neighbor_create_input.py b/equinix_metal/equinix_metal/models/bgp_dynamic_neighbor_create_input.py index 8635885c..d680ca44 100644 --- a/equinix_metal/equinix_metal/models/bgp_dynamic_neighbor_create_input.py +++ b/equinix_metal/equinix_metal/models/bgp_dynamic_neighbor_create_input.py @@ -18,56 +18,72 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class BgpDynamicNeighborCreateInput(BaseModel): """ BgpDynamicNeighborCreateInput - """ - bgp_neighbor_asn: StrictInt = Field(..., description="The ASN of the dynamic BGP neighbor") - bgp_neighbor_range: StrictStr = Field(..., description="Network range of the dynamic BGP neighbor in CIDR format") + """ # noqa: E501 + bgp_neighbor_asn: StrictInt = Field(description="The ASN of the dynamic BGP neighbor") + bgp_neighbor_range: StrictStr = Field(description="Network range of the dynamic BGP neighbor in CIDR format") href: Optional[StrictStr] = None - tags: Optional[conlist(StrictStr)] = None - __properties = ["bgp_neighbor_asn", "bgp_neighbor_range", "href", "tags"] + tags: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["bgp_neighbor_asn", "bgp_neighbor_range", "href", "tags"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> BgpDynamicNeighborCreateInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BgpDynamicNeighborCreateInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> BgpDynamicNeighborCreateInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BgpDynamicNeighborCreateInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return BgpDynamicNeighborCreateInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = BgpDynamicNeighborCreateInput.parse_obj({ + _obj = cls.model_validate({ "bgp_neighbor_asn": obj.get("bgp_neighbor_asn"), "bgp_neighbor_range": obj.get("bgp_neighbor_range"), "href": obj.get("href"), diff --git a/equinix_metal/equinix_metal/models/bgp_dynamic_neighbor_list.py b/equinix_metal/equinix_metal/models/bgp_dynamic_neighbor_list.py index 6f09d8c2..eb5a0f68 100644 --- a/equinix_metal/equinix_metal/models/bgp_dynamic_neighbor_list.py +++ b/equinix_metal/equinix_metal/models/bgp_dynamic_neighbor_list.py @@ -18,45 +18,61 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.bgp_dynamic_neighbor import BgpDynamicNeighbor from equinix_metal.models.meta import Meta +from typing import Optional, Set +from typing_extensions import Self class BgpDynamicNeighborList(BaseModel): """ BgpDynamicNeighborList - """ - bgp_dynamic_neighbors: Optional[conlist(BgpDynamicNeighbor)] = None + """ # noqa: E501 + bgp_dynamic_neighbors: Optional[List[BgpDynamicNeighbor]] = None href: Optional[StrictStr] = None meta: Optional[Meta] = None - __properties = ["bgp_dynamic_neighbors", "href", "meta"] + __properties: ClassVar[List[str]] = ["bgp_dynamic_neighbors", "href", "meta"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> BgpDynamicNeighborList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BgpDynamicNeighborList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in bgp_dynamic_neighbors (list) _items = [] if self.bgp_dynamic_neighbors: @@ -70,18 +86,18 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> BgpDynamicNeighborList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BgpDynamicNeighborList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return BgpDynamicNeighborList.parse_obj(obj) + return cls.model_validate(obj) - _obj = BgpDynamicNeighborList.parse_obj({ - "bgp_dynamic_neighbors": [BgpDynamicNeighbor.from_dict(_item) for _item in obj.get("bgp_dynamic_neighbors")] if obj.get("bgp_dynamic_neighbors") is not None else None, + _obj = cls.model_validate({ + "bgp_dynamic_neighbors": [BgpDynamicNeighbor.from_dict(_item) for _item in obj["bgp_dynamic_neighbors"]] if obj.get("bgp_dynamic_neighbors") is not None else None, "href": obj.get("href"), - "meta": Meta.from_dict(obj.get("meta")) if obj.get("meta") is not None else None + "meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/bgp_neighbor_data.py b/equinix_metal/equinix_metal/models/bgp_neighbor_data.py index c3975d82..b4eb126b 100644 --- a/equinix_metal/equinix_metal/models/bgp_neighbor_data.py +++ b/equinix_metal/equinix_metal/models/bgp_neighbor_data.py @@ -18,52 +18,68 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.bgp_route import BgpRoute +from typing import Optional, Set +from typing_extensions import Self class BgpNeighborData(BaseModel): """ BgpNeighborData - """ - address_family: Optional[StrictInt] = Field(None, description="Address Family for IP Address. Accepted values are 4 or 6") - customer_as: Optional[StrictInt] = Field(None, description="The customer's ASN. In a local BGP deployment, this will be an internal ASN used to route within the data center. For a global BGP deployment, this will be the your own ASN, configured when you set up BGP for your project.") - customer_ip: Optional[StrictStr] = Field(None, description="The device's IP address. For an IPv4 BGP session, this is typically the private bond0 address for the device.") + """ # noqa: E501 + address_family: Optional[StrictInt] = Field(default=None, description="Address Family for IP Address. Accepted values are 4 or 6") + customer_as: Optional[StrictInt] = Field(default=None, description="The customer's ASN. In a local BGP deployment, this will be an internal ASN used to route within the data center. For a global BGP deployment, this will be the your own ASN, configured when you set up BGP for your project.") + customer_ip: Optional[StrictStr] = Field(default=None, description="The device's IP address. For an IPv4 BGP session, this is typically the private bond0 address for the device.") href: Optional[StrictStr] = None - md5_enabled: Optional[StrictBool] = Field(None, description="True if an MD5 password is configured for the project.") - md5_password: Optional[StrictStr] = Field(None, description="The MD5 password configured for the project, if set.") - multihop: Optional[StrictBool] = Field(None, description="True when the BGP session should be configured as multihop.") - peer_as: Optional[StrictInt] = Field(None, description="The Peer ASN to use when configuring BGP on your device.") - peer_ips: Optional[conlist(StrictStr)] = Field(None, description="A list of one or more IP addresses to use for the Peer IP section of your BGP configuration. For non-multihop sessions, this will typically be a single gateway address for the device. For multihop sessions, it will be a list of IPs.") - routes_in: Optional[conlist(BgpRoute)] = Field(None, description="A list of project subnets") - routes_out: Optional[conlist(BgpRoute)] = Field(None, description="A list of outgoing routes. Only populated if the BGP session has default route enabled.") - __properties = ["address_family", "customer_as", "customer_ip", "href", "md5_enabled", "md5_password", "multihop", "peer_as", "peer_ips", "routes_in", "routes_out"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + md5_enabled: Optional[StrictBool] = Field(default=None, description="True if an MD5 password is configured for the project.") + md5_password: Optional[StrictStr] = Field(default=None, description="The MD5 password configured for the project, if set.") + multihop: Optional[StrictBool] = Field(default=None, description="True when the BGP session should be configured as multihop.") + peer_as: Optional[StrictInt] = Field(default=None, description="The Peer ASN to use when configuring BGP on your device.") + peer_ips: Optional[List[StrictStr]] = Field(default=None, description="A list of one or more IP addresses to use for the Peer IP section of your BGP configuration. For non-multihop sessions, this will typically be a single gateway address for the device. For multihop sessions, it will be a list of IPs.") + routes_in: Optional[List[BgpRoute]] = Field(default=None, description="A list of project subnets") + routes_out: Optional[List[BgpRoute]] = Field(default=None, description="A list of outgoing routes. Only populated if the BGP session has default route enabled.") + __properties: ClassVar[List[str]] = ["address_family", "customer_as", "customer_ip", "href", "md5_enabled", "md5_password", "multihop", "peer_as", "peer_ips", "routes_in", "routes_out"] + + 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.dict(by_alias=True)) + 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) -> BgpNeighborData: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BgpNeighborData from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in routes_in (list) _items = [] if self.routes_in: @@ -81,15 +97,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> BgpNeighborData: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BgpNeighborData from a dict""" if obj is None: return None if not isinstance(obj, dict): - return BgpNeighborData.parse_obj(obj) + return cls.model_validate(obj) - _obj = BgpNeighborData.parse_obj({ + _obj = cls.model_validate({ "address_family": obj.get("address_family"), "customer_as": obj.get("customer_as"), "customer_ip": obj.get("customer_ip"), @@ -99,8 +115,8 @@ def from_dict(cls, obj: dict) -> BgpNeighborData: "multihop": obj.get("multihop"), "peer_as": obj.get("peer_as"), "peer_ips": obj.get("peer_ips"), - "routes_in": [BgpRoute.from_dict(_item) for _item in obj.get("routes_in")] if obj.get("routes_in") is not None else None, - "routes_out": [BgpRoute.from_dict(_item) for _item in obj.get("routes_out")] if obj.get("routes_out") is not None else None + "routes_in": [BgpRoute.from_dict(_item) for _item in obj["routes_in"]] if obj.get("routes_in") is not None else None, + "routes_out": [BgpRoute.from_dict(_item) for _item in obj["routes_out"]] if obj.get("routes_out") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/bgp_route.py b/equinix_metal/equinix_metal/models/bgp_route.py index 4504896d..fe6d00b5 100644 --- a/equinix_metal/equinix_metal/models/bgp_route.py +++ b/equinix_metal/equinix_metal/models/bgp_route.py @@ -18,55 +18,71 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictBool, StrictStr +from pydantic import BaseModel, ConfigDict, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class BgpRoute(BaseModel): """ BgpRoute - """ + """ # noqa: E501 exact: Optional[StrictBool] = None href: Optional[StrictStr] = None route: Optional[StrictStr] = None - __properties = ["exact", "href", "route"] + __properties: ClassVar[List[str]] = ["exact", "href", "route"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> BgpRoute: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BgpRoute from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> BgpRoute: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BgpRoute from a dict""" if obj is None: return None if not isinstance(obj, dict): - return BgpRoute.parse_obj(obj) + return cls.model_validate(obj) - _obj = BgpRoute.parse_obj({ + _obj = cls.model_validate({ "exact": obj.get("exact"), "href": obj.get("href"), "route": obj.get("route") diff --git a/equinix_metal/equinix_metal/models/bgp_session.py b/equinix_metal/equinix_metal/models/bgp_session.py index ae3272e1..0340db12 100644 --- a/equinix_metal/equinix_metal/models/bgp_session.py +++ b/equinix_metal/equinix_metal/models/bgp_session.py @@ -19,75 +19,92 @@ import json from datetime import datetime -from typing import List, Optional -from pydantic import BaseModel, Field, StrictBool, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.href import Href +from typing import Optional, Set +from typing_extensions import Self class BgpSession(BaseModel): """ BgpSession - """ - address_family: StrictStr = Field(...) + """ # noqa: E501 + address_family: StrictStr created_at: Optional[datetime] = None default_route: Optional[StrictBool] = None device: Optional[Href] = None href: Optional[StrictStr] = None id: Optional[StrictStr] = None - learned_routes: Optional[conlist(StrictStr)] = None - status: Optional[StrictStr] = Field(None, description=" The status of the BGP Session. Multiple status values may be reported when the device is connected to multiple switches, one value per switch. Each status will start with \"unknown\" and progress to \"up\" or \"down\" depending on the connected device. Subsequent \"unknown\" values indicate a problem acquiring status from the switch. ") + learned_routes: Optional[List[StrictStr]] = None + status: Optional[StrictStr] = Field(default=None, description=" The status of the BGP Session. Multiple status values may be reported when the device is connected to multiple switches, one value per switch. Each status will start with \"unknown\" and progress to \"up\" or \"down\" depending on the connected device. Subsequent \"unknown\" values indicate a problem acquiring status from the switch. ") updated_at: Optional[datetime] = None - __properties = ["address_family", "created_at", "default_route", "device", "href", "id", "learned_routes", "status", "updated_at"] + __properties: ClassVar[List[str]] = ["address_family", "created_at", "default_route", "device", "href", "id", "learned_routes", "status", "updated_at"] - @validator('address_family') + @field_validator('address_family') def address_family_validate_enum(cls, value): """Validates the enum""" - if value not in ('ipv4', 'ipv6'): + if value not in set(['ipv4', 'ipv6']): raise ValueError("must be one of enum values ('ipv4', 'ipv6')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> BgpSession: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BgpSession from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of device if self.device: _dict['device'] = self.device.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> BgpSession: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BgpSession from a dict""" if obj is None: return None if not isinstance(obj, dict): - return BgpSession.parse_obj(obj) + return cls.model_validate(obj) - _obj = BgpSession.parse_obj({ + _obj = cls.model_validate({ "address_family": obj.get("address_family"), "created_at": obj.get("created_at"), "default_route": obj.get("default_route"), - "device": Href.from_dict(obj.get("device")) if obj.get("device") is not None else None, + "device": Href.from_dict(obj["device"]) if obj.get("device") is not None else None, "href": obj.get("href"), "id": obj.get("id"), "learned_routes": obj.get("learned_routes"), diff --git a/equinix_metal/equinix_metal/models/bgp_session_input.py b/equinix_metal/equinix_metal/models/bgp_session_input.py index 35b3273a..a06c4919 100644 --- a/equinix_metal/equinix_metal/models/bgp_session_input.py +++ b/equinix_metal/equinix_metal/models/bgp_session_input.py @@ -18,65 +18,81 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictBool, StrictStr, validator +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class BGPSessionInput(BaseModel): """ BGPSessionInput - """ - address_family: Optional[StrictStr] = Field(None, description="Address family for BGP session.") - default_route: Optional[StrictBool] = Field(False, description="Set the default route policy.") + """ # noqa: E501 + address_family: Optional[StrictStr] = Field(default=None, description="Address family for BGP session.") + default_route: Optional[StrictBool] = Field(default=False, description="Set the default route policy.") href: Optional[StrictStr] = None - __properties = ["address_family", "default_route", "href"] + __properties: ClassVar[List[str]] = ["address_family", "default_route", "href"] - @validator('address_family') + @field_validator('address_family') def address_family_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('ipv4', 'ipv6'): + if value not in set(['ipv4', 'ipv6']): raise ValueError("must be one of enum values ('ipv4', 'ipv6')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> BGPSessionInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BGPSessionInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> BGPSessionInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BGPSessionInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return BGPSessionInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = BGPSessionInput.parse_obj({ + _obj = cls.model_validate({ "address_family": obj.get("address_family"), "default_route": obj.get("default_route") if obj.get("default_route") is not None else False, "href": obj.get("href") diff --git a/equinix_metal/equinix_metal/models/bgp_session_list.py b/equinix_metal/equinix_metal/models/bgp_session_list.py index 35ff7ab6..674c771e 100644 --- a/equinix_metal/equinix_metal/models/bgp_session_list.py +++ b/equinix_metal/equinix_metal/models/bgp_session_list.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.bgp_session import BgpSession +from typing import Optional, Set +from typing_extensions import Self class BgpSessionList(BaseModel): """ BgpSessionList - """ - bgp_sessions: Optional[conlist(BgpSession)] = None + """ # noqa: E501 + bgp_sessions: Optional[List[BgpSession]] = None href: Optional[StrictStr] = None - __properties = ["bgp_sessions", "href"] + __properties: ClassVar[List[str]] = ["bgp_sessions", "href"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> BgpSessionList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BgpSessionList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in bgp_sessions (list) _items = [] if self.bgp_sessions: @@ -65,16 +81,16 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> BgpSessionList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BgpSessionList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return BgpSessionList.parse_obj(obj) + return cls.model_validate(obj) - _obj = BgpSessionList.parse_obj({ - "bgp_sessions": [BgpSession.from_dict(_item) for _item in obj.get("bgp_sessions")] if obj.get("bgp_sessions") is not None else None, + _obj = cls.model_validate({ + "bgp_sessions": [BgpSession.from_dict(_item) for _item in obj["bgp_sessions"]] if obj.get("bgp_sessions") is not None else None, "href": obj.get("href") }) return _obj diff --git a/equinix_metal/equinix_metal/models/bgp_session_neighbors.py b/equinix_metal/equinix_metal/models/bgp_session_neighbors.py index 6392a4f7..016788cc 100644 --- a/equinix_metal/equinix_metal/models/bgp_session_neighbors.py +++ b/equinix_metal/equinix_metal/models/bgp_session_neighbors.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.bgp_neighbor_data import BgpNeighborData +from typing import Optional, Set +from typing_extensions import Self class BgpSessionNeighbors(BaseModel): """ BgpSessionNeighbors - """ - bgp_neighbors: Optional[conlist(BgpNeighborData)] = Field(None, description="A list of BGP session neighbor data") + """ # noqa: E501 + bgp_neighbors: Optional[List[BgpNeighborData]] = Field(default=None, description="A list of BGP session neighbor data") href: Optional[StrictStr] = None - __properties = ["bgp_neighbors", "href"] + __properties: ClassVar[List[str]] = ["bgp_neighbors", "href"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> BgpSessionNeighbors: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BgpSessionNeighbors from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in bgp_neighbors (list) _items = [] if self.bgp_neighbors: @@ -65,16 +81,16 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> BgpSessionNeighbors: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BgpSessionNeighbors from a dict""" if obj is None: return None if not isinstance(obj, dict): - return BgpSessionNeighbors.parse_obj(obj) + return cls.model_validate(obj) - _obj = BgpSessionNeighbors.parse_obj({ - "bgp_neighbors": [BgpNeighborData.from_dict(_item) for _item in obj.get("bgp_neighbors")] if obj.get("bgp_neighbors") is not None else None, + _obj = cls.model_validate({ + "bgp_neighbors": [BgpNeighborData.from_dict(_item) for _item in obj["bgp_neighbors"]] if obj.get("bgp_neighbors") is not None else None, "href": obj.get("href") }) return _obj diff --git a/equinix_metal/equinix_metal/models/bond_port_data.py b/equinix_metal/equinix_metal/models/bond_port_data.py index 0ce0ce66..eaf2daff 100644 --- a/equinix_metal/equinix_metal/models/bond_port_data.py +++ b/equinix_metal/equinix_metal/models/bond_port_data.py @@ -18,55 +18,71 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class BondPortData(BaseModel): """ BondPortData - """ + """ # noqa: E501 href: Optional[StrictStr] = None - id: Optional[StrictStr] = Field(None, description="ID of the bonding port") - name: Optional[StrictStr] = Field(None, description="Name of the port interface for the bond (\"bond0\")") - __properties = ["href", "id", "name"] + id: Optional[StrictStr] = Field(default=None, description="ID of the bonding port") + name: Optional[StrictStr] = Field(default=None, description="Name of the port interface for the bond (\"bond0\")") + __properties: ClassVar[List[str]] = ["href", "id", "name"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> BondPortData: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BondPortData from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> BondPortData: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BondPortData from a dict""" if obj is None: return None if not isinstance(obj, dict): - return BondPortData.parse_obj(obj) + return cls.model_validate(obj) - _obj = BondPortData.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), "id": obj.get("id"), "name": obj.get("name") diff --git a/equinix_metal/equinix_metal/models/capacity_check_per_facility_info.py b/equinix_metal/equinix_metal/models/capacity_check_per_facility_info.py index e979f807..1ef5324e 100644 --- a/equinix_metal/equinix_metal/models/capacity_check_per_facility_info.py +++ b/equinix_metal/equinix_metal/models/capacity_check_per_facility_info.py @@ -18,57 +18,73 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictBool, StrictStr +from pydantic import BaseModel, ConfigDict, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class CapacityCheckPerFacilityInfo(BaseModel): """ CapacityCheckPerFacilityInfo - """ + """ # noqa: E501 available: Optional[StrictBool] = None facility: Optional[StrictStr] = None href: Optional[StrictStr] = None plan: Optional[StrictStr] = None quantity: Optional[StrictStr] = None - __properties = ["available", "facility", "href", "plan", "quantity"] + __properties: ClassVar[List[str]] = ["available", "facility", "href", "plan", "quantity"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> CapacityCheckPerFacilityInfo: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of CapacityCheckPerFacilityInfo from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> CapacityCheckPerFacilityInfo: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of CapacityCheckPerFacilityInfo from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CapacityCheckPerFacilityInfo.parse_obj(obj) + return cls.model_validate(obj) - _obj = CapacityCheckPerFacilityInfo.parse_obj({ + _obj = cls.model_validate({ "available": obj.get("available"), "facility": obj.get("facility"), "href": obj.get("href"), diff --git a/equinix_metal/equinix_metal/models/capacity_check_per_facility_list.py b/equinix_metal/equinix_metal/models/capacity_check_per_facility_list.py index 78493eb0..24be8b0b 100644 --- a/equinix_metal/equinix_metal/models/capacity_check_per_facility_list.py +++ b/equinix_metal/equinix_metal/models/capacity_check_per_facility_list.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.capacity_check_per_facility_info import CapacityCheckPerFacilityInfo +from typing import Optional, Set +from typing_extensions import Self class CapacityCheckPerFacilityList(BaseModel): """ CapacityCheckPerFacilityList - """ + """ # noqa: E501 href: Optional[StrictStr] = None - servers: Optional[conlist(CapacityCheckPerFacilityInfo)] = None - __properties = ["href", "servers"] + servers: Optional[List[CapacityCheckPerFacilityInfo]] = None + __properties: ClassVar[List[str]] = ["href", "servers"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> CapacityCheckPerFacilityList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of CapacityCheckPerFacilityList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in servers (list) _items = [] if self.servers: @@ -65,17 +81,17 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> CapacityCheckPerFacilityList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of CapacityCheckPerFacilityList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CapacityCheckPerFacilityList.parse_obj(obj) + return cls.model_validate(obj) - _obj = CapacityCheckPerFacilityList.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "servers": [CapacityCheckPerFacilityInfo.from_dict(_item) for _item in obj.get("servers")] if obj.get("servers") is not None else None + "servers": [CapacityCheckPerFacilityInfo.from_dict(_item) for _item in obj["servers"]] if obj.get("servers") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/capacity_check_per_metro_info.py b/equinix_metal/equinix_metal/models/capacity_check_per_metro_info.py index de98c598..71b10112 100644 --- a/equinix_metal/equinix_metal/models/capacity_check_per_metro_info.py +++ b/equinix_metal/equinix_metal/models/capacity_check_per_metro_info.py @@ -18,57 +18,73 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictBool, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class CapacityCheckPerMetroInfo(BaseModel): """ CapacityCheckPerMetroInfo - """ - available: Optional[StrictBool] = Field(None, description="Returns true if there is enough capacity in the metro to fulfill the quantity set. Returns false if there is not enough.") + """ # noqa: E501 + available: Optional[StrictBool] = Field(default=None, description="Returns true if there is enough capacity in the metro to fulfill the quantity set. Returns false if there is not enough.") href: Optional[StrictStr] = None - metro: Optional[StrictStr] = Field(None, description="The metro ID or code sent to check capacity.") - plan: Optional[StrictStr] = Field(None, description="The plan ID or slug sent to check capacity.") - quantity: Optional[StrictStr] = Field(None, description="The number of servers sent to check capacity.") - __properties = ["available", "href", "metro", "plan", "quantity"] + metro: Optional[StrictStr] = Field(default=None, description="The metro ID or code sent to check capacity.") + plan: Optional[StrictStr] = Field(default=None, description="The plan ID or slug sent to check capacity.") + quantity: Optional[StrictStr] = Field(default=None, description="The number of servers sent to check capacity.") + __properties: ClassVar[List[str]] = ["available", "href", "metro", "plan", "quantity"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> CapacityCheckPerMetroInfo: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of CapacityCheckPerMetroInfo from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> CapacityCheckPerMetroInfo: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of CapacityCheckPerMetroInfo from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CapacityCheckPerMetroInfo.parse_obj(obj) + return cls.model_validate(obj) - _obj = CapacityCheckPerMetroInfo.parse_obj({ + _obj = cls.model_validate({ "available": obj.get("available"), "href": obj.get("href"), "metro": obj.get("metro"), diff --git a/equinix_metal/equinix_metal/models/capacity_check_per_metro_list.py b/equinix_metal/equinix_metal/models/capacity_check_per_metro_list.py index 696ed0d0..f487b02d 100644 --- a/equinix_metal/equinix_metal/models/capacity_check_per_metro_list.py +++ b/equinix_metal/equinix_metal/models/capacity_check_per_metro_list.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.capacity_check_per_metro_info import CapacityCheckPerMetroInfo +from typing import Optional, Set +from typing_extensions import Self class CapacityCheckPerMetroList(BaseModel): """ CapacityCheckPerMetroList - """ + """ # noqa: E501 href: Optional[StrictStr] = None - servers: Optional[conlist(CapacityCheckPerMetroInfo)] = None - __properties = ["href", "servers"] + servers: Optional[List[CapacityCheckPerMetroInfo]] = None + __properties: ClassVar[List[str]] = ["href", "servers"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> CapacityCheckPerMetroList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of CapacityCheckPerMetroList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in servers (list) _items = [] if self.servers: @@ -65,17 +81,17 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> CapacityCheckPerMetroList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of CapacityCheckPerMetroList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CapacityCheckPerMetroList.parse_obj(obj) + return cls.model_validate(obj) - _obj = CapacityCheckPerMetroList.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "servers": [CapacityCheckPerMetroInfo.from_dict(_item) for _item in obj.get("servers")] if obj.get("servers") is not None else None + "servers": [CapacityCheckPerMetroInfo.from_dict(_item) for _item in obj["servers"]] if obj.get("servers") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/capacity_input.py b/equinix_metal/equinix_metal/models/capacity_input.py index df425814..e8fae0af 100644 --- a/equinix_metal/equinix_metal/models/capacity_input.py +++ b/equinix_metal/equinix_metal/models/capacity_input.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.server_info import ServerInfo +from typing import Optional, Set +from typing_extensions import Self class CapacityInput(BaseModel): """ CapacityInput - """ + """ # noqa: E501 href: Optional[StrictStr] = None - servers: Optional[conlist(ServerInfo)] = None - __properties = ["href", "servers"] + servers: Optional[List[ServerInfo]] = None + __properties: ClassVar[List[str]] = ["href", "servers"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> CapacityInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of CapacityInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in servers (list) _items = [] if self.servers: @@ -65,17 +81,17 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> CapacityInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of CapacityInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CapacityInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = CapacityInput.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "servers": [ServerInfo.from_dict(_item) for _item in obj.get("servers")] if obj.get("servers") is not None else None + "servers": [ServerInfo.from_dict(_item) for _item in obj["servers"]] if obj.get("servers") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/capacity_level_per_baremetal.py b/equinix_metal/equinix_metal/models/capacity_level_per_baremetal.py index 8ceb6cae..e45fed85 100644 --- a/equinix_metal/equinix_metal/models/capacity_level_per_baremetal.py +++ b/equinix_metal/equinix_metal/models/capacity_level_per_baremetal.py @@ -18,54 +18,70 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class CapacityLevelPerBaremetal(BaseModel): """ CapacityLevelPerBaremetal - """ + """ # noqa: E501 href: Optional[StrictStr] = None level: Optional[StrictStr] = None - __properties = ["href", "level"] + __properties: ClassVar[List[str]] = ["href", "level"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> CapacityLevelPerBaremetal: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of CapacityLevelPerBaremetal from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> CapacityLevelPerBaremetal: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of CapacityLevelPerBaremetal from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CapacityLevelPerBaremetal.parse_obj(obj) + return cls.model_validate(obj) - _obj = CapacityLevelPerBaremetal.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), "level": obj.get("level") }) diff --git a/equinix_metal/equinix_metal/models/capacity_list.py b/equinix_metal/equinix_metal/models/capacity_list.py index 300c94d4..5b6b19cc 100644 --- a/equinix_metal/equinix_metal/models/capacity_list.py +++ b/equinix_metal/equinix_metal/models/capacity_list.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import Dict, Optional -from pydantic import BaseModel, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.capacity_level_per_baremetal import CapacityLevelPerBaremetal +from typing import Optional, Set +from typing_extensions import Self class CapacityList(BaseModel): """ CapacityList - """ + """ # noqa: E501 capacity: Optional[Dict[str, Dict[str, CapacityLevelPerBaremetal]]] = None href: Optional[StrictStr] = None - __properties = ["capacity", "href"] + __properties: ClassVar[List[str]] = ["capacity", "href"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> CapacityList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of CapacityList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each value in capacity (dict) _field_dict = {} if self.capacity: @@ -65,15 +81,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> CapacityList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of CapacityList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CapacityList.parse_obj(obj) + return cls.model_validate(obj) - _obj = CapacityList.parse_obj({ + _obj = cls.model_validate({ "capacity": dict( (_k, dict( (_ik, CapacityLevelPerBaremetal.from_dict(_iv)) diff --git a/equinix_metal/equinix_metal/models/component.py b/equinix_metal/equinix_metal/models/component.py index 79cb863e..fe323533 100644 --- a/equinix_metal/equinix_metal/models/component.py +++ b/equinix_metal/equinix_metal/models/component.py @@ -19,74 +19,102 @@ import json from datetime import datetime -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class Component(BaseModel): """ Component - """ - checksum: Optional[StrictStr] = Field(None, description="File checksum") - component: Optional[StrictStr] = Field(None, description="Component type") - created_at: Optional[datetime] = Field(None, description="Datetime when the block was created.") - filename: Optional[StrictStr] = Field(None, description="name of the file") + """ # noqa: E501 + checksum: Optional[StrictStr] = Field(default=None, description="File checksum") + component: Optional[StrictStr] = Field(default=None, description="Component type") + created_at: Optional[datetime] = Field(default=None, description="Datetime when the block was created.") + filename: Optional[StrictStr] = Field(default=None, description="name of the file") href: Optional[StrictStr] = None - model: Optional[conlist(StrictStr)] = Field(None, description="List of models where this component version can be applied") - repository_url: Optional[StrictStr] = Field(None, description="Location of the file in the repository") - updated_at: Optional[datetime] = Field(None, description="Datetime when the block was updated.") - upstream_url: Optional[StrictStr] = Field(None, description="Location of the file") - uuid: Optional[StrictStr] = Field(None, description="Component UUID") - vendor: Optional[StrictStr] = Field(None, description="Component vendor") - version: Optional[StrictStr] = Field(None, description="Version of the component") - __properties = ["checksum", "component", "created_at", "filename", "href", "model", "repository_url", "updated_at", "upstream_url", "uuid", "vendor", "version"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + model: Optional[List[StrictStr]] = Field(default=None, description="List of models where this component version can be applied") + repository_url: Optional[StrictStr] = Field(default=None, description="Location of the file in the repository") + updated_at: Optional[datetime] = Field(default=None, description="Datetime when the block was updated.") + upstream_url: Optional[StrictStr] = Field(default=None, description="Location of the file") + uuid: Optional[StrictStr] = Field(default=None, description="Component UUID") + vendor: Optional[StrictStr] = Field(default=None, description="Component vendor") + version: Optional[StrictStr] = Field(default=None, description="Version of the component") + __properties: ClassVar[List[str]] = ["checksum", "component", "created_at", "filename", "href", "model", "repository_url", "updated_at", "upstream_url", "uuid", "vendor", "version"] + + 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.dict(by_alias=True)) + 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) -> Component: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Component from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - "checksum", - "component", - "created_at", - "filename", - "model", - "repository_url", - "updated_at", - "upstream_url", - "uuid", - "vendor", - "version", - }, - exclude_none=True) + 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. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "checksum", + "component", + "created_at", + "filename", + "model", + "repository_url", + "updated_at", + "upstream_url", + "uuid", + "vendor", + "version", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> Component: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Component from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Component.parse_obj(obj) + return cls.model_validate(obj) - _obj = Component.parse_obj({ + _obj = cls.model_validate({ "checksum": obj.get("checksum"), "component": obj.get("component"), "created_at": obj.get("created_at"), diff --git a/equinix_metal/equinix_metal/models/coordinates.py b/equinix_metal/equinix_metal/models/coordinates.py index 1a41d2e0..2e96b38a 100644 --- a/equinix_metal/equinix_metal/models/coordinates.py +++ b/equinix_metal/equinix_metal/models/coordinates.py @@ -18,55 +18,71 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class Coordinates(BaseModel): """ Coordinates - """ + """ # noqa: E501 href: Optional[StrictStr] = None latitude: Optional[StrictStr] = None longitude: Optional[StrictStr] = None - __properties = ["href", "latitude", "longitude"] + __properties: ClassVar[List[str]] = ["href", "latitude", "longitude"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> Coordinates: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Coordinates from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> Coordinates: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Coordinates from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Coordinates.parse_obj(obj) + return cls.model_validate(obj) - _obj = Coordinates.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), "latitude": obj.get("latitude"), "longitude": obj.get("longitude") diff --git a/equinix_metal/equinix_metal/models/create_device_request.py b/equinix_metal/equinix_metal/models/create_device_request.py index 32d5d54c..2eaded58 100644 --- a/equinix_metal/equinix_metal/models/create_device_request.py +++ b/equinix_metal/equinix_metal/models/create_device_request.py @@ -14,17 +14,15 @@ from __future__ import annotations -from inspect import getfullargspec import json import pprint -import re # noqa: F401 - +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator from typing import Any, List, Optional -from pydantic import BaseModel, Field, StrictStr, ValidationError, validator from equinix_metal.models.device_create_in_facility_input import DeviceCreateInFacilityInput from equinix_metal.models.device_create_in_metro_input import DeviceCreateInMetroInput -from typing import Union, Any, List, TYPE_CHECKING from pydantic import StrictStr, Field +from typing import Union, List, Optional, Dict +from typing_extensions import Literal, Self CREATEDEVICEREQUEST_ONE_OF_SCHEMAS = ["DeviceCreateInFacilityInput", "DeviceCreateInMetroInput"] @@ -36,16 +34,16 @@ class CreateDeviceRequest(BaseModel): oneof_schema_1_validator: Optional[DeviceCreateInMetroInput] = None # data type: DeviceCreateInFacilityInput oneof_schema_2_validator: Optional[DeviceCreateInFacilityInput] = None - if TYPE_CHECKING: - actual_instance: Union[DeviceCreateInFacilityInput, DeviceCreateInMetroInput] - else: - actual_instance: Any - one_of_schemas: List[str] = Field(CREATEDEVICEREQUEST_ONE_OF_SCHEMAS, const=True) + actual_instance: Optional[Union[DeviceCreateInFacilityInput, DeviceCreateInMetroInput]] = None + one_of_schemas: List[str] = Field(default=Literal["DeviceCreateInFacilityInput", "DeviceCreateInMetroInput"]) + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - validate_assignment = True - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: if args: if len(args) > 1: raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") @@ -55,9 +53,9 @@ def __init__(self, *args, **kwargs): else: super().__init__(**kwargs) - @validator('actual_instance') + @field_validator('actual_instance') def actual_instance_must_validate_oneof(cls, v): - instance = CreateDeviceRequest.construct() + instance = CreateDeviceRequest.model_construct() error_messages = [] match = 0 # validate data type: DeviceCreateInMetroInput @@ -80,13 +78,13 @@ def actual_instance_must_validate_oneof(cls, v): return v @classmethod - def from_dict(cls, obj: dict) -> CreateDeviceRequest: + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: return cls.from_json(json.dumps(obj)) @classmethod - def from_json(cls, json_str: str) -> CreateDeviceRequest: + def from_json(cls, json_str: str) -> Self: """Returns the object represented by the json string""" - instance = CreateDeviceRequest.construct() + instance = cls.model_construct() error_messages = [] match = 0 @@ -117,19 +115,17 @@ def to_json(self) -> str: if self.actual_instance is None: return "null" - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): return self.actual_instance.to_json() else: return json.dumps(self.actual_instance) - def to_dict(self) -> dict: + def to_dict(self) -> Optional[Union[Dict[str, Any], DeviceCreateInFacilityInput, DeviceCreateInMetroInput]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None - to_dict = getattr(self.actual_instance, "to_dict", None) - if callable(to_dict): + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): return self.actual_instance.to_dict() else: # primitive type @@ -137,6 +133,6 @@ def to_dict(self) -> dict: def to_str(self) -> str: """Returns the string representation of the actual instance""" - return pprint.pformat(self.dict()) + return pprint.pformat(self.model_dump()) diff --git a/equinix_metal/equinix_metal/models/create_email_input.py b/equinix_metal/equinix_metal/models/create_email_input.py index db96412f..12177db8 100644 --- a/equinix_metal/equinix_metal/models/create_email_input.py +++ b/equinix_metal/equinix_metal/models/create_email_input.py @@ -18,54 +18,70 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class CreateEmailInput(BaseModel): """ CreateEmailInput - """ - address: StrictStr = Field(...) + """ # noqa: E501 + address: StrictStr href: Optional[StrictStr] = None - __properties = ["address", "href"] + __properties: ClassVar[List[str]] = ["address", "href"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> CreateEmailInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of CreateEmailInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> CreateEmailInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of CreateEmailInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CreateEmailInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = CreateEmailInput.parse_obj({ + _obj = cls.model_validate({ "address": obj.get("address"), "href": obj.get("href") }) diff --git a/equinix_metal/equinix_metal/models/create_metal_gateway_request.py b/equinix_metal/equinix_metal/models/create_metal_gateway_request.py index fbdea40d..9e69f3bd 100644 --- a/equinix_metal/equinix_metal/models/create_metal_gateway_request.py +++ b/equinix_metal/equinix_metal/models/create_metal_gateway_request.py @@ -14,17 +14,15 @@ from __future__ import annotations -from inspect import getfullargspec import json import pprint -import re # noqa: F401 - +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator from typing import Any, List, Optional -from pydantic import BaseModel, Field, StrictStr, ValidationError, validator from equinix_metal.models.metal_gateway_create_input import MetalGatewayCreateInput from equinix_metal.models.vrf_metal_gateway_create_input import VrfMetalGatewayCreateInput -from typing import Union, Any, List, TYPE_CHECKING from pydantic import StrictStr, Field +from typing import Union, List, Optional, Dict +from typing_extensions import Literal, Self CREATEMETALGATEWAYREQUEST_ONE_OF_SCHEMAS = ["MetalGatewayCreateInput", "VrfMetalGatewayCreateInput"] @@ -36,16 +34,16 @@ class CreateMetalGatewayRequest(BaseModel): oneof_schema_1_validator: Optional[MetalGatewayCreateInput] = None # data type: VrfMetalGatewayCreateInput oneof_schema_2_validator: Optional[VrfMetalGatewayCreateInput] = None - if TYPE_CHECKING: - actual_instance: Union[MetalGatewayCreateInput, VrfMetalGatewayCreateInput] - else: - actual_instance: Any - one_of_schemas: List[str] = Field(CREATEMETALGATEWAYREQUEST_ONE_OF_SCHEMAS, const=True) + actual_instance: Optional[Union[MetalGatewayCreateInput, VrfMetalGatewayCreateInput]] = None + one_of_schemas: List[str] = Field(default=Literal["MetalGatewayCreateInput", "VrfMetalGatewayCreateInput"]) + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - validate_assignment = True - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: if args: if len(args) > 1: raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") @@ -55,9 +53,9 @@ def __init__(self, *args, **kwargs): else: super().__init__(**kwargs) - @validator('actual_instance') + @field_validator('actual_instance') def actual_instance_must_validate_oneof(cls, v): - instance = CreateMetalGatewayRequest.construct() + instance = CreateMetalGatewayRequest.model_construct() error_messages = [] match = 0 # validate data type: MetalGatewayCreateInput @@ -80,13 +78,13 @@ def actual_instance_must_validate_oneof(cls, v): return v @classmethod - def from_dict(cls, obj: dict) -> CreateMetalGatewayRequest: + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: return cls.from_json(json.dumps(obj)) @classmethod - def from_json(cls, json_str: str) -> CreateMetalGatewayRequest: + def from_json(cls, json_str: str) -> Self: """Returns the object represented by the json string""" - instance = CreateMetalGatewayRequest.construct() + instance = cls.model_construct() error_messages = [] match = 0 @@ -117,19 +115,17 @@ def to_json(self) -> str: if self.actual_instance is None: return "null" - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): return self.actual_instance.to_json() else: return json.dumps(self.actual_instance) - def to_dict(self) -> dict: + def to_dict(self) -> Optional[Union[Dict[str, Any], MetalGatewayCreateInput, VrfMetalGatewayCreateInput]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None - to_dict = getattr(self.actual_instance, "to_dict", None) - if callable(to_dict): + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): return self.actual_instance.to_dict() else: # primitive type @@ -137,6 +133,6 @@ def to_dict(self) -> dict: def to_str(self) -> str: """Returns the string representation of the actual instance""" - return pprint.pformat(self.dict()) + return pprint.pformat(self.model_dump()) diff --git a/equinix_metal/equinix_metal/models/create_organization_interconnection_request.py b/equinix_metal/equinix_metal/models/create_organization_interconnection_request.py index 224ad86a..edc4e4ab 100644 --- a/equinix_metal/equinix_metal/models/create_organization_interconnection_request.py +++ b/equinix_metal/equinix_metal/models/create_organization_interconnection_request.py @@ -14,20 +14,18 @@ from __future__ import annotations -from inspect import getfullargspec import json import pprint -import re # noqa: F401 - +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator from typing import Any, List, Optional -from pydantic import BaseModel, Field, StrictStr, ValidationError, validator from equinix_metal.models.dedicated_port_create_input import DedicatedPortCreateInput from equinix_metal.models.shared_port_vc_vlan_create_input import SharedPortVCVlanCreateInput from equinix_metal.models.vlan_csp_connection_create_input import VlanCSPConnectionCreateInput from equinix_metal.models.vlan_fabric_vc_create_input import VlanFabricVcCreateInput from equinix_metal.models.vrf_fabric_vc_create_input import VrfFabricVcCreateInput -from typing import Union, Any, List, TYPE_CHECKING from pydantic import StrictStr, Field +from typing import Union, List, Optional, Dict +from typing_extensions import Literal, Self CREATEORGANIZATIONINTERCONNECTIONREQUEST_ONE_OF_SCHEMAS = ["DedicatedPortCreateInput", "SharedPortVCVlanCreateInput", "VlanCSPConnectionCreateInput", "VlanFabricVcCreateInput", "VrfFabricVcCreateInput"] @@ -45,16 +43,16 @@ class CreateOrganizationInterconnectionRequest(BaseModel): oneof_schema_4_validator: Optional[SharedPortVCVlanCreateInput] = None # data type: VlanCSPConnectionCreateInput oneof_schema_5_validator: Optional[VlanCSPConnectionCreateInput] = None - if TYPE_CHECKING: - actual_instance: Union[DedicatedPortCreateInput, SharedPortVCVlanCreateInput, VlanCSPConnectionCreateInput, VlanFabricVcCreateInput, VrfFabricVcCreateInput] - else: - actual_instance: Any - one_of_schemas: List[str] = Field(CREATEORGANIZATIONINTERCONNECTIONREQUEST_ONE_OF_SCHEMAS, const=True) + actual_instance: Optional[Union[DedicatedPortCreateInput, SharedPortVCVlanCreateInput, VlanCSPConnectionCreateInput, VlanFabricVcCreateInput, VrfFabricVcCreateInput]] = None + one_of_schemas: List[str] = Field(default=Literal["DedicatedPortCreateInput", "SharedPortVCVlanCreateInput", "VlanCSPConnectionCreateInput", "VlanFabricVcCreateInput", "VrfFabricVcCreateInput"]) + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - validate_assignment = True - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: if args: if len(args) > 1: raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") @@ -64,9 +62,9 @@ def __init__(self, *args, **kwargs): else: super().__init__(**kwargs) - @validator('actual_instance') + @field_validator('actual_instance') def actual_instance_must_validate_oneof(cls, v): - instance = CreateOrganizationInterconnectionRequest.construct() + instance = CreateOrganizationInterconnectionRequest.model_construct() error_messages = [] match = 0 # validate data type: DedicatedPortCreateInput @@ -104,13 +102,13 @@ def actual_instance_must_validate_oneof(cls, v): return v @classmethod - def from_dict(cls, obj: dict) -> CreateOrganizationInterconnectionRequest: + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: return cls.from_json(json.dumps(obj)) @classmethod - def from_json(cls, json_str: str) -> CreateOrganizationInterconnectionRequest: + def from_json(cls, json_str: str) -> Self: """Returns the object represented by the json string""" - instance = CreateOrganizationInterconnectionRequest.construct() + instance = cls.model_construct() error_messages = [] match = 0 @@ -159,19 +157,17 @@ def to_json(self) -> str: if self.actual_instance is None: return "null" - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): return self.actual_instance.to_json() else: return json.dumps(self.actual_instance) - def to_dict(self) -> dict: + def to_dict(self) -> Optional[Union[Dict[str, Any], DedicatedPortCreateInput, SharedPortVCVlanCreateInput, VlanCSPConnectionCreateInput, VlanFabricVcCreateInput, VrfFabricVcCreateInput]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None - to_dict = getattr(self.actual_instance, "to_dict", None) - if callable(to_dict): + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): return self.actual_instance.to_dict() else: # primitive type @@ -179,6 +175,6 @@ def to_dict(self) -> dict: def to_str(self) -> str: """Returns the string representation of the actual instance""" - return pprint.pformat(self.dict()) + return pprint.pformat(self.model_dump()) diff --git a/equinix_metal/equinix_metal/models/create_self_service_reservation_request.py b/equinix_metal/equinix_metal/models/create_self_service_reservation_request.py index 9ef71aba..b5d6d3d0 100644 --- a/equinix_metal/equinix_metal/models/create_self_service_reservation_request.py +++ b/equinix_metal/equinix_metal/models/create_self_service_reservation_request.py @@ -19,46 +19,63 @@ import json from datetime import datetime -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.create_self_service_reservation_request_period import CreateSelfServiceReservationRequestPeriod from equinix_metal.models.self_service_reservation_item_request import SelfServiceReservationItemRequest +from typing import Optional, Set +from typing_extensions import Self class CreateSelfServiceReservationRequest(BaseModel): """ CreateSelfServiceReservationRequest - """ + """ # noqa: E501 href: Optional[StrictStr] = None - item: Optional[conlist(SelfServiceReservationItemRequest)] = None + item: Optional[List[SelfServiceReservationItemRequest]] = None notes: Optional[StrictStr] = None period: Optional[CreateSelfServiceReservationRequestPeriod] = None start_date: Optional[datetime] = None - __properties = ["href", "item", "notes", "period", "start_date"] + __properties: ClassVar[List[str]] = ["href", "item", "notes", "period", "start_date"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> CreateSelfServiceReservationRequest: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of CreateSelfServiceReservationRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in item (list) _items = [] if self.item: @@ -72,19 +89,19 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> CreateSelfServiceReservationRequest: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of CreateSelfServiceReservationRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CreateSelfServiceReservationRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = CreateSelfServiceReservationRequest.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "item": [SelfServiceReservationItemRequest.from_dict(_item) for _item in obj.get("item")] if obj.get("item") is not None else None, + "item": [SelfServiceReservationItemRequest.from_dict(_item) for _item in obj["item"]] if obj.get("item") is not None else None, "notes": obj.get("notes"), - "period": CreateSelfServiceReservationRequestPeriod.from_dict(obj.get("period")) if obj.get("period") is not None else None, + "period": CreateSelfServiceReservationRequestPeriod.from_dict(obj["period"]) if obj.get("period") is not None else None, "start_date": obj.get("start_date") }) return _obj diff --git a/equinix_metal/equinix_metal/models/create_self_service_reservation_request_period.py b/equinix_metal/equinix_metal/models/create_self_service_reservation_request_period.py index 97e9661b..6619ea23 100644 --- a/equinix_metal/equinix_metal/models/create_self_service_reservation_request_period.py +++ b/equinix_metal/equinix_metal/models/create_self_service_reservation_request_period.py @@ -18,75 +18,91 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictInt, StrictStr, validator +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class CreateSelfServiceReservationRequestPeriod(BaseModel): """ CreateSelfServiceReservationRequestPeriod - """ + """ # noqa: E501 count: Optional[StrictInt] = None href: Optional[StrictStr] = None unit: Optional[StrictStr] = None - __properties = ["count", "href", "unit"] + __properties: ClassVar[List[str]] = ["count", "href", "unit"] - @validator('count') + @field_validator('count') def count_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in (12, 36): + if value not in set([12, 36]): raise ValueError("must be one of enum values (12, 36)") return value - @validator('unit') + @field_validator('unit') def unit_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('monthly'): + if value not in set(['monthly']): raise ValueError("must be one of enum values ('monthly')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> CreateSelfServiceReservationRequestPeriod: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of CreateSelfServiceReservationRequestPeriod from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> CreateSelfServiceReservationRequestPeriod: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of CreateSelfServiceReservationRequestPeriod from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CreateSelfServiceReservationRequestPeriod.parse_obj(obj) + return cls.model_validate(obj) - _obj = CreateSelfServiceReservationRequestPeriod.parse_obj({ + _obj = cls.model_validate({ "count": obj.get("count"), "href": obj.get("href"), "unit": obj.get("unit") diff --git a/equinix_metal/equinix_metal/models/dedicated_port_create_input.py b/equinix_metal/equinix_metal/models/dedicated_port_create_input.py index 86cb76cb..06508473 100644 --- a/equinix_metal/equinix_metal/models/dedicated_port_create_input.py +++ b/equinix_metal/equinix_metal/models/dedicated_port_create_input.py @@ -18,82 +18,98 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class DedicatedPortCreateInput(BaseModel): """ DedicatedPortCreateInput - """ - billing_account_name: Optional[StrictStr] = Field(None, description="The billing account name of the Equinix Fabric account.") - contact_email: Optional[StrictStr] = Field(None, description="The preferred email used for communication and notifications about the Equinix Fabric interconnection. Required when using a Project API key. Optional and defaults to the primary user email address when using a User API key.") + """ # noqa: E501 + billing_account_name: Optional[StrictStr] = Field(default=None, description="The billing account name of the Equinix Fabric account.") + contact_email: Optional[StrictStr] = Field(default=None, description="The preferred email used for communication and notifications about the Equinix Fabric interconnection. Required when using a Project API key. Optional and defaults to the primary user email address when using a User API key.") description: Optional[StrictStr] = None href: Optional[StrictStr] = None - metro: StrictStr = Field(..., description="A Metro ID or code. For interconnections with Dedicated Ports, this will be the location of the issued Dedicated Ports.") - mode: Optional[StrictStr] = Field(None, description="The mode of the interconnection (only relevant to Dedicated Ports). Fabric VCs won't have this field. Can be either 'standard' or 'tunnel'. The default mode of an interconnection on a Dedicated Port is 'standard'. The mode can only be changed when there are no associated virtual circuits on the interconnection. In tunnel mode, an 802.1q tunnel is added to a port to send/receive double tagged packets from server instances.") - name: StrictStr = Field(...) + metro: StrictStr = Field(description="A Metro ID or code. For interconnections with Dedicated Ports, this will be the location of the issued Dedicated Ports.") + mode: Optional[StrictStr] = Field(default=None, description="The mode of the interconnection (only relevant to Dedicated Ports). Fabric VCs won't have this field. Can be either 'standard' or 'tunnel'. The default mode of an interconnection on a Dedicated Port is 'standard'. The mode can only be changed when there are no associated virtual circuits on the interconnection. In tunnel mode, an 802.1q tunnel is added to a port to send/receive double tagged packets from server instances.") + name: StrictStr project: Optional[StrictStr] = None - redundancy: StrictStr = Field(..., description="Either 'primary' or 'redundant'.") - speed: Optional[StrictStr] = Field(None, description="A interconnection speed, in bps, mbps, or gbps. For Dedicated Ports, this can be 10Gbps or 100Gbps.") - tags: Optional[conlist(StrictStr)] = None - type: StrictStr = Field(..., description="When requesting for a dedicated port, the value of this field should be 'dedicated'.") - use_case: Optional[StrictStr] = Field(None, description="The intended use case of the dedicated port.") - __properties = ["billing_account_name", "contact_email", "description", "href", "metro", "mode", "name", "project", "redundancy", "speed", "tags", "type", "use_case"] - - @validator('mode') + redundancy: StrictStr = Field(description="Either 'primary' or 'redundant'.") + speed: Optional[StrictStr] = Field(default=None, description="A interconnection speed, in bps, mbps, or gbps. For Dedicated Ports, this can be 10Gbps or 100Gbps.") + tags: Optional[List[StrictStr]] = None + type: StrictStr = Field(description="When requesting for a dedicated port, the value of this field should be 'dedicated'.") + use_case: Optional[StrictStr] = Field(default=None, description="The intended use case of the dedicated port.") + __properties: ClassVar[List[str]] = ["billing_account_name", "contact_email", "description", "href", "metro", "mode", "name", "project", "redundancy", "speed", "tags", "type", "use_case"] + + @field_validator('mode') def mode_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('standard', 'tunnel'): + if value not in set(['standard', 'tunnel']): raise ValueError("must be one of enum values ('standard', 'tunnel')") return value - @validator('type') + @field_validator('type') def type_validate_enum(cls, value): """Validates the enum""" - if value not in ('dedicated', 'shared', 'shared_port_vlan', 'shared_port_vlan_to_csp'): - raise ValueError("must be one of enum values ('dedicated', 'shared', 'shared_port_vlan', 'shared_port_vlan_to_csp')") + if value not in set(['dedicated']): + raise ValueError("must be one of enum values ('dedicated')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> DedicatedPortCreateInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of DedicatedPortCreateInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> DedicatedPortCreateInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of DedicatedPortCreateInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return DedicatedPortCreateInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = DedicatedPortCreateInput.parse_obj({ + _obj = cls.model_validate({ "billing_account_name": obj.get("billing_account_name"), "contact_email": obj.get("contact_email"), "description": obj.get("description"), diff --git a/equinix_metal/equinix_metal/models/device.py b/equinix_metal/equinix_metal/models/device.py index 01a830b6..ec4d1437 100644 --- a/equinix_metal/equinix_metal/models/device.py +++ b/equinix_metal/equinix_metal/models/device.py @@ -19,8 +19,8 @@ import json from datetime import datetime -from typing import Any, Dict, List, Optional, Union -from pydantic import BaseModel, Field, StrictBool, StrictFloat, StrictInt, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union from equinix_metal.models.device_actions_inner import DeviceActionsInner from equinix_metal.models.device_created_by import DeviceCreatedBy from equinix_metal.models.device_metro import DeviceMetro @@ -34,12 +34,14 @@ from equinix_metal.models.port import Port from equinix_metal.models.project import Project from equinix_metal.models.storage import Storage +from typing import Optional, Set +from typing_extensions import Self class Device(BaseModel): """ Device - """ - actions: Optional[conlist(DeviceActionsInner)] = Field(None, description="Actions supported by the device instance.") + """ # noqa: E501 + actions: Optional[List[DeviceActionsInner]] = Field(default=None, description="Actions supported by the device instance.") always_pxe: Optional[StrictBool] = None billing_cycle: Optional[StrictStr] = None bonding_mode: Optional[StrictInt] = None @@ -48,76 +50,91 @@ class Device(BaseModel): customdata: Optional[Dict[str, Any]] = None description: Optional[StrictStr] = None facility: Optional[Facility] = None - firmware_set_id: Optional[StrictStr] = Field(None, description="The UUID of the firmware set to associate with the device.") + firmware_set_id: Optional[StrictStr] = Field(default=None, description="The UUID of the firmware set to associate with the device.") hardware_reservation: Optional[HardwareReservation] = None hostname: Optional[StrictStr] = None href: Optional[StrictStr] = None id: Optional[StrictStr] = None image_url: Optional[StrictStr] = None - ip_addresses: Optional[conlist(IPAssignment)] = None + ip_addresses: Optional[List[IPAssignment]] = None ipxe_script_url: Optional[StrictStr] = None iqn: Optional[StrictStr] = None - locked: Optional[StrictBool] = Field(None, description="Prevents accidental deletion of this resource when set to true.") + locked: Optional[StrictBool] = Field(default=None, description="Prevents accidental deletion of this resource when set to true.") metro: Optional[DeviceMetro] = None - network_frozen: Optional[StrictBool] = Field(None, description="Whether network mode changes such as converting to/from Layer2 or Layer3 networking, bonding or disbonding network interfaces are permitted for the device.") - network_ports: Optional[conlist(Port)] = Field(None, description="By default, servers at Equinix Metal are configured in a “bonded” mode using LACP (Link Aggregation Control Protocol). Each 2-NIC server is configured with a single bond (namely bond0) with both interfaces eth0 and eth1 as members of the bond in a default Layer 3 mode. Some device plans may have a different number of ports and bonds available.") + network_frozen: Optional[StrictBool] = Field(default=None, description="Whether network mode changes such as converting to/from Layer2 or Layer3 networking, bonding or disbonding network interfaces are permitted for the device.") + network_ports: Optional[List[Port]] = Field(default=None, description="By default, servers at Equinix Metal are configured in a “bonded” mode using LACP (Link Aggregation Control Protocol). Each 2-NIC server is configured with a single bond (namely bond0) with both interfaces eth0 and eth1 as members of the bond in a default Layer 3 mode. Some device plans may have a different number of ports and bonds available.") operating_system: Optional[OperatingSystem] = None plan: Optional[Plan] = None project: Optional[Project] = None project_lite: Optional[DeviceProjectLite] = None - provisioning_events: Optional[conlist(Event)] = None - provisioning_percentage: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="Only visible while device provisioning") - root_password: Optional[StrictStr] = Field(None, description="Root password is automatically generated when server is provisioned and it is removed after 24 hours") + provisioning_events: Optional[List[Event]] = None + provisioning_percentage: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Only visible while device provisioning") + root_password: Optional[StrictStr] = Field(default=None, description="Root password is automatically generated when server is provisioned and it is removed after 24 hours") short_id: Optional[StrictStr] = None - sos: Optional[StrictStr] = Field(None, description="Hostname used to connect to the instance via the SOS (Serial over SSH) out-of-band console.") - spot_instance: Optional[StrictBool] = Field(None, description="Whether or not the device is a spot instance.") - spot_price_max: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="The maximum price per hour you are willing to pay to keep this spot instance. If you are outbid, the termination will be set allowing two minutes before shutdown.") - ssh_keys: Optional[conlist(Href)] = None - state: Optional[StrictStr] = Field(None, description="The current state the instance is in. * When an instance is initially created it will be in the `queued` state until it is picked up by the provisioner. * Once provisioning has begun on the instance it's state will move to `provisioning`. * When an instance is deleted, it will move to `deprovisioning` state until the deprovision is completed and the instance state moves to `deleted`. * If an instance fails to provision or deprovision it will move to `failed` state. * Once an instance has completed provisioning it will move to `active` state. * If an instance is currently powering off or powering on it will move to `powering_off` or `powering_on` states respectively. * When the instance is powered off completely it will move to the `inactive` state. * When an instance is powered on completely it will move to the `active` state. * Using the reinstall action to install a new OS on the instance will cause the instance state to change to `reinstalling`. * When the reinstall action is complete the instance will move to `active` state.") + sos: Optional[StrictStr] = Field(default=None, description="Hostname used to connect to the instance via the SOS (Serial over SSH) out-of-band console.") + spot_instance: Optional[StrictBool] = Field(default=None, description="Whether or not the device is a spot instance.") + spot_price_max: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The maximum price per hour you are willing to pay to keep this spot instance. If you are outbid, the termination will be set allowing two minutes before shutdown.") + ssh_keys: Optional[List[Href]] = None + state: Optional[StrictStr] = Field(default=None, description="The current state the instance is in. * When an instance is initially created it will be in the `queued` state until it is picked up by the provisioner. * Once provisioning has begun on the instance it's state will move to `provisioning`. * When an instance is deleted, it will move to `deprovisioning` state until the deprovision is completed and the instance state moves to `deleted`. * If an instance fails to provision or deprovision it will move to `failed` state. * Once an instance has completed provisioning it will move to `active` state. * If an instance is currently powering off or powering on it will move to `powering_off` or `powering_on` states respectively. * When the instance is powered off completely it will move to the `inactive` state. * When an instance is powered on completely it will move to the `active` state. * Using the reinstall action to install a new OS on the instance will cause the instance state to change to `reinstalling`. * When the reinstall action is complete the instance will move to `active` state.") storage: Optional[Storage] = None - switch_uuid: Optional[StrictStr] = Field(None, description="Switch short id. This can be used to determine if two devices are connected to the same switch, for example.") - tags: Optional[conlist(StrictStr)] = None - termination_time: Optional[datetime] = Field(None, description="When the device will be terminated. If you don't supply timezone info, the timestamp is assumed to be in UTC. This is commonly set in advance for ephemeral spot market instances but this field may also be set with on-demand and reservation instances to automatically delete the resource at a given time. The termination time can also be used to release a hardware reservation instance at a given time, keeping the reservation open for other uses. On a spot market device, the termination time will be set automatically when outbid.") + switch_uuid: Optional[StrictStr] = Field(default=None, description="Switch short id. This can be used to determine if two devices are connected to the same switch, for example.") + tags: Optional[List[StrictStr]] = None + termination_time: Optional[datetime] = Field(default=None, description="When the device will be terminated. If you don't supply timezone info, the timestamp is assumed to be in UTC. This is commonly set in advance for ephemeral spot market instances but this field may also be set with on-demand and reservation instances to automatically delete the resource at a given time. The termination time can also be used to release a hardware reservation instance at a given time, keeping the reservation open for other uses. On a spot market device, the termination time will be set automatically when outbid.") updated_at: Optional[datetime] = None user: Optional[StrictStr] = None userdata: Optional[StrictStr] = None - volumes: Optional[conlist(Href)] = None - __properties = ["actions", "always_pxe", "billing_cycle", "bonding_mode", "created_at", "created_by", "customdata", "description", "facility", "firmware_set_id", "hardware_reservation", "hostname", "href", "id", "image_url", "ip_addresses", "ipxe_script_url", "iqn", "locked", "metro", "network_frozen", "network_ports", "operating_system", "plan", "project", "project_lite", "provisioning_events", "provisioning_percentage", "root_password", "short_id", "sos", "spot_instance", "spot_price_max", "ssh_keys", "state", "storage", "switch_uuid", "tags", "termination_time", "updated_at", "user", "userdata", "volumes"] + volumes: Optional[List[Href]] = None + __properties: ClassVar[List[str]] = ["actions", "always_pxe", "billing_cycle", "bonding_mode", "created_at", "created_by", "customdata", "description", "facility", "firmware_set_id", "hardware_reservation", "hostname", "href", "id", "image_url", "ip_addresses", "ipxe_script_url", "iqn", "locked", "metro", "network_frozen", "network_ports", "operating_system", "plan", "project", "project_lite", "provisioning_events", "provisioning_percentage", "root_password", "short_id", "sos", "spot_instance", "spot_price_max", "ssh_keys", "state", "storage", "switch_uuid", "tags", "termination_time", "updated_at", "user", "userdata", "volumes"] - @validator('state') + @field_validator('state') def state_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('queued', 'provisioning', 'deprovisioning', 'reinstalling', 'active', 'inactive', 'failed', 'powering_on', 'powering_off', 'deleted'): + if value not in set(['queued', 'provisioning', 'deprovisioning', 'reinstalling', 'active', 'inactive', 'failed', 'powering_on', 'powering_off', 'deleted']): raise ValueError("must be one of enum values ('queued', 'provisioning', 'deprovisioning', 'reinstalling', 'active', 'inactive', 'failed', 'powering_on', 'powering_off', 'deleted')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> Device: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Device from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in actions (list) _items = [] if self.actions: @@ -190,61 +207,62 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> Device: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Device from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Device.parse_obj(obj) + return cls.model_validate(obj) - _obj = Device.parse_obj({ - "actions": [DeviceActionsInner.from_dict(_item) for _item in obj.get("actions")] if obj.get("actions") is not None else None, + _obj = cls.model_validate({ + "actions": [DeviceActionsInner.from_dict(_item) for _item in obj["actions"]] if obj.get("actions") is not None else None, "always_pxe": obj.get("always_pxe"), "billing_cycle": obj.get("billing_cycle"), "bonding_mode": obj.get("bonding_mode"), "created_at": obj.get("created_at"), - "created_by": DeviceCreatedBy.from_dict(obj.get("created_by")) if obj.get("created_by") is not None else None, + "created_by": DeviceCreatedBy.from_dict(obj["created_by"]) if obj.get("created_by") is not None else None, "customdata": obj.get("customdata"), "description": obj.get("description"), - "facility": Facility.from_dict(obj.get("facility")) if obj.get("facility") is not None else None, + "facility": Facility.from_dict(obj["facility"]) if obj.get("facility") is not None else None, "firmware_set_id": obj.get("firmware_set_id"), - "hardware_reservation": HardwareReservation.from_dict(obj.get("hardware_reservation")) if obj.get("hardware_reservation") is not None else None, + "hardware_reservation": HardwareReservation.from_dict(obj["hardware_reservation"]) if obj.get("hardware_reservation") is not None else None, "hostname": obj.get("hostname"), "href": obj.get("href"), "id": obj.get("id"), "image_url": obj.get("image_url"), - "ip_addresses": [IPAssignment.from_dict(_item) for _item in obj.get("ip_addresses")] if obj.get("ip_addresses") is not None else None, + "ip_addresses": [IPAssignment.from_dict(_item) for _item in obj["ip_addresses"]] if obj.get("ip_addresses") is not None else None, "ipxe_script_url": obj.get("ipxe_script_url"), "iqn": obj.get("iqn"), "locked": obj.get("locked"), - "metro": DeviceMetro.from_dict(obj.get("metro")) if obj.get("metro") is not None else None, + "metro": DeviceMetro.from_dict(obj["metro"]) if obj.get("metro") is not None else None, "network_frozen": obj.get("network_frozen"), - "network_ports": [Port.from_dict(_item) for _item in obj.get("network_ports")] if obj.get("network_ports") is not None else None, - "operating_system": OperatingSystem.from_dict(obj.get("operating_system")) if obj.get("operating_system") is not None else None, - "plan": Plan.from_dict(obj.get("plan")) if obj.get("plan") is not None else None, - "project": Project.from_dict(obj.get("project")) if obj.get("project") is not None else None, - "project_lite": DeviceProjectLite.from_dict(obj.get("project_lite")) if obj.get("project_lite") is not None else None, - "provisioning_events": [Event.from_dict(_item) for _item in obj.get("provisioning_events")] if obj.get("provisioning_events") is not None else None, + "network_ports": [Port.from_dict(_item) for _item in obj["network_ports"]] if obj.get("network_ports") is not None else None, + "operating_system": OperatingSystem.from_dict(obj["operating_system"]) if obj.get("operating_system") is not None else None, + "plan": Plan.from_dict(obj["plan"]) if obj.get("plan") is not None else None, + "project": Project.from_dict(obj["project"]) if obj.get("project") is not None else None, + "project_lite": DeviceProjectLite.from_dict(obj["project_lite"]) if obj.get("project_lite") is not None else None, + "provisioning_events": [Event.from_dict(_item) for _item in obj["provisioning_events"]] if obj.get("provisioning_events") is not None else None, "provisioning_percentage": obj.get("provisioning_percentage"), "root_password": obj.get("root_password"), "short_id": obj.get("short_id"), "sos": obj.get("sos"), "spot_instance": obj.get("spot_instance"), "spot_price_max": obj.get("spot_price_max"), - "ssh_keys": [Href.from_dict(_item) for _item in obj.get("ssh_keys")] if obj.get("ssh_keys") is not None else None, + "ssh_keys": [Href.from_dict(_item) for _item in obj["ssh_keys"]] if obj.get("ssh_keys") is not None else None, "state": obj.get("state"), - "storage": Storage.from_dict(obj.get("storage")) if obj.get("storage") is not None else None, + "storage": Storage.from_dict(obj["storage"]) if obj.get("storage") is not None else None, "switch_uuid": obj.get("switch_uuid"), "tags": obj.get("tags"), "termination_time": obj.get("termination_time"), "updated_at": obj.get("updated_at"), "user": obj.get("user"), "userdata": obj.get("userdata"), - "volumes": [Href.from_dict(_item) for _item in obj.get("volumes")] if obj.get("volumes") is not None else None + "volumes": [Href.from_dict(_item) for _item in obj["volumes"]] if obj.get("volumes") is not None else None }) return _obj from equinix_metal.models.hardware_reservation import HardwareReservation -Device.update_forward_refs() +# TODO: Rewrite to not use raise_errors +Device.model_rebuild(raise_errors=False) diff --git a/equinix_metal/equinix_metal/models/device_action_input.py b/equinix_metal/equinix_metal/models/device_action_input.py index 5c615d8b..dd399c6a 100644 --- a/equinix_metal/equinix_metal/models/device_action_input.py +++ b/equinix_metal/equinix_metal/models/device_action_input.py @@ -18,66 +18,82 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictBool, StrictStr, validator +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class DeviceActionInput(BaseModel): """ DeviceActionInput - """ - deprovision_fast: Optional[StrictBool] = Field(None, description="When type is `reinstall`, enabling fast deprovisioning will bypass full disk wiping.") - force_delete: Optional[StrictBool] = Field(None, description="May be required to perform actions under certain conditions") + """ # noqa: E501 + deprovision_fast: Optional[StrictBool] = Field(default=None, description="When type is `reinstall`, enabling fast deprovisioning will bypass full disk wiping.") + force_delete: Optional[StrictBool] = Field(default=None, description="May be required to perform actions under certain conditions") href: Optional[StrictStr] = None - ipxe_script_url: Optional[StrictStr] = Field(None, description="When type is `reinstall`, use this `ipxe_script_url` (`operating_system` must be `custom_ipxe`, defaults to the current `ipxe_script_url`)") - operating_system: Optional[StrictStr] = Field(None, description="When type is `reinstall`, use this `operating_system` (defaults to the current `operating system`)") - preserve_data: Optional[StrictBool] = Field(None, description="When type is `reinstall`, preserve the existing data on all disks except the operating-system disk.") - type: StrictStr = Field(..., description="Action to perform. See Device.actions for possible actions.") - __properties = ["deprovision_fast", "force_delete", "href", "ipxe_script_url", "operating_system", "preserve_data", "type"] + ipxe_script_url: Optional[StrictStr] = Field(default=None, description="When type is `reinstall`, use this `ipxe_script_url` (`operating_system` must be `custom_ipxe`, defaults to the current `ipxe_script_url`)") + operating_system: Optional[StrictStr] = Field(default=None, description="When type is `reinstall`, use this `operating_system` (defaults to the current `operating system`)") + preserve_data: Optional[StrictBool] = Field(default=None, description="When type is `reinstall`, preserve the existing data on all disks except the operating-system disk.") + type: StrictStr = Field(description="Action to perform. See Device.actions for possible actions.") + __properties: ClassVar[List[str]] = ["deprovision_fast", "force_delete", "href", "ipxe_script_url", "operating_system", "preserve_data", "type"] - @validator('type') + @field_validator('type') def type_validate_enum(cls, value): """Validates the enum""" - if value not in ('power_on', 'power_off', 'reboot', 'rescue', 'reinstall'): + if value not in set(['power_on', 'power_off', 'reboot', 'rescue', 'reinstall']): raise ValueError("must be one of enum values ('power_on', 'power_off', 'reboot', 'rescue', 'reinstall')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> DeviceActionInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of DeviceActionInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> DeviceActionInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of DeviceActionInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return DeviceActionInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = DeviceActionInput.parse_obj({ + _obj = cls.model_validate({ "deprovision_fast": obj.get("deprovision_fast"), "force_delete": obj.get("force_delete"), "href": obj.get("href"), diff --git a/equinix_metal/equinix_metal/models/device_actions_inner.py b/equinix_metal/equinix_metal/models/device_actions_inner.py index b4343bc2..939ae958 100644 --- a/equinix_metal/equinix_metal/models/device_actions_inner.py +++ b/equinix_metal/equinix_metal/models/device_actions_inner.py @@ -18,55 +18,71 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class DeviceActionsInner(BaseModel): """ DeviceActionsInner - """ + """ # noqa: E501 href: Optional[StrictStr] = None name: Optional[StrictStr] = None type: Optional[StrictStr] = None - __properties = ["href", "name", "type"] + __properties: ClassVar[List[str]] = ["href", "name", "type"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> DeviceActionsInner: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of DeviceActionsInner from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> DeviceActionsInner: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of DeviceActionsInner from a dict""" if obj is None: return None if not isinstance(obj, dict): - return DeviceActionsInner.parse_obj(obj) + return cls.model_validate(obj) - _obj = DeviceActionsInner.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), "name": obj.get("name"), "type": obj.get("type") diff --git a/equinix_metal/equinix_metal/models/device_create_in_facility_input.py b/equinix_metal/equinix_metal/models/device_create_in_facility_input.py index bbc231df..25ee735a 100644 --- a/equinix_metal/equinix_metal/models/device_create_in_facility_input.py +++ b/equinix_metal/equinix_metal/models/device_create_in_facility_input.py @@ -19,80 +19,97 @@ import json from datetime import datetime -from typing import Any, Dict, List, Optional, Union -from pydantic import BaseModel, Field, StrictBool, StrictFloat, StrictInt, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union from equinix_metal.models.facility_input_facility import FacilityInputFacility from equinix_metal.models.ip_address import IPAddress from equinix_metal.models.ssh_key_input import SSHKeyInput from equinix_metal.models.storage import Storage +from typing import Optional, Set +from typing_extensions import Self class DeviceCreateInFacilityInput(BaseModel): """ DeviceCreateInFacilityInput - """ - facility: FacilityInputFacility = Field(...) + """ # noqa: E501 + facility: FacilityInputFacility href: Optional[StrictStr] = None - always_pxe: Optional[StrictBool] = Field(None, description="When true, devices with a `custom_ipxe` OS will always boot to iPXE. The default setting of false ensures that iPXE will be used on only the first boot.") - billing_cycle: Optional[StrictStr] = Field(None, description="The billing cycle of the device.") - customdata: Optional[Dict[str, Any]] = Field(None, description="Customdata is an arbitrary JSON value that can be accessed via the metadata service.") - description: Optional[StrictStr] = Field(None, description="Any description of the device or how it will be used. This may be used to inform other API consumers with project access.") - features: Optional[conlist(StrictStr)] = Field(None, description="The features attribute allows you to optionally specify what features your server should have. In the API shorthand syntax, all features listed are `required`: ``` { \"features\": [\"tpm\"] } ``` Alternatively, if you do not require a certain feature, but would prefer to be assigned a server with that feature if there are any available, you may specify that feature with a `preferred` value. The request will not fail if we have no servers with that feature in our inventory. The API offers an alternative syntax for mixing preferred and required features: ``` { \"features\": { \"tpm\": \"required\", \"raid\": \"preferred\" } } ``` The request will only fail if there are no available servers matching the required `tpm` criteria.") - hardware_reservation_id: Optional[StrictStr] = Field(None, description="The Hardware Reservation UUID to provision. Alternatively, `next-available` can be specified to select from any of the available hardware reservations. An error will be returned if the requested reservation option is not available. See [Reserved Hardware](https://metal.equinix.com/developers/docs/deploy/reserved/) for more details.") - hostname: Optional[StrictStr] = Field(None, description="The hostname to use within the operating system. The same hostname may be used on multiple devices within a project.") - ip_addresses: Optional[conlist(IPAddress)] = Field(None, description="The `ip_addresses attribute will allow you to specify the addresses you want created with your device. The default value configures public IPv4, public IPv6, and private IPv4. Private IPv4 address is required. When specifying `ip_addresses`, one of the array items must enable private IPv4. Some operating systems require public IPv4 address. In those cases you will receive an error message if public IPv4 is not enabled. For example, to only configure your server with a private IPv4 address, you can send `{ \"ip_addresses\": [{ \"address_family\": 4, \"public\": false }] }`. It is possible to request a subnet size larger than a `/30` by assigning addresses using the UUID(s) of ip_reservations in your project. For example, `{ \"ip_addresses\": [..., {\"address_family\": 4, \"public\": true, \"ip_reservations\": [\"uuid1\", \"uuid2\"]}] }` To access a server without public IPs, you can use our Out-of-Band console access (SOS) or proxy through another server in the project with public IPs enabled.") - ipxe_script_url: Optional[StrictStr] = Field(None, description="When set, the device will chainload an iPXE Script at boot fetched from the supplied URL. See [Custom iPXE](https://metal.equinix.com/developers/docs/operating-systems/custom-ipxe/) for more details.") - locked: Optional[StrictBool] = Field(False, description="Whether the device should be locked, preventing accidental deletion.") - network_frozen: Optional[StrictBool] = Field(None, description="If true, this instance can not be converted to a different network type.") - no_ssh_keys: Optional[StrictBool] = Field(False, description="Overrides default behaviour of attaching all of the organization members ssh keys and project ssh keys to device if no specific keys specified") - operating_system: StrictStr = Field(..., description="The slug of the operating system to provision. Check the Equinix Metal operating system documentation for rules that may be imposed per operating system, including restrictions on IP address options and device plans.") - plan: StrictStr = Field(..., description="The slug of the device plan to provision.") - private_ipv4_subnet_size: Optional[StrictInt] = Field(28, description="Deprecated. Use ip_addresses. Subnet range for addresses allocated to this device.") - project_ssh_keys: Optional[conlist(StrictStr)] = Field(None, description="A list of UUIDs identifying the device parent project that should be authorized to access this device (typically via /root/.ssh/authorized_keys). These keys will also appear in the device metadata. If no SSH keys are specified (`user_ssh_keys`, `project_ssh_keys`, and `ssh_keys` are all empty lists or omitted), all parent project keys, parent project members keys and organization members keys will be included. This behaviour can be changed with 'no_ssh_keys' option to omit any SSH key being added. ") - public_ipv4_subnet_size: Optional[StrictInt] = Field(31, description="Deprecated. Use ip_addresses. Subnet range for addresses allocated to this device. Your project must have addresses available for a non-default request.") - spot_instance: Optional[StrictBool] = Field(None, description="Create a spot instance. Spot instances are created with a maximum bid price. If the bid price is not met, the spot instance will be terminated as indicated by the `termination_time` field.") - spot_price_max: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="The maximum amount to bid for a spot instance.") - ssh_keys: Optional[conlist(SSHKeyInput)] = Field(None, description="A list of new or existing project ssh_keys that should be authorized to access this device (typically via /root/.ssh/authorized_keys). These keys will also appear in the device metadata. These keys are added in addition to any keys defined by `project_ssh_keys` and `user_ssh_keys`. ") + always_pxe: Optional[StrictBool] = Field(default=None, description="When true, devices with a `custom_ipxe` OS will always boot to iPXE. The default setting of false ensures that iPXE will be used on only the first boot.") + billing_cycle: Optional[StrictStr] = Field(default=None, description="The billing cycle of the device.") + customdata: Optional[Dict[str, Any]] = Field(default=None, description="Customdata is an arbitrary JSON value that can be accessed via the metadata service.") + description: Optional[StrictStr] = Field(default=None, description="Any description of the device or how it will be used. This may be used to inform other API consumers with project access.") + features: Optional[List[StrictStr]] = Field(default=None, description="The features attribute allows you to optionally specify what features your server should have. In the API shorthand syntax, all features listed are `required`: ``` { \"features\": [\"tpm\"] } ``` Alternatively, if you do not require a certain feature, but would prefer to be assigned a server with that feature if there are any available, you may specify that feature with a `preferred` value. The request will not fail if we have no servers with that feature in our inventory. The API offers an alternative syntax for mixing preferred and required features: ``` { \"features\": { \"tpm\": \"required\", \"raid\": \"preferred\" } } ``` The request will only fail if there are no available servers matching the required `tpm` criteria.") + hardware_reservation_id: Optional[StrictStr] = Field(default=None, description="The Hardware Reservation UUID to provision. Alternatively, `next-available` can be specified to select from any of the available hardware reservations. An error will be returned if the requested reservation option is not available. See [Reserved Hardware](https://metal.equinix.com/developers/docs/deploy/reserved/) for more details.") + hostname: Optional[StrictStr] = Field(default=None, description="The hostname to use within the operating system. The same hostname may be used on multiple devices within a project.") + ip_addresses: Optional[List[IPAddress]] = Field(default=None, description="The `ip_addresses attribute will allow you to specify the addresses you want created with your device. The default value configures public IPv4, public IPv6, and private IPv4. Private IPv4 address is required. When specifying `ip_addresses`, one of the array items must enable private IPv4. Some operating systems require public IPv4 address. In those cases you will receive an error message if public IPv4 is not enabled. For example, to only configure your server with a private IPv4 address, you can send `{ \"ip_addresses\": [{ \"address_family\": 4, \"public\": false }] }`. It is possible to request a subnet size larger than a `/30` by assigning addresses using the UUID(s) of ip_reservations in your project. For example, `{ \"ip_addresses\": [..., {\"address_family\": 4, \"public\": true, \"ip_reservations\": [\"uuid1\", \"uuid2\"]}] }` To access a server without public IPs, you can use our Out-of-Band console access (SOS) or proxy through another server in the project with public IPs enabled.") + ipxe_script_url: Optional[StrictStr] = Field(default=None, description="When set, the device will chainload an iPXE Script at boot fetched from the supplied URL. See [Custom iPXE](https://metal.equinix.com/developers/docs/operating-systems/custom-ipxe/) for more details.") + locked: Optional[StrictBool] = Field(default=False, description="Whether the device should be locked, preventing accidental deletion.") + network_frozen: Optional[StrictBool] = Field(default=None, description="If true, this instance can not be converted to a different network type.") + no_ssh_keys: Optional[StrictBool] = Field(default=False, description="Overrides default behaviour of attaching all of the organization members ssh keys and project ssh keys to device if no specific keys specified") + operating_system: StrictStr = Field(description="The slug of the operating system to provision. Check the Equinix Metal operating system documentation for rules that may be imposed per operating system, including restrictions on IP address options and device plans.") + plan: StrictStr = Field(description="The slug of the device plan to provision.") + private_ipv4_subnet_size: Optional[StrictInt] = Field(default=28, description="Deprecated. Use ip_addresses. Subnet range for addresses allocated to this device.") + project_ssh_keys: Optional[List[StrictStr]] = Field(default=None, description="A list of UUIDs identifying the device parent project that should be authorized to access this device (typically via /root/.ssh/authorized_keys). These keys will also appear in the device metadata. If no SSH keys are specified (`user_ssh_keys`, `project_ssh_keys`, and `ssh_keys` are all empty lists or omitted), all parent project keys, parent project members keys and organization members keys will be included. This behaviour can be changed with 'no_ssh_keys' option to omit any SSH key being added. ") + public_ipv4_subnet_size: Optional[StrictInt] = Field(default=31, description="Deprecated. Use ip_addresses. Subnet range for addresses allocated to this device. Your project must have addresses available for a non-default request.") + spot_instance: Optional[StrictBool] = Field(default=None, description="Create a spot instance. Spot instances are created with a maximum bid price. If the bid price is not met, the spot instance will be terminated as indicated by the `termination_time` field.") + spot_price_max: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The maximum amount to bid for a spot instance.") + ssh_keys: Optional[List[SSHKeyInput]] = Field(default=None, description="A list of new or existing project ssh_keys that should be authorized to access this device (typically via /root/.ssh/authorized_keys). These keys will also appear in the device metadata. These keys are added in addition to any keys defined by `project_ssh_keys` and `user_ssh_keys`. ") storage: Optional[Storage] = None - tags: Optional[conlist(StrictStr)] = None - termination_time: Optional[datetime] = Field(None, description="When the device will be terminated. If you don't supply timezone info, the timestamp is assumed to be in UTC. This is commonly set in advance for ephemeral spot market instances but this field may also be set with on-demand and reservation instances to automatically delete the resource at a given time. The termination time can also be used to release a hardware reservation instance at a given time, keeping the reservation open for other uses. On a spot market device, the termination time will be set automatically when outbid. ") - user_ssh_keys: Optional[conlist(StrictStr)] = Field(None, description="A list of UUIDs identifying the users that should be authorized to access this device (typically via /root/.ssh/authorized_keys). These keys will also appear in the device metadata. The users must be members of the project or organization. If no SSH keys are specified (`user_ssh_keys`, `project_ssh_keys`, and `ssh_keys` are all empty lists or omitted), all parent project keys, parent project members keys and organization members keys will be included. This behaviour can be changed with 'no_ssh_keys' option to omit any SSH key being added. ") - userdata: Optional[StrictStr] = Field(None, description="The userdata presented in the metadata service for this device. Userdata is fetched and interpreted by the operating system installed on the device. Acceptable formats are determined by the operating system, with the exception of a special iPXE enabling syntax which is handled before the operating system starts. See [Server User Data](https://metal.equinix.com/developers/docs/servers/user-data/) and [Provisioning with Custom iPXE](https://metal.equinix.com/developers/docs/operating-systems/custom-ipxe/#provisioning-with-custom-ipxe) for more details.") - __properties = ["facility", "href", "always_pxe", "billing_cycle", "customdata", "description", "features", "hardware_reservation_id", "hostname", "ip_addresses", "ipxe_script_url", "locked", "network_frozen", "no_ssh_keys", "operating_system", "plan", "private_ipv4_subnet_size", "project_ssh_keys", "public_ipv4_subnet_size", "spot_instance", "spot_price_max", "ssh_keys", "storage", "tags", "termination_time", "user_ssh_keys", "userdata"] + tags: Optional[List[StrictStr]] = None + termination_time: Optional[datetime] = Field(default=None, description="When the device will be terminated. If you don't supply timezone info, the timestamp is assumed to be in UTC. This is commonly set in advance for ephemeral spot market instances but this field may also be set with on-demand and reservation instances to automatically delete the resource at a given time. The termination time can also be used to release a hardware reservation instance at a given time, keeping the reservation open for other uses. On a spot market device, the termination time will be set automatically when outbid. ") + user_ssh_keys: Optional[List[StrictStr]] = Field(default=None, description="A list of UUIDs identifying the users that should be authorized to access this device (typically via /root/.ssh/authorized_keys). These keys will also appear in the device metadata. The users must be members of the project or organization. If no SSH keys are specified (`user_ssh_keys`, `project_ssh_keys`, and `ssh_keys` are all empty lists or omitted), all parent project keys, parent project members keys and organization members keys will be included. This behaviour can be changed with 'no_ssh_keys' option to omit any SSH key being added. ") + userdata: Optional[StrictStr] = Field(default=None, description="The userdata presented in the metadata service for this device. Userdata is fetched and interpreted by the operating system installed on the device. Acceptable formats are determined by the operating system, with the exception of a special iPXE enabling syntax which is handled before the operating system starts. See [Server User Data](https://metal.equinix.com/developers/docs/servers/user-data/) and [Provisioning with Custom iPXE](https://metal.equinix.com/developers/docs/operating-systems/custom-ipxe/#provisioning-with-custom-ipxe) for more details.") + __properties: ClassVar[List[str]] = ["facility", "href", "always_pxe", "billing_cycle", "customdata", "description", "features", "hardware_reservation_id", "hostname", "ip_addresses", "ipxe_script_url", "locked", "network_frozen", "no_ssh_keys", "operating_system", "plan", "private_ipv4_subnet_size", "project_ssh_keys", "public_ipv4_subnet_size", "spot_instance", "spot_price_max", "ssh_keys", "storage", "tags", "termination_time", "user_ssh_keys", "userdata"] - @validator('billing_cycle') + @field_validator('billing_cycle') def billing_cycle_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('hourly', 'daily', 'monthly', 'yearly'): + if value not in set(['hourly', 'daily', 'monthly', 'yearly']): raise ValueError("must be one of enum values ('hourly', 'daily', 'monthly', 'yearly')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> DeviceCreateInFacilityInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of DeviceCreateInFacilityInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of facility if self.facility: _dict['facility'] = self.facility.to_dict() @@ -116,16 +133,16 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> DeviceCreateInFacilityInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of DeviceCreateInFacilityInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return DeviceCreateInFacilityInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = DeviceCreateInFacilityInput.parse_obj({ - "facility": FacilityInputFacility.from_dict(obj.get("facility")) if obj.get("facility") is not None else None, + _obj = cls.model_validate({ + "facility": FacilityInputFacility.from_dict(obj["facility"]) if obj.get("facility") is not None else None, "href": obj.get("href"), "always_pxe": obj.get("always_pxe"), "billing_cycle": obj.get("billing_cycle"), @@ -134,7 +151,7 @@ def from_dict(cls, obj: dict) -> DeviceCreateInFacilityInput: "features": obj.get("features"), "hardware_reservation_id": obj.get("hardware_reservation_id"), "hostname": obj.get("hostname"), - "ip_addresses": [IPAddress.from_dict(_item) for _item in obj.get("ip_addresses")] if obj.get("ip_addresses") is not None else None, + "ip_addresses": [IPAddress.from_dict(_item) for _item in obj["ip_addresses"]] if obj.get("ip_addresses") is not None else None, "ipxe_script_url": obj.get("ipxe_script_url"), "locked": obj.get("locked") if obj.get("locked") is not None else False, "network_frozen": obj.get("network_frozen"), @@ -146,8 +163,8 @@ def from_dict(cls, obj: dict) -> DeviceCreateInFacilityInput: "public_ipv4_subnet_size": obj.get("public_ipv4_subnet_size") if obj.get("public_ipv4_subnet_size") is not None else 31, "spot_instance": obj.get("spot_instance"), "spot_price_max": obj.get("spot_price_max"), - "ssh_keys": [SSHKeyInput.from_dict(_item) for _item in obj.get("ssh_keys")] if obj.get("ssh_keys") is not None else None, - "storage": Storage.from_dict(obj.get("storage")) if obj.get("storage") is not None else None, + "ssh_keys": [SSHKeyInput.from_dict(_item) for _item in obj["ssh_keys"]] if obj.get("ssh_keys") is not None else None, + "storage": Storage.from_dict(obj["storage"]) if obj.get("storage") is not None else None, "tags": obj.get("tags"), "termination_time": obj.get("termination_time"), "user_ssh_keys": obj.get("user_ssh_keys"), diff --git a/equinix_metal/equinix_metal/models/device_create_in_metro_input.py b/equinix_metal/equinix_metal/models/device_create_in_metro_input.py index c1fd1252..5ac8be68 100644 --- a/equinix_metal/equinix_metal/models/device_create_in_metro_input.py +++ b/equinix_metal/equinix_metal/models/device_create_in_metro_input.py @@ -19,79 +19,96 @@ import json from datetime import datetime -from typing import Any, Dict, List, Optional, Union -from pydantic import BaseModel, Field, StrictBool, StrictFloat, StrictInt, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union from equinix_metal.models.ip_address import IPAddress from equinix_metal.models.ssh_key_input import SSHKeyInput from equinix_metal.models.storage import Storage +from typing import Optional, Set +from typing_extensions import Self class DeviceCreateInMetroInput(BaseModel): """ DeviceCreateInMetroInput - """ + """ # noqa: E501 href: Optional[StrictStr] = None - metro: StrictStr = Field(..., description="Metro code or ID of where the instance should be provisioned in. Either metro or facility must be provided.") - always_pxe: Optional[StrictBool] = Field(None, description="When true, devices with a `custom_ipxe` OS will always boot to iPXE. The default setting of false ensures that iPXE will be used on only the first boot.") - billing_cycle: Optional[StrictStr] = Field(None, description="The billing cycle of the device.") - customdata: Optional[Dict[str, Any]] = Field(None, description="Customdata is an arbitrary JSON value that can be accessed via the metadata service.") - description: Optional[StrictStr] = Field(None, description="Any description of the device or how it will be used. This may be used to inform other API consumers with project access.") - features: Optional[conlist(StrictStr)] = Field(None, description="The features attribute allows you to optionally specify what features your server should have. In the API shorthand syntax, all features listed are `required`: ``` { \"features\": [\"tpm\"] } ``` Alternatively, if you do not require a certain feature, but would prefer to be assigned a server with that feature if there are any available, you may specify that feature with a `preferred` value. The request will not fail if we have no servers with that feature in our inventory. The API offers an alternative syntax for mixing preferred and required features: ``` { \"features\": { \"tpm\": \"required\", \"raid\": \"preferred\" } } ``` The request will only fail if there are no available servers matching the required `tpm` criteria.") - hardware_reservation_id: Optional[StrictStr] = Field(None, description="The Hardware Reservation UUID to provision. Alternatively, `next-available` can be specified to select from any of the available hardware reservations. An error will be returned if the requested reservation option is not available. See [Reserved Hardware](https://metal.equinix.com/developers/docs/deploy/reserved/) for more details.") - hostname: Optional[StrictStr] = Field(None, description="The hostname to use within the operating system. The same hostname may be used on multiple devices within a project.") - ip_addresses: Optional[conlist(IPAddress)] = Field(None, description="The `ip_addresses attribute will allow you to specify the addresses you want created with your device. The default value configures public IPv4, public IPv6, and private IPv4. Private IPv4 address is required. When specifying `ip_addresses`, one of the array items must enable private IPv4. Some operating systems require public IPv4 address. In those cases you will receive an error message if public IPv4 is not enabled. For example, to only configure your server with a private IPv4 address, you can send `{ \"ip_addresses\": [{ \"address_family\": 4, \"public\": false }] }`. It is possible to request a subnet size larger than a `/30` by assigning addresses using the UUID(s) of ip_reservations in your project. For example, `{ \"ip_addresses\": [..., {\"address_family\": 4, \"public\": true, \"ip_reservations\": [\"uuid1\", \"uuid2\"]}] }` To access a server without public IPs, you can use our Out-of-Band console access (SOS) or proxy through another server in the project with public IPs enabled.") - ipxe_script_url: Optional[StrictStr] = Field(None, description="When set, the device will chainload an iPXE Script at boot fetched from the supplied URL. See [Custom iPXE](https://metal.equinix.com/developers/docs/operating-systems/custom-ipxe/) for more details.") - locked: Optional[StrictBool] = Field(False, description="Whether the device should be locked, preventing accidental deletion.") - network_frozen: Optional[StrictBool] = Field(None, description="If true, this instance can not be converted to a different network type.") - no_ssh_keys: Optional[StrictBool] = Field(False, description="Overrides default behaviour of attaching all of the organization members ssh keys and project ssh keys to device if no specific keys specified") - operating_system: StrictStr = Field(..., description="The slug of the operating system to provision. Check the Equinix Metal operating system documentation for rules that may be imposed per operating system, including restrictions on IP address options and device plans.") - plan: StrictStr = Field(..., description="The slug of the device plan to provision.") - private_ipv4_subnet_size: Optional[StrictInt] = Field(28, description="Deprecated. Use ip_addresses. Subnet range for addresses allocated to this device.") - project_ssh_keys: Optional[conlist(StrictStr)] = Field(None, description="A list of UUIDs identifying the device parent project that should be authorized to access this device (typically via /root/.ssh/authorized_keys). These keys will also appear in the device metadata. If no SSH keys are specified (`user_ssh_keys`, `project_ssh_keys`, and `ssh_keys` are all empty lists or omitted), all parent project keys, parent project members keys and organization members keys will be included. This behaviour can be changed with 'no_ssh_keys' option to omit any SSH key being added. ") - public_ipv4_subnet_size: Optional[StrictInt] = Field(31, description="Deprecated. Use ip_addresses. Subnet range for addresses allocated to this device. Your project must have addresses available for a non-default request.") - spot_instance: Optional[StrictBool] = Field(None, description="Create a spot instance. Spot instances are created with a maximum bid price. If the bid price is not met, the spot instance will be terminated as indicated by the `termination_time` field.") - spot_price_max: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="The maximum amount to bid for a spot instance.") - ssh_keys: Optional[conlist(SSHKeyInput)] = Field(None, description="A list of new or existing project ssh_keys that should be authorized to access this device (typically via /root/.ssh/authorized_keys). These keys will also appear in the device metadata. These keys are added in addition to any keys defined by `project_ssh_keys` and `user_ssh_keys`. ") + metro: StrictStr = Field(description="Metro code or ID of where the instance should be provisioned in. Either metro or facility must be provided.") + always_pxe: Optional[StrictBool] = Field(default=None, description="When true, devices with a `custom_ipxe` OS will always boot to iPXE. The default setting of false ensures that iPXE will be used on only the first boot.") + billing_cycle: Optional[StrictStr] = Field(default=None, description="The billing cycle of the device.") + customdata: Optional[Dict[str, Any]] = Field(default=None, description="Customdata is an arbitrary JSON value that can be accessed via the metadata service.") + description: Optional[StrictStr] = Field(default=None, description="Any description of the device or how it will be used. This may be used to inform other API consumers with project access.") + features: Optional[List[StrictStr]] = Field(default=None, description="The features attribute allows you to optionally specify what features your server should have. In the API shorthand syntax, all features listed are `required`: ``` { \"features\": [\"tpm\"] } ``` Alternatively, if you do not require a certain feature, but would prefer to be assigned a server with that feature if there are any available, you may specify that feature with a `preferred` value. The request will not fail if we have no servers with that feature in our inventory. The API offers an alternative syntax for mixing preferred and required features: ``` { \"features\": { \"tpm\": \"required\", \"raid\": \"preferred\" } } ``` The request will only fail if there are no available servers matching the required `tpm` criteria.") + hardware_reservation_id: Optional[StrictStr] = Field(default=None, description="The Hardware Reservation UUID to provision. Alternatively, `next-available` can be specified to select from any of the available hardware reservations. An error will be returned if the requested reservation option is not available. See [Reserved Hardware](https://metal.equinix.com/developers/docs/deploy/reserved/) for more details.") + hostname: Optional[StrictStr] = Field(default=None, description="The hostname to use within the operating system. The same hostname may be used on multiple devices within a project.") + ip_addresses: Optional[List[IPAddress]] = Field(default=None, description="The `ip_addresses attribute will allow you to specify the addresses you want created with your device. The default value configures public IPv4, public IPv6, and private IPv4. Private IPv4 address is required. When specifying `ip_addresses`, one of the array items must enable private IPv4. Some operating systems require public IPv4 address. In those cases you will receive an error message if public IPv4 is not enabled. For example, to only configure your server with a private IPv4 address, you can send `{ \"ip_addresses\": [{ \"address_family\": 4, \"public\": false }] }`. It is possible to request a subnet size larger than a `/30` by assigning addresses using the UUID(s) of ip_reservations in your project. For example, `{ \"ip_addresses\": [..., {\"address_family\": 4, \"public\": true, \"ip_reservations\": [\"uuid1\", \"uuid2\"]}] }` To access a server without public IPs, you can use our Out-of-Band console access (SOS) or proxy through another server in the project with public IPs enabled.") + ipxe_script_url: Optional[StrictStr] = Field(default=None, description="When set, the device will chainload an iPXE Script at boot fetched from the supplied URL. See [Custom iPXE](https://metal.equinix.com/developers/docs/operating-systems/custom-ipxe/) for more details.") + locked: Optional[StrictBool] = Field(default=False, description="Whether the device should be locked, preventing accidental deletion.") + network_frozen: Optional[StrictBool] = Field(default=None, description="If true, this instance can not be converted to a different network type.") + no_ssh_keys: Optional[StrictBool] = Field(default=False, description="Overrides default behaviour of attaching all of the organization members ssh keys and project ssh keys to device if no specific keys specified") + operating_system: StrictStr = Field(description="The slug of the operating system to provision. Check the Equinix Metal operating system documentation for rules that may be imposed per operating system, including restrictions on IP address options and device plans.") + plan: StrictStr = Field(description="The slug of the device plan to provision.") + private_ipv4_subnet_size: Optional[StrictInt] = Field(default=28, description="Deprecated. Use ip_addresses. Subnet range for addresses allocated to this device.") + project_ssh_keys: Optional[List[StrictStr]] = Field(default=None, description="A list of UUIDs identifying the device parent project that should be authorized to access this device (typically via /root/.ssh/authorized_keys). These keys will also appear in the device metadata. If no SSH keys are specified (`user_ssh_keys`, `project_ssh_keys`, and `ssh_keys` are all empty lists or omitted), all parent project keys, parent project members keys and organization members keys will be included. This behaviour can be changed with 'no_ssh_keys' option to omit any SSH key being added. ") + public_ipv4_subnet_size: Optional[StrictInt] = Field(default=31, description="Deprecated. Use ip_addresses. Subnet range for addresses allocated to this device. Your project must have addresses available for a non-default request.") + spot_instance: Optional[StrictBool] = Field(default=None, description="Create a spot instance. Spot instances are created with a maximum bid price. If the bid price is not met, the spot instance will be terminated as indicated by the `termination_time` field.") + spot_price_max: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The maximum amount to bid for a spot instance.") + ssh_keys: Optional[List[SSHKeyInput]] = Field(default=None, description="A list of new or existing project ssh_keys that should be authorized to access this device (typically via /root/.ssh/authorized_keys). These keys will also appear in the device metadata. These keys are added in addition to any keys defined by `project_ssh_keys` and `user_ssh_keys`. ") storage: Optional[Storage] = None - tags: Optional[conlist(StrictStr)] = None - termination_time: Optional[datetime] = Field(None, description="When the device will be terminated. If you don't supply timezone info, the timestamp is assumed to be in UTC. This is commonly set in advance for ephemeral spot market instances but this field may also be set with on-demand and reservation instances to automatically delete the resource at a given time. The termination time can also be used to release a hardware reservation instance at a given time, keeping the reservation open for other uses. On a spot market device, the termination time will be set automatically when outbid. ") - user_ssh_keys: Optional[conlist(StrictStr)] = Field(None, description="A list of UUIDs identifying the users that should be authorized to access this device (typically via /root/.ssh/authorized_keys). These keys will also appear in the device metadata. The users must be members of the project or organization. If no SSH keys are specified (`user_ssh_keys`, `project_ssh_keys`, and `ssh_keys` are all empty lists or omitted), all parent project keys, parent project members keys and organization members keys will be included. This behaviour can be changed with 'no_ssh_keys' option to omit any SSH key being added. ") - userdata: Optional[StrictStr] = Field(None, description="The userdata presented in the metadata service for this device. Userdata is fetched and interpreted by the operating system installed on the device. Acceptable formats are determined by the operating system, with the exception of a special iPXE enabling syntax which is handled before the operating system starts. See [Server User Data](https://metal.equinix.com/developers/docs/servers/user-data/) and [Provisioning with Custom iPXE](https://metal.equinix.com/developers/docs/operating-systems/custom-ipxe/#provisioning-with-custom-ipxe) for more details.") - __properties = ["href", "metro", "always_pxe", "billing_cycle", "customdata", "description", "features", "hardware_reservation_id", "hostname", "ip_addresses", "ipxe_script_url", "locked", "network_frozen", "no_ssh_keys", "operating_system", "plan", "private_ipv4_subnet_size", "project_ssh_keys", "public_ipv4_subnet_size", "spot_instance", "spot_price_max", "ssh_keys", "storage", "tags", "termination_time", "user_ssh_keys", "userdata"] + tags: Optional[List[StrictStr]] = None + termination_time: Optional[datetime] = Field(default=None, description="When the device will be terminated. If you don't supply timezone info, the timestamp is assumed to be in UTC. This is commonly set in advance for ephemeral spot market instances but this field may also be set with on-demand and reservation instances to automatically delete the resource at a given time. The termination time can also be used to release a hardware reservation instance at a given time, keeping the reservation open for other uses. On a spot market device, the termination time will be set automatically when outbid. ") + user_ssh_keys: Optional[List[StrictStr]] = Field(default=None, description="A list of UUIDs identifying the users that should be authorized to access this device (typically via /root/.ssh/authorized_keys). These keys will also appear in the device metadata. The users must be members of the project or organization. If no SSH keys are specified (`user_ssh_keys`, `project_ssh_keys`, and `ssh_keys` are all empty lists or omitted), all parent project keys, parent project members keys and organization members keys will be included. This behaviour can be changed with 'no_ssh_keys' option to omit any SSH key being added. ") + userdata: Optional[StrictStr] = Field(default=None, description="The userdata presented in the metadata service for this device. Userdata is fetched and interpreted by the operating system installed on the device. Acceptable formats are determined by the operating system, with the exception of a special iPXE enabling syntax which is handled before the operating system starts. See [Server User Data](https://metal.equinix.com/developers/docs/servers/user-data/) and [Provisioning with Custom iPXE](https://metal.equinix.com/developers/docs/operating-systems/custom-ipxe/#provisioning-with-custom-ipxe) for more details.") + __properties: ClassVar[List[str]] = ["href", "metro", "always_pxe", "billing_cycle", "customdata", "description", "features", "hardware_reservation_id", "hostname", "ip_addresses", "ipxe_script_url", "locked", "network_frozen", "no_ssh_keys", "operating_system", "plan", "private_ipv4_subnet_size", "project_ssh_keys", "public_ipv4_subnet_size", "spot_instance", "spot_price_max", "ssh_keys", "storage", "tags", "termination_time", "user_ssh_keys", "userdata"] - @validator('billing_cycle') + @field_validator('billing_cycle') def billing_cycle_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('hourly', 'daily', 'monthly', 'yearly'): + if value not in set(['hourly', 'daily', 'monthly', 'yearly']): raise ValueError("must be one of enum values ('hourly', 'daily', 'monthly', 'yearly')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> DeviceCreateInMetroInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of DeviceCreateInMetroInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in ip_addresses (list) _items = [] if self.ip_addresses: @@ -112,15 +129,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> DeviceCreateInMetroInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of DeviceCreateInMetroInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return DeviceCreateInMetroInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = DeviceCreateInMetroInput.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), "metro": obj.get("metro"), "always_pxe": obj.get("always_pxe"), @@ -130,7 +147,7 @@ def from_dict(cls, obj: dict) -> DeviceCreateInMetroInput: "features": obj.get("features"), "hardware_reservation_id": obj.get("hardware_reservation_id"), "hostname": obj.get("hostname"), - "ip_addresses": [IPAddress.from_dict(_item) for _item in obj.get("ip_addresses")] if obj.get("ip_addresses") is not None else None, + "ip_addresses": [IPAddress.from_dict(_item) for _item in obj["ip_addresses"]] if obj.get("ip_addresses") is not None else None, "ipxe_script_url": obj.get("ipxe_script_url"), "locked": obj.get("locked") if obj.get("locked") is not None else False, "network_frozen": obj.get("network_frozen"), @@ -142,8 +159,8 @@ def from_dict(cls, obj: dict) -> DeviceCreateInMetroInput: "public_ipv4_subnet_size": obj.get("public_ipv4_subnet_size") if obj.get("public_ipv4_subnet_size") is not None else 31, "spot_instance": obj.get("spot_instance"), "spot_price_max": obj.get("spot_price_max"), - "ssh_keys": [SSHKeyInput.from_dict(_item) for _item in obj.get("ssh_keys")] if obj.get("ssh_keys") is not None else None, - "storage": Storage.from_dict(obj.get("storage")) if obj.get("storage") is not None else None, + "ssh_keys": [SSHKeyInput.from_dict(_item) for _item in obj["ssh_keys"]] if obj.get("ssh_keys") is not None else None, + "storage": Storage.from_dict(obj["storage"]) if obj.get("storage") is not None else None, "tags": obj.get("tags"), "termination_time": obj.get("termination_time"), "user_ssh_keys": obj.get("user_ssh_keys"), diff --git a/equinix_metal/equinix_metal/models/device_create_input.py b/equinix_metal/equinix_metal/models/device_create_input.py index 71528a29..ed6fbcfb 100644 --- a/equinix_metal/equinix_metal/models/device_create_input.py +++ b/equinix_metal/equinix_metal/models/device_create_input.py @@ -19,78 +19,95 @@ import json from datetime import datetime -from typing import Any, Dict, List, Optional, Union -from pydantic import BaseModel, Field, StrictBool, StrictFloat, StrictInt, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union from equinix_metal.models.ip_address import IPAddress from equinix_metal.models.ssh_key_input import SSHKeyInput from equinix_metal.models.storage import Storage +from typing import Optional, Set +from typing_extensions import Self class DeviceCreateInput(BaseModel): """ DeviceCreateInput - """ - always_pxe: Optional[StrictBool] = Field(None, description="When true, devices with a `custom_ipxe` OS will always boot to iPXE. The default setting of false ensures that iPXE will be used on only the first boot.") - billing_cycle: Optional[StrictStr] = Field(None, description="The billing cycle of the device.") - customdata: Optional[Dict[str, Any]] = Field(None, description="Customdata is an arbitrary JSON value that can be accessed via the metadata service.") - description: Optional[StrictStr] = Field(None, description="Any description of the device or how it will be used. This may be used to inform other API consumers with project access.") - features: Optional[conlist(StrictStr)] = Field(None, description="The features attribute allows you to optionally specify what features your server should have. In the API shorthand syntax, all features listed are `required`: ``` { \"features\": [\"tpm\"] } ``` Alternatively, if you do not require a certain feature, but would prefer to be assigned a server with that feature if there are any available, you may specify that feature with a `preferred` value. The request will not fail if we have no servers with that feature in our inventory. The API offers an alternative syntax for mixing preferred and required features: ``` { \"features\": { \"tpm\": \"required\", \"raid\": \"preferred\" } } ``` The request will only fail if there are no available servers matching the required `tpm` criteria.") - hardware_reservation_id: Optional[StrictStr] = Field(None, description="The Hardware Reservation UUID to provision. Alternatively, `next-available` can be specified to select from any of the available hardware reservations. An error will be returned if the requested reservation option is not available. See [Reserved Hardware](https://metal.equinix.com/developers/docs/deploy/reserved/) for more details.") - hostname: Optional[StrictStr] = Field(None, description="The hostname to use within the operating system. The same hostname may be used on multiple devices within a project.") + """ # noqa: E501 + always_pxe: Optional[StrictBool] = Field(default=None, description="When true, devices with a `custom_ipxe` OS will always boot to iPXE. The default setting of false ensures that iPXE will be used on only the first boot.") + billing_cycle: Optional[StrictStr] = Field(default=None, description="The billing cycle of the device.") + customdata: Optional[Dict[str, Any]] = Field(default=None, description="Customdata is an arbitrary JSON value that can be accessed via the metadata service.") + description: Optional[StrictStr] = Field(default=None, description="Any description of the device or how it will be used. This may be used to inform other API consumers with project access.") + features: Optional[List[StrictStr]] = Field(default=None, description="The features attribute allows you to optionally specify what features your server should have. In the API shorthand syntax, all features listed are `required`: ``` { \"features\": [\"tpm\"] } ``` Alternatively, if you do not require a certain feature, but would prefer to be assigned a server with that feature if there are any available, you may specify that feature with a `preferred` value. The request will not fail if we have no servers with that feature in our inventory. The API offers an alternative syntax for mixing preferred and required features: ``` { \"features\": { \"tpm\": \"required\", \"raid\": \"preferred\" } } ``` The request will only fail if there are no available servers matching the required `tpm` criteria.") + hardware_reservation_id: Optional[StrictStr] = Field(default=None, description="The Hardware Reservation UUID to provision. Alternatively, `next-available` can be specified to select from any of the available hardware reservations. An error will be returned if the requested reservation option is not available. See [Reserved Hardware](https://metal.equinix.com/developers/docs/deploy/reserved/) for more details.") + hostname: Optional[StrictStr] = Field(default=None, description="The hostname to use within the operating system. The same hostname may be used on multiple devices within a project.") href: Optional[StrictStr] = None - ip_addresses: Optional[conlist(IPAddress)] = Field(None, description="The `ip_addresses attribute will allow you to specify the addresses you want created with your device. The default value configures public IPv4, public IPv6, and private IPv4. Private IPv4 address is required. When specifying `ip_addresses`, one of the array items must enable private IPv4. Some operating systems require public IPv4 address. In those cases you will receive an error message if public IPv4 is not enabled. For example, to only configure your server with a private IPv4 address, you can send `{ \"ip_addresses\": [{ \"address_family\": 4, \"public\": false }] }`. It is possible to request a subnet size larger than a `/30` by assigning addresses using the UUID(s) of ip_reservations in your project. For example, `{ \"ip_addresses\": [..., {\"address_family\": 4, \"public\": true, \"ip_reservations\": [\"uuid1\", \"uuid2\"]}] }` To access a server without public IPs, you can use our Out-of-Band console access (SOS) or proxy through another server in the project with public IPs enabled.") - ipxe_script_url: Optional[StrictStr] = Field(None, description="When set, the device will chainload an iPXE Script at boot fetched from the supplied URL. See [Custom iPXE](https://metal.equinix.com/developers/docs/operating-systems/custom-ipxe/) for more details.") - locked: Optional[StrictBool] = Field(False, description="Whether the device should be locked, preventing accidental deletion.") - network_frozen: Optional[StrictBool] = Field(None, description="If true, this instance can not be converted to a different network type.") - no_ssh_keys: Optional[StrictBool] = Field(False, description="Overrides default behaviour of attaching all of the organization members ssh keys and project ssh keys to device if no specific keys specified") - operating_system: StrictStr = Field(..., description="The slug of the operating system to provision. Check the Equinix Metal operating system documentation for rules that may be imposed per operating system, including restrictions on IP address options and device plans.") - plan: StrictStr = Field(..., description="The slug of the device plan to provision.") - private_ipv4_subnet_size: Optional[StrictInt] = Field(28, description="Deprecated. Use ip_addresses. Subnet range for addresses allocated to this device.") - project_ssh_keys: Optional[conlist(StrictStr)] = Field(None, description="A list of UUIDs identifying the device parent project that should be authorized to access this device (typically via /root/.ssh/authorized_keys). These keys will also appear in the device metadata. If no SSH keys are specified (`user_ssh_keys`, `project_ssh_keys`, and `ssh_keys` are all empty lists or omitted), all parent project keys, parent project members keys and organization members keys will be included. This behaviour can be changed with 'no_ssh_keys' option to omit any SSH key being added. ") - public_ipv4_subnet_size: Optional[StrictInt] = Field(31, description="Deprecated. Use ip_addresses. Subnet range for addresses allocated to this device. Your project must have addresses available for a non-default request.") - spot_instance: Optional[StrictBool] = Field(None, description="Create a spot instance. Spot instances are created with a maximum bid price. If the bid price is not met, the spot instance will be terminated as indicated by the `termination_time` field.") - spot_price_max: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="The maximum amount to bid for a spot instance.") - ssh_keys: Optional[conlist(SSHKeyInput)] = Field(None, description="A list of new or existing project ssh_keys that should be authorized to access this device (typically via /root/.ssh/authorized_keys). These keys will also appear in the device metadata. These keys are added in addition to any keys defined by `project_ssh_keys` and `user_ssh_keys`. ") + ip_addresses: Optional[List[IPAddress]] = Field(default=None, description="The `ip_addresses attribute will allow you to specify the addresses you want created with your device. The default value configures public IPv4, public IPv6, and private IPv4. Private IPv4 address is required. When specifying `ip_addresses`, one of the array items must enable private IPv4. Some operating systems require public IPv4 address. In those cases you will receive an error message if public IPv4 is not enabled. For example, to only configure your server with a private IPv4 address, you can send `{ \"ip_addresses\": [{ \"address_family\": 4, \"public\": false }] }`. It is possible to request a subnet size larger than a `/30` by assigning addresses using the UUID(s) of ip_reservations in your project. For example, `{ \"ip_addresses\": [..., {\"address_family\": 4, \"public\": true, \"ip_reservations\": [\"uuid1\", \"uuid2\"]}] }` To access a server without public IPs, you can use our Out-of-Band console access (SOS) or proxy through another server in the project with public IPs enabled.") + ipxe_script_url: Optional[StrictStr] = Field(default=None, description="When set, the device will chainload an iPXE Script at boot fetched from the supplied URL. See [Custom iPXE](https://metal.equinix.com/developers/docs/operating-systems/custom-ipxe/) for more details.") + locked: Optional[StrictBool] = Field(default=False, description="Whether the device should be locked, preventing accidental deletion.") + network_frozen: Optional[StrictBool] = Field(default=None, description="If true, this instance can not be converted to a different network type.") + no_ssh_keys: Optional[StrictBool] = Field(default=False, description="Overrides default behaviour of attaching all of the organization members ssh keys and project ssh keys to device if no specific keys specified") + operating_system: StrictStr = Field(description="The slug of the operating system to provision. Check the Equinix Metal operating system documentation for rules that may be imposed per operating system, including restrictions on IP address options and device plans.") + plan: StrictStr = Field(description="The slug of the device plan to provision.") + private_ipv4_subnet_size: Optional[StrictInt] = Field(default=28, description="Deprecated. Use ip_addresses. Subnet range for addresses allocated to this device.") + project_ssh_keys: Optional[List[StrictStr]] = Field(default=None, description="A list of UUIDs identifying the device parent project that should be authorized to access this device (typically via /root/.ssh/authorized_keys). These keys will also appear in the device metadata. If no SSH keys are specified (`user_ssh_keys`, `project_ssh_keys`, and `ssh_keys` are all empty lists or omitted), all parent project keys, parent project members keys and organization members keys will be included. This behaviour can be changed with 'no_ssh_keys' option to omit any SSH key being added. ") + public_ipv4_subnet_size: Optional[StrictInt] = Field(default=31, description="Deprecated. Use ip_addresses. Subnet range for addresses allocated to this device. Your project must have addresses available for a non-default request.") + spot_instance: Optional[StrictBool] = Field(default=None, description="Create a spot instance. Spot instances are created with a maximum bid price. If the bid price is not met, the spot instance will be terminated as indicated by the `termination_time` field.") + spot_price_max: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The maximum amount to bid for a spot instance.") + ssh_keys: Optional[List[SSHKeyInput]] = Field(default=None, description="A list of new or existing project ssh_keys that should be authorized to access this device (typically via /root/.ssh/authorized_keys). These keys will also appear in the device metadata. These keys are added in addition to any keys defined by `project_ssh_keys` and `user_ssh_keys`. ") storage: Optional[Storage] = None - tags: Optional[conlist(StrictStr)] = None - termination_time: Optional[datetime] = Field(None, description="When the device will be terminated. If you don't supply timezone info, the timestamp is assumed to be in UTC. This is commonly set in advance for ephemeral spot market instances but this field may also be set with on-demand and reservation instances to automatically delete the resource at a given time. The termination time can also be used to release a hardware reservation instance at a given time, keeping the reservation open for other uses. On a spot market device, the termination time will be set automatically when outbid. ") - user_ssh_keys: Optional[conlist(StrictStr)] = Field(None, description="A list of UUIDs identifying the users that should be authorized to access this device (typically via /root/.ssh/authorized_keys). These keys will also appear in the device metadata. The users must be members of the project or organization. If no SSH keys are specified (`user_ssh_keys`, `project_ssh_keys`, and `ssh_keys` are all empty lists or omitted), all parent project keys, parent project members keys and organization members keys will be included. This behaviour can be changed with 'no_ssh_keys' option to omit any SSH key being added. ") - userdata: Optional[StrictStr] = Field(None, description="The userdata presented in the metadata service for this device. Userdata is fetched and interpreted by the operating system installed on the device. Acceptable formats are determined by the operating system, with the exception of a special iPXE enabling syntax which is handled before the operating system starts. See [Server User Data](https://metal.equinix.com/developers/docs/servers/user-data/) and [Provisioning with Custom iPXE](https://metal.equinix.com/developers/docs/operating-systems/custom-ipxe/#provisioning-with-custom-ipxe) for more details.") - __properties = ["always_pxe", "billing_cycle", "customdata", "description", "features", "hardware_reservation_id", "hostname", "href", "ip_addresses", "ipxe_script_url", "locked", "network_frozen", "no_ssh_keys", "operating_system", "plan", "private_ipv4_subnet_size", "project_ssh_keys", "public_ipv4_subnet_size", "spot_instance", "spot_price_max", "ssh_keys", "storage", "tags", "termination_time", "user_ssh_keys", "userdata"] + tags: Optional[List[StrictStr]] = None + termination_time: Optional[datetime] = Field(default=None, description="When the device will be terminated. If you don't supply timezone info, the timestamp is assumed to be in UTC. This is commonly set in advance for ephemeral spot market instances but this field may also be set with on-demand and reservation instances to automatically delete the resource at a given time. The termination time can also be used to release a hardware reservation instance at a given time, keeping the reservation open for other uses. On a spot market device, the termination time will be set automatically when outbid. ") + user_ssh_keys: Optional[List[StrictStr]] = Field(default=None, description="A list of UUIDs identifying the users that should be authorized to access this device (typically via /root/.ssh/authorized_keys). These keys will also appear in the device metadata. The users must be members of the project or organization. If no SSH keys are specified (`user_ssh_keys`, `project_ssh_keys`, and `ssh_keys` are all empty lists or omitted), all parent project keys, parent project members keys and organization members keys will be included. This behaviour can be changed with 'no_ssh_keys' option to omit any SSH key being added. ") + userdata: Optional[StrictStr] = Field(default=None, description="The userdata presented in the metadata service for this device. Userdata is fetched and interpreted by the operating system installed on the device. Acceptable formats are determined by the operating system, with the exception of a special iPXE enabling syntax which is handled before the operating system starts. See [Server User Data](https://metal.equinix.com/developers/docs/servers/user-data/) and [Provisioning with Custom iPXE](https://metal.equinix.com/developers/docs/operating-systems/custom-ipxe/#provisioning-with-custom-ipxe) for more details.") + __properties: ClassVar[List[str]] = ["always_pxe", "billing_cycle", "customdata", "description", "features", "hardware_reservation_id", "hostname", "href", "ip_addresses", "ipxe_script_url", "locked", "network_frozen", "no_ssh_keys", "operating_system", "plan", "private_ipv4_subnet_size", "project_ssh_keys", "public_ipv4_subnet_size", "spot_instance", "spot_price_max", "ssh_keys", "storage", "tags", "termination_time", "user_ssh_keys", "userdata"] - @validator('billing_cycle') + @field_validator('billing_cycle') def billing_cycle_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('hourly', 'daily', 'monthly', 'yearly'): + if value not in set(['hourly', 'daily', 'monthly', 'yearly']): raise ValueError("must be one of enum values ('hourly', 'daily', 'monthly', 'yearly')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> DeviceCreateInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of DeviceCreateInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in ip_addresses (list) _items = [] if self.ip_addresses: @@ -111,15 +128,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> DeviceCreateInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of DeviceCreateInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return DeviceCreateInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = DeviceCreateInput.parse_obj({ + _obj = cls.model_validate({ "always_pxe": obj.get("always_pxe"), "billing_cycle": obj.get("billing_cycle"), "customdata": obj.get("customdata"), @@ -128,7 +145,7 @@ def from_dict(cls, obj: dict) -> DeviceCreateInput: "hardware_reservation_id": obj.get("hardware_reservation_id"), "hostname": obj.get("hostname"), "href": obj.get("href"), - "ip_addresses": [IPAddress.from_dict(_item) for _item in obj.get("ip_addresses")] if obj.get("ip_addresses") is not None else None, + "ip_addresses": [IPAddress.from_dict(_item) for _item in obj["ip_addresses"]] if obj.get("ip_addresses") is not None else None, "ipxe_script_url": obj.get("ipxe_script_url"), "locked": obj.get("locked") if obj.get("locked") is not None else False, "network_frozen": obj.get("network_frozen"), @@ -140,8 +157,8 @@ def from_dict(cls, obj: dict) -> DeviceCreateInput: "public_ipv4_subnet_size": obj.get("public_ipv4_subnet_size") if obj.get("public_ipv4_subnet_size") is not None else 31, "spot_instance": obj.get("spot_instance"), "spot_price_max": obj.get("spot_price_max"), - "ssh_keys": [SSHKeyInput.from_dict(_item) for _item in obj.get("ssh_keys")] if obj.get("ssh_keys") is not None else None, - "storage": Storage.from_dict(obj.get("storage")) if obj.get("storage") is not None else None, + "ssh_keys": [SSHKeyInput.from_dict(_item) for _item in obj["ssh_keys"]] if obj.get("ssh_keys") is not None else None, + "storage": Storage.from_dict(obj["storage"]) if obj.get("storage") is not None else None, "tags": obj.get("tags"), "termination_time": obj.get("termination_time"), "user_ssh_keys": obj.get("user_ssh_keys"), diff --git a/equinix_metal/equinix_metal/models/device_created_by.py b/equinix_metal/equinix_metal/models/device_created_by.py index a5190e14..19db9ff0 100644 --- a/equinix_metal/equinix_metal/models/device_created_by.py +++ b/equinix_metal/equinix_metal/models/device_created_by.py @@ -19,61 +19,78 @@ import json from datetime import datetime -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class DeviceCreatedBy(BaseModel): """ DeviceCreatedBy - """ - avatar_thumb_url: Optional[StrictStr] = Field(None, description="Avatar thumbnail URL of the User") - created_at: Optional[datetime] = Field(None, description="When the user was created") - email: Optional[StrictStr] = Field(None, description="Primary email address of the User") - first_name: Optional[StrictStr] = Field(None, description="First name of the User") - full_name: Optional[StrictStr] = Field(None, description="Full name of the User") - href: Optional[StrictStr] = Field(None, description="API URL uniquely representing the User") - id: StrictStr = Field(..., description="ID of the User") - last_name: Optional[StrictStr] = Field(None, description="Last name of the User") - short_id: StrictStr = Field(..., description="Short ID of the User") - updated_at: Optional[datetime] = Field(None, description="When the user details were last updated") - __properties = ["avatar_thumb_url", "created_at", "email", "first_name", "full_name", "href", "id", "last_name", "short_id", "updated_at"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """ # noqa: E501 + avatar_thumb_url: Optional[StrictStr] = Field(default=None, description="Avatar thumbnail URL of the User") + created_at: Optional[datetime] = Field(default=None, description="When the user was created") + email: Optional[StrictStr] = Field(default=None, description="Primary email address of the User") + first_name: Optional[StrictStr] = Field(default=None, description="First name of the User") + full_name: Optional[StrictStr] = Field(default=None, description="Full name of the User") + href: Optional[StrictStr] = Field(default=None, description="API URL uniquely representing the User") + id: StrictStr = Field(description="ID of the User") + last_name: Optional[StrictStr] = Field(default=None, description="Last name of the User") + short_id: StrictStr = Field(description="Short ID of the User") + updated_at: Optional[datetime] = Field(default=None, description="When the user details were last updated") + __properties: ClassVar[List[str]] = ["avatar_thumb_url", "created_at", "email", "first_name", "full_name", "href", "id", "last_name", "short_id", "updated_at"] + + 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.dict(by_alias=True)) + 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) -> DeviceCreatedBy: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of DeviceCreatedBy from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> DeviceCreatedBy: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of DeviceCreatedBy from a dict""" if obj is None: return None if not isinstance(obj, dict): - return DeviceCreatedBy.parse_obj(obj) + return cls.model_validate(obj) - _obj = DeviceCreatedBy.parse_obj({ + _obj = cls.model_validate({ "avatar_thumb_url": obj.get("avatar_thumb_url"), "created_at": obj.get("created_at"), "email": obj.get("email"), diff --git a/equinix_metal/equinix_metal/models/device_health_rollup.py b/equinix_metal/equinix_metal/models/device_health_rollup.py index 728a260b..51041dff 100644 --- a/equinix_metal/equinix_metal/models/device_health_rollup.py +++ b/equinix_metal/equinix_metal/models/device_health_rollup.py @@ -19,66 +19,85 @@ import json from datetime import datetime -from typing import Optional -from pydantic import BaseModel, Field, StrictStr, validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class DeviceHealthRollup(BaseModel): """ Represents a Device Health Status - """ - health_rollup: Optional[StrictStr] = Field(None, description="Health Status") + """ # noqa: E501 + health_rollup: Optional[StrictStr] = Field(default=None, description="Health Status") href: Optional[StrictStr] = None - updated_at: Optional[datetime] = Field(None, description="Last update of health status.") - __properties = ["health_rollup", "href", "updated_at"] + updated_at: Optional[datetime] = Field(default=None, description="Last update of health status.") + __properties: ClassVar[List[str]] = ["health_rollup", "href", "updated_at"] - @validator('health_rollup') + @field_validator('health_rollup') def health_rollup_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('ok', 'warning', 'critical'): + if value not in set(['ok', 'warning', 'critical']): raise ValueError("must be one of enum values ('ok', 'warning', 'critical')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> DeviceHealthRollup: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of DeviceHealthRollup from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - "health_rollup", - "updated_at", - }, - exclude_none=True) + 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. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "health_rollup", + "updated_at", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> DeviceHealthRollup: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of DeviceHealthRollup from a dict""" if obj is None: return None if not isinstance(obj, dict): - return DeviceHealthRollup.parse_obj(obj) + return cls.model_validate(obj) - _obj = DeviceHealthRollup.parse_obj({ + _obj = cls.model_validate({ "health_rollup": obj.get("health_rollup"), "href": obj.get("href"), "updated_at": obj.get("updated_at") diff --git a/equinix_metal/equinix_metal/models/device_list.py b/equinix_metal/equinix_metal/models/device_list.py index 21200193..ccb6c267 100644 --- a/equinix_metal/equinix_metal/models/device_list.py +++ b/equinix_metal/equinix_metal/models/device_list.py @@ -18,45 +18,61 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.device import Device from equinix_metal.models.meta import Meta +from typing import Optional, Set +from typing_extensions import Self class DeviceList(BaseModel): """ DeviceList - """ - devices: Optional[conlist(Device)] = None + """ # noqa: E501 + devices: Optional[List[Device]] = None href: Optional[StrictStr] = None meta: Optional[Meta] = None - __properties = ["devices", "href", "meta"] + __properties: ClassVar[List[str]] = ["devices", "href", "meta"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> DeviceList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of DeviceList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in devices (list) _items = [] if self.devices: @@ -70,18 +86,18 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> DeviceList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of DeviceList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return DeviceList.parse_obj(obj) + return cls.model_validate(obj) - _obj = DeviceList.parse_obj({ - "devices": [Device.from_dict(_item) for _item in obj.get("devices")] if obj.get("devices") is not None else None, + _obj = cls.model_validate({ + "devices": [Device.from_dict(_item) for _item in obj["devices"]] if obj.get("devices") is not None else None, "href": obj.get("href"), - "meta": Meta.from_dict(obj.get("meta")) if obj.get("meta") is not None else None + "meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/device_metro.py b/equinix_metal/equinix_metal/models/device_metro.py index e015ab44..ebf8342a 100644 --- a/equinix_metal/equinix_metal/models/device_metro.py +++ b/equinix_metal/equinix_metal/models/device_metro.py @@ -18,57 +18,73 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class DeviceMetro(BaseModel): """ DeviceMetro - """ + """ # noqa: E501 code: Optional[StrictStr] = None country: Optional[StrictStr] = None href: Optional[StrictStr] = None id: Optional[StrictStr] = None name: Optional[StrictStr] = None - __properties = ["code", "country", "href", "id", "name"] + __properties: ClassVar[List[str]] = ["code", "country", "href", "id", "name"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> DeviceMetro: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of DeviceMetro from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> DeviceMetro: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of DeviceMetro from a dict""" if obj is None: return None if not isinstance(obj, dict): - return DeviceMetro.parse_obj(obj) + return cls.model_validate(obj) - _obj = DeviceMetro.parse_obj({ + _obj = cls.model_validate({ "code": obj.get("code"), "country": obj.get("country"), "href": obj.get("href"), diff --git a/equinix_metal/equinix_metal/models/device_project_lite.py b/equinix_metal/equinix_metal/models/device_project_lite.py index d04a25e4..c5f446eb 100644 --- a/equinix_metal/equinix_metal/models/device_project_lite.py +++ b/equinix_metal/equinix_metal/models/device_project_lite.py @@ -18,53 +18,69 @@ import re # noqa: F401 import json - - -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self class DeviceProjectLite(BaseModel): """ DeviceProjectLite - """ - href: StrictStr = Field(...) - __properties = ["href"] + """ # noqa: E501 + href: StrictStr + __properties: ClassVar[List[str]] = ["href"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> DeviceProjectLite: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of DeviceProjectLite from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> DeviceProjectLite: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of DeviceProjectLite from a dict""" if obj is None: return None if not isinstance(obj, dict): - return DeviceProjectLite.parse_obj(obj) + return cls.model_validate(obj) - _obj = DeviceProjectLite.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href") }) return _obj diff --git a/equinix_metal/equinix_metal/models/device_update_input.py b/equinix_metal/equinix_metal/models/device_update_input.py index 6ddbe0cb..fbe1048c 100644 --- a/equinix_metal/equinix_metal/models/device_update_input.py +++ b/equinix_metal/equinix_metal/models/device_update_input.py @@ -18,14 +18,15 @@ import re # noqa: F401 import json - -from typing import Any, Dict, List, Optional -from pydantic import BaseModel, Field, StrictBool, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class DeviceUpdateInput(BaseModel): """ DeviceUpdateInput - """ + """ # noqa: E501 always_pxe: Optional[StrictBool] = None billing_cycle: Optional[StrictStr] = None customdata: Optional[Dict[str, Any]] = None @@ -34,49 +35,64 @@ class DeviceUpdateInput(BaseModel): hostname: Optional[StrictStr] = None href: Optional[StrictStr] = None ipxe_script_url: Optional[StrictStr] = None - locked: Optional[StrictBool] = Field(None, description="Whether the device should be locked, preventing accidental deletion.") - network_frozen: Optional[StrictBool] = Field(None, description="If true, this instance can not be converted to a different network type.") - spot_instance: Optional[StrictBool] = Field(None, description="Can be set to false to convert a spot-market instance to on-demand.") - tags: Optional[conlist(StrictStr)] = None + locked: Optional[StrictBool] = Field(default=None, description="Whether the device should be locked, preventing accidental deletion.") + network_frozen: Optional[StrictBool] = Field(default=None, description="If true, this instance can not be converted to a different network type.") + spot_instance: Optional[StrictBool] = Field(default=None, description="Can be set to false to convert a spot-market instance to on-demand.") + tags: Optional[List[StrictStr]] = None userdata: Optional[StrictStr] = None - __properties = ["always_pxe", "billing_cycle", "customdata", "description", "firmware_set_id", "hostname", "href", "ipxe_script_url", "locked", "network_frozen", "spot_instance", "tags", "userdata"] + __properties: ClassVar[List[str]] = ["always_pxe", "billing_cycle", "customdata", "description", "firmware_set_id", "hostname", "href", "ipxe_script_url", "locked", "network_frozen", "spot_instance", "tags", "userdata"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> DeviceUpdateInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of DeviceUpdateInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> DeviceUpdateInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of DeviceUpdateInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return DeviceUpdateInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = DeviceUpdateInput.parse_obj({ + _obj = cls.model_validate({ "always_pxe": obj.get("always_pxe"), "billing_cycle": obj.get("billing_cycle"), "customdata": obj.get("customdata"), diff --git a/equinix_metal/equinix_metal/models/device_usage.py b/equinix_metal/equinix_metal/models/device_usage.py index f5a83717..4d26dda9 100644 --- a/equinix_metal/equinix_metal/models/device_usage.py +++ b/equinix_metal/equinix_metal/models/device_usage.py @@ -18,56 +18,72 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class DeviceUsage(BaseModel): """ DeviceUsage - """ + """ # noqa: E501 href: Optional[StrictStr] = None quantity: Optional[StrictStr] = None total: Optional[StrictStr] = None unit: Optional[StrictStr] = None - __properties = ["href", "quantity", "total", "unit"] + __properties: ClassVar[List[str]] = ["href", "quantity", "total", "unit"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> DeviceUsage: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of DeviceUsage from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> DeviceUsage: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of DeviceUsage from a dict""" if obj is None: return None if not isinstance(obj, dict): - return DeviceUsage.parse_obj(obj) + return cls.model_validate(obj) - _obj = DeviceUsage.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), "quantity": obj.get("quantity"), "total": obj.get("total"), diff --git a/equinix_metal/equinix_metal/models/device_usage_list.py b/equinix_metal/equinix_metal/models/device_usage_list.py index d15801f7..27c526de 100644 --- a/equinix_metal/equinix_metal/models/device_usage_list.py +++ b/equinix_metal/equinix_metal/models/device_usage_list.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.device_usage import DeviceUsage +from typing import Optional, Set +from typing_extensions import Self class DeviceUsageList(BaseModel): """ DeviceUsageList - """ + """ # noqa: E501 href: Optional[StrictStr] = None - usages: Optional[conlist(DeviceUsage)] = None - __properties = ["href", "usages"] + usages: Optional[List[DeviceUsage]] = None + __properties: ClassVar[List[str]] = ["href", "usages"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> DeviceUsageList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of DeviceUsageList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in usages (list) _items = [] if self.usages: @@ -65,17 +81,17 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> DeviceUsageList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of DeviceUsageList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return DeviceUsageList.parse_obj(obj) + return cls.model_validate(obj) - _obj = DeviceUsageList.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "usages": [DeviceUsage.from_dict(_item) for _item in obj.get("usages")] if obj.get("usages") is not None else None + "usages": [DeviceUsage.from_dict(_item) for _item in obj["usages"]] if obj.get("usages") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/disk.py b/equinix_metal/equinix_metal/models/disk.py index 3401f922..78c7a44e 100644 --- a/equinix_metal/equinix_metal/models/disk.py +++ b/equinix_metal/equinix_metal/models/disk.py @@ -18,45 +18,61 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictBool, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.partition import Partition +from typing import Optional, Set +from typing_extensions import Self class Disk(BaseModel): """ Disk - """ + """ # noqa: E501 device: Optional[StrictStr] = None href: Optional[StrictStr] = None - partitions: Optional[conlist(Partition)] = None - wipe_table: Optional[StrictBool] = Field(None, alias="wipeTable") - __properties = ["device", "href", "partitions", "wipeTable"] + partitions: Optional[List[Partition]] = None + wipe_table: Optional[StrictBool] = Field(default=None, alias="wipeTable") + __properties: ClassVar[List[str]] = ["device", "href", "partitions", "wipeTable"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> Disk: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Disk from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in partitions (list) _items = [] if self.partitions: @@ -67,19 +83,19 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> Disk: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Disk from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Disk.parse_obj(obj) + return cls.model_validate(obj) - _obj = Disk.parse_obj({ + _obj = cls.model_validate({ "device": obj.get("device"), "href": obj.get("href"), - "partitions": [Partition.from_dict(_item) for _item in obj.get("partitions")] if obj.get("partitions") is not None else None, - "wipe_table": obj.get("wipeTable") + "partitions": [Partition.from_dict(_item) for _item in obj["partitions"]] if obj.get("partitions") is not None else None, + "wipeTable": obj.get("wipeTable") }) return _obj diff --git a/equinix_metal/equinix_metal/models/email.py b/equinix_metal/equinix_metal/models/email.py index 5eb264ca..e9edad95 100644 --- a/equinix_metal/equinix_metal/models/email.py +++ b/equinix_metal/equinix_metal/models/email.py @@ -18,57 +18,73 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictBool, StrictStr +from pydantic import BaseModel, ConfigDict, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class Email(BaseModel): """ Email - """ + """ # noqa: E501 address: Optional[StrictStr] = None default: Optional[StrictBool] = None href: Optional[StrictStr] = None id: Optional[StrictStr] = None verified: Optional[StrictBool] = None - __properties = ["address", "default", "href", "id", "verified"] + __properties: ClassVar[List[str]] = ["address", "default", "href", "id", "verified"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> Email: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Email from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> Email: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Email from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Email.parse_obj(obj) + return cls.model_validate(obj) - _obj = Email.parse_obj({ + _obj = cls.model_validate({ "address": obj.get("address"), "default": obj.get("default"), "href": obj.get("href"), diff --git a/equinix_metal/equinix_metal/models/email_input.py b/equinix_metal/equinix_metal/models/email_input.py index 1630bdf2..9fead176 100644 --- a/equinix_metal/equinix_metal/models/email_input.py +++ b/equinix_metal/equinix_metal/models/email_input.py @@ -18,55 +18,71 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictBool, StrictStr +from pydantic import BaseModel, ConfigDict, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class EmailInput(BaseModel): """ EmailInput - """ - address: StrictStr = Field(...) + """ # noqa: E501 + address: StrictStr default: Optional[StrictBool] = None href: Optional[StrictStr] = None - __properties = ["address", "default", "href"] + __properties: ClassVar[List[str]] = ["address", "default", "href"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> EmailInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of EmailInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> EmailInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of EmailInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return EmailInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = EmailInput.parse_obj({ + _obj = cls.model_validate({ "address": obj.get("address"), "default": obj.get("default"), "href": obj.get("href") diff --git a/equinix_metal/equinix_metal/models/entitlement.py b/equinix_metal/equinix_metal/models/entitlement.py index c64514e8..cb2f3568 100644 --- a/equinix_metal/equinix_metal/models/entitlement.py +++ b/equinix_metal/equinix_metal/models/entitlement.py @@ -18,64 +18,80 @@ import re # noqa: F401 import json - -from typing import Any, Dict, Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class Entitlement(BaseModel): """ Entitlement - """ + """ # noqa: E501 description: Optional[StrictStr] = None feature_access: Optional[Dict[str, Any]] = None href: Optional[StrictStr] = None - id: StrictStr = Field(...) + id: StrictStr instance_quota: Optional[Dict[str, Any]] = None ip_quota: Optional[Dict[str, Any]] = None name: Optional[StrictStr] = None project_quota: Optional[StrictInt] = 0 - slug: StrictStr = Field(...) + slug: StrictStr volume_limits: Optional[Dict[str, Any]] = None volume_quota: Optional[Dict[str, Any]] = None - weight: StrictInt = Field(...) - __properties = ["description", "feature_access", "href", "id", "instance_quota", "ip_quota", "name", "project_quota", "slug", "volume_limits", "volume_quota", "weight"] + weight: StrictInt + __properties: ClassVar[List[str]] = ["description", "feature_access", "href", "id", "instance_quota", "ip_quota", "name", "project_quota", "slug", "volume_limits", "volume_quota", "weight"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> Entitlement: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Entitlement from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> Entitlement: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Entitlement from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Entitlement.parse_obj(obj) + return cls.model_validate(obj) - _obj = Entitlement.parse_obj({ + _obj = cls.model_validate({ "description": obj.get("description"), "feature_access": obj.get("feature_access"), "href": obj.get("href"), diff --git a/equinix_metal/equinix_metal/models/error.py b/equinix_metal/equinix_metal/models/error.py index a4fe644e..bbbf5212 100644 --- a/equinix_metal/equinix_metal/models/error.py +++ b/equinix_metal/equinix_metal/models/error.py @@ -18,55 +18,71 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class Error(BaseModel): """ Error responses are included with 4xx and 5xx HTTP responses from the API service. Either \"error\" or \"errors\" will be set. - """ - error: Optional[StrictStr] = Field(None, description="A description of the error that caused the request to fail.") - errors: Optional[conlist(StrictStr)] = Field(None, description="A list of errors that contributed to the request failing.") + """ # noqa: E501 + error: Optional[StrictStr] = Field(default=None, description="A description of the error that caused the request to fail.") + errors: Optional[List[StrictStr]] = Field(default=None, description="A list of errors that contributed to the request failing.") href: Optional[StrictStr] = None - __properties = ["error", "errors", "href"] + __properties: ClassVar[List[str]] = ["error", "errors", "href"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> Error: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Error from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> Error: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Error from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Error.parse_obj(obj) + return cls.model_validate(obj) - _obj = Error.parse_obj({ + _obj = cls.model_validate({ "error": obj.get("error"), "errors": obj.get("errors"), "href": obj.get("href") diff --git a/equinix_metal/equinix_metal/models/event.py b/equinix_metal/equinix_metal/models/event.py index d03cf53e..91b08132 100644 --- a/equinix_metal/equinix_metal/models/event.py +++ b/equinix_metal/equinix_metal/models/event.py @@ -19,14 +19,16 @@ import json from datetime import datetime -from typing import Any, Dict, List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.href import Href +from typing import Optional, Set +from typing_extensions import Self class Event(BaseModel): """ Event - """ + """ # noqa: E501 body: Optional[StrictStr] = None created_at: Optional[datetime] = None href: Optional[StrictStr] = None @@ -34,35 +36,50 @@ class Event(BaseModel): interpolated: Optional[StrictStr] = None ip: Optional[StrictStr] = None modified_by: Optional[Dict[str, Any]] = None - relationships: Optional[conlist(Href)] = None + relationships: Optional[List[Href]] = None state: Optional[StrictStr] = None type: Optional[StrictStr] = None - __properties = ["body", "created_at", "href", "id", "interpolated", "ip", "modified_by", "relationships", "state", "type"] + __properties: ClassVar[List[str]] = ["body", "created_at", "href", "id", "interpolated", "ip", "modified_by", "relationships", "state", "type"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> Event: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Event from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in relationships (list) _items = [] if self.relationships: @@ -73,15 +90,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> Event: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Event from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Event.parse_obj(obj) + return cls.model_validate(obj) - _obj = Event.parse_obj({ + _obj = cls.model_validate({ "body": obj.get("body"), "created_at": obj.get("created_at"), "href": obj.get("href"), @@ -89,7 +106,7 @@ def from_dict(cls, obj: dict) -> Event: "interpolated": obj.get("interpolated"), "ip": obj.get("ip"), "modified_by": obj.get("modified_by"), - "relationships": [Href.from_dict(_item) for _item in obj.get("relationships")] if obj.get("relationships") is not None else None, + "relationships": [Href.from_dict(_item) for _item in obj["relationships"]] if obj.get("relationships") is not None else None, "state": obj.get("state"), "type": obj.get("type") }) diff --git a/equinix_metal/equinix_metal/models/event_list.py b/equinix_metal/equinix_metal/models/event_list.py index 370986c5..96035bf0 100644 --- a/equinix_metal/equinix_metal/models/event_list.py +++ b/equinix_metal/equinix_metal/models/event_list.py @@ -18,45 +18,61 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.event import Event from equinix_metal.models.meta import Meta +from typing import Optional, Set +from typing_extensions import Self class EventList(BaseModel): """ EventList - """ - events: Optional[conlist(Event)] = None + """ # noqa: E501 + events: Optional[List[Event]] = None href: Optional[StrictStr] = None meta: Optional[Meta] = None - __properties = ["events", "href", "meta"] + __properties: ClassVar[List[str]] = ["events", "href", "meta"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> EventList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of EventList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in events (list) _items = [] if self.events: @@ -70,18 +86,18 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> EventList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of EventList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return EventList.parse_obj(obj) + return cls.model_validate(obj) - _obj = EventList.parse_obj({ - "events": [Event.from_dict(_item) for _item in obj.get("events")] if obj.get("events") is not None else None, + _obj = cls.model_validate({ + "events": [Event.from_dict(_item) for _item in obj["events"]] if obj.get("events") is not None else None, "href": obj.get("href"), - "meta": Meta.from_dict(obj.get("meta")) if obj.get("meta") is not None else None + "meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/fabric_service_token.py b/equinix_metal/equinix_metal/models/fabric_service_token.py index 8a226e83..39cf870a 100644 --- a/equinix_metal/equinix_metal/models/fabric_service_token.py +++ b/equinix_metal/equinix_metal/models/fabric_service_token.py @@ -19,88 +19,105 @@ import json from datetime import datetime -from typing import Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, validator +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class FabricServiceToken(BaseModel): """ FabricServiceToken - """ - expires_at: Optional[datetime] = Field(None, description="The expiration date and time of the Fabric service token. Once a service token is expired, it is no longer redeemable.") + """ # noqa: E501 + expires_at: Optional[datetime] = Field(default=None, description="The expiration date and time of the Fabric service token. Once a service token is expired, it is no longer redeemable.") href: Optional[StrictStr] = None - id: Optional[StrictStr] = Field(None, description="The UUID that can be used on the Fabric Portal to redeem either an A-Side or Z-Side Service Token. For Fabric VCs (Metal Billed), this UUID will represent an A-Side Service Token, which will allow interconnections to be made from Equinix Metal to other Service Providers on Fabric. For Fabric VCs (Fabric Billed), this UUID will represent a Z-Side Service Token, which will allow interconnections to be made to connect an owned Fabric Port or Virtual Device to Equinix Metal.") - max_allowed_speed: Optional[StrictInt] = Field(None, description="The maximum speed that can be selected on the Fabric Portal when configuring a interconnection with either an A-Side or Z-Side Service Token. For Fabric VCs (Metal Billed), this is what the billing is based off of, and can be one of the following options, '50mbps', '200mbps', '500mbps', '1gbps', '2gbps', '5gbps' or '10gbps'. For Fabric VCs (Fabric Billed), this will default to 10Gbps.") - role: Optional[StrictStr] = Field(None, description="Either primary or secondary, depending on which interconnection the service token is associated to.") - service_token_type: Optional[StrictStr] = Field(None, description="Either 'a_side' or 'z_side', depending on which type of Fabric VC was requested.") - state: Optional[StrictStr] = Field(None, description="The state of the service token that corresponds with the service token state on Fabric. An 'inactive' state refers to a token that has not been redeemed yet on the Fabric side, an 'active' state refers to a token that has already been redeemed, and an 'expired' state refers to a token that has reached its expiry time.") - __properties = ["expires_at", "href", "id", "max_allowed_speed", "role", "service_token_type", "state"] - - @validator('role') + id: Optional[StrictStr] = Field(default=None, description="The UUID that can be used on the Fabric Portal to redeem either an A-Side or Z-Side Service Token. For Fabric VCs (Metal Billed), this UUID will represent an A-Side Service Token, which will allow interconnections to be made from Equinix Metal to other Service Providers on Fabric. For Fabric VCs (Fabric Billed), this UUID will represent a Z-Side Service Token, which will allow interconnections to be made to connect an owned Fabric Port or Virtual Device to Equinix Metal.") + max_allowed_speed: Optional[StrictInt] = Field(default=None, description="The maximum speed that can be selected on the Fabric Portal when configuring a interconnection with either an A-Side or Z-Side Service Token. For Fabric VCs (Metal Billed), this is what the billing is based off of, and can be one of the following options, '50mbps', '200mbps', '500mbps', '1gbps', '2gbps', '5gbps' or '10gbps'. For Fabric VCs (Fabric Billed), this will default to 10Gbps.") + role: Optional[StrictStr] = Field(default=None, description="Either primary or secondary, depending on which interconnection the service token is associated to.") + service_token_type: Optional[StrictStr] = Field(default=None, description="Either 'a_side' or 'z_side', depending on which type of Fabric VC was requested.") + state: Optional[StrictStr] = Field(default=None, description="The state of the service token that corresponds with the service token state on Fabric. An 'inactive' state refers to a token that has not been redeemed yet on the Fabric side, an 'active' state refers to a token that has already been redeemed, and an 'expired' state refers to a token that has reached its expiry time.") + __properties: ClassVar[List[str]] = ["expires_at", "href", "id", "max_allowed_speed", "role", "service_token_type", "state"] + + @field_validator('role') def role_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('primary', 'secondary'): + if value not in set(['primary', 'secondary']): raise ValueError("must be one of enum values ('primary', 'secondary')") return value - @validator('service_token_type') + @field_validator('service_token_type') def service_token_type_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('a_side', 'z_side'): + if value not in set(['a_side', 'z_side']): raise ValueError("must be one of enum values ('a_side', 'z_side')") return value - @validator('state') + @field_validator('state') def state_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('inactive', 'active', 'expired'): + if value not in set(['inactive', 'active', 'expired']): raise ValueError("must be one of enum values ('inactive', 'active', 'expired')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> FabricServiceToken: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of FabricServiceToken from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> FabricServiceToken: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of FabricServiceToken from a dict""" if obj is None: return None if not isinstance(obj, dict): - return FabricServiceToken.parse_obj(obj) + return cls.model_validate(obj) - _obj = FabricServiceToken.parse_obj({ + _obj = cls.model_validate({ "expires_at": obj.get("expires_at"), "href": obj.get("href"), "id": obj.get("id"), diff --git a/equinix_metal/equinix_metal/models/facility.py b/equinix_metal/equinix_metal/models/facility.py index 2739d828..46ad2200 100644 --- a/equinix_metal/equinix_metal/models/facility.py +++ b/equinix_metal/equinix_metal/models/facility.py @@ -18,61 +18,77 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.address import Address from equinix_metal.models.device_metro import DeviceMetro +from typing import Optional, Set +from typing_extensions import Self class Facility(BaseModel): """ Facility - """ + """ # noqa: E501 address: Optional[Address] = None code: Optional[StrictStr] = None - features: Optional[conlist(StrictStr)] = None + features: Optional[List[StrictStr]] = None href: Optional[StrictStr] = None id: Optional[StrictStr] = None - ip_ranges: Optional[conlist(StrictStr)] = Field(None, description="IP ranges registered in facility. Can be used for GeoIP location") + ip_ranges: Optional[List[StrictStr]] = Field(default=None, description="IP ranges registered in facility. Can be used for GeoIP location") metro: Optional[DeviceMetro] = None name: Optional[StrictStr] = None - __properties = ["address", "code", "features", "href", "id", "ip_ranges", "metro", "name"] + __properties: ClassVar[List[str]] = ["address", "code", "features", "href", "id", "ip_ranges", "metro", "name"] - @validator('features') + @field_validator('features') def features_validate_enum(cls, value): """Validates the enum""" if value is None: return value for i in value: - if i not in ('baremetal', 'backend_transfer', 'layer_2', 'global_ipv4', 'ibx'): + if i not in set(['baremetal', 'backend_transfer', 'layer_2', 'global_ipv4', 'ibx']): raise ValueError("each list item must be one of ('baremetal', 'backend_transfer', 'layer_2', 'global_ipv4', 'ibx')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> Facility: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Facility from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of address if self.address: _dict['address'] = self.address.to_dict() @@ -82,22 +98,22 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> Facility: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Facility from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Facility.parse_obj(obj) + return cls.model_validate(obj) - _obj = Facility.parse_obj({ - "address": Address.from_dict(obj.get("address")) if obj.get("address") is not None else None, + _obj = cls.model_validate({ + "address": Address.from_dict(obj["address"]) if obj.get("address") is not None else None, "code": obj.get("code"), "features": obj.get("features"), "href": obj.get("href"), "id": obj.get("id"), "ip_ranges": obj.get("ip_ranges"), - "metro": DeviceMetro.from_dict(obj.get("metro")) if obj.get("metro") is not None else None, + "metro": DeviceMetro.from_dict(obj["metro"]) if obj.get("metro") is not None else None, "name": obj.get("name") }) return _obj diff --git a/equinix_metal/equinix_metal/models/facility_input.py b/equinix_metal/equinix_metal/models/facility_input.py index c5fa415d..bfe72956 100644 --- a/equinix_metal/equinix_metal/models/facility_input.py +++ b/equinix_metal/equinix_metal/models/facility_input.py @@ -18,59 +18,75 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.facility_input_facility import FacilityInputFacility +from typing import Optional, Set +from typing_extensions import Self class FacilityInput(BaseModel): """ FacilityInput - """ - facility: FacilityInputFacility = Field(...) + """ # noqa: E501 + facility: FacilityInputFacility href: Optional[StrictStr] = None - __properties = ["facility", "href"] + __properties: ClassVar[List[str]] = ["facility", "href"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> FacilityInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of FacilityInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of facility if self.facility: _dict['facility'] = self.facility.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> FacilityInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of FacilityInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return FacilityInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = FacilityInput.parse_obj({ - "facility": FacilityInputFacility.from_dict(obj.get("facility")) if obj.get("facility") is not None else None, + _obj = cls.model_validate({ + "facility": FacilityInputFacility.from_dict(obj["facility"]) if obj.get("facility") is not None else None, "href": obj.get("href") }) return _obj diff --git a/equinix_metal/equinix_metal/models/facility_input_facility.py b/equinix_metal/equinix_metal/models/facility_input_facility.py index e8422cfe..d3f19736 100644 --- a/equinix_metal/equinix_metal/models/facility_input_facility.py +++ b/equinix_metal/equinix_metal/models/facility_input_facility.py @@ -18,11 +18,11 @@ import json import pprint import re # noqa: F401 - +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, ValidationError, conlist, validator -from typing import Union, Any, List, TYPE_CHECKING -from pydantic import StrictStr, Field +from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field FACILITYINPUTFACILITY_ANY_OF_SCHEMAS = ["List[str]", "str"] @@ -32,19 +32,21 @@ class FacilityInputFacility(BaseModel): """ # data type: List[str] - anyof_schema_1_validator: Optional[conlist(StrictStr)] = None + anyof_schema_1_validator: Optional[List[StrictStr]] = None # data type: str anyof_schema_2_validator: Optional[StrictStr] = None if TYPE_CHECKING: - actual_instance: Union[List[str], str] + actual_instance: Optional[Union[List[str], str]] = None else: - actual_instance: Any - any_of_schemas: List[str] = Field(FACILITYINPUTFACILITY_ANY_OF_SCHEMAS, const=True) + actual_instance: Any = None + any_of_schemas: List[str] = Field(default=Literal["List[str]", "str"]) - class Config: - validate_assignment = True + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: if args: if len(args) > 1: raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") @@ -54,9 +56,9 @@ def __init__(self, *args, **kwargs): else: super().__init__(**kwargs) - @validator('actual_instance') + @field_validator('actual_instance') def actual_instance_must_validate_anyof(cls, v): - instance = FacilityInputFacility.construct() + instance = FacilityInputFacility.model_construct() error_messages = [] # validate data type: List[str] try: @@ -77,13 +79,13 @@ def actual_instance_must_validate_anyof(cls, v): return v @classmethod - def from_dict(cls, obj: dict) -> FacilityInputFacility: + def from_dict(cls, obj: Dict[str, Any]) -> Self: return cls.from_json(json.dumps(obj)) @classmethod - def from_json(cls, json_str: str) -> FacilityInputFacility: + def from_json(cls, json_str: str) -> Self: """Returns the object represented by the json string""" - instance = FacilityInputFacility.construct() + instance = cls.model_construct() error_messages = [] # deserialize data into List[str] try: @@ -115,25 +117,23 @@ def to_json(self) -> str: if self.actual_instance is None: return "null" - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): return self.actual_instance.to_json() else: return json.dumps(self.actual_instance) - def to_dict(self) -> dict: + def to_dict(self) -> Optional[Union[Dict[str, Any], List[str], str]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: - return "null" + return None - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): return self.actual_instance.to_dict() else: - return json.dumps(self.actual_instance) + return self.actual_instance def to_str(self) -> str: """Returns the string representation of the actual instance""" - return pprint.pformat(self.dict()) + return pprint.pformat(self.model_dump()) diff --git a/equinix_metal/equinix_metal/models/facility_list.py b/equinix_metal/equinix_metal/models/facility_list.py index abe211ce..c6710424 100644 --- a/equinix_metal/equinix_metal/models/facility_list.py +++ b/equinix_metal/equinix_metal/models/facility_list.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.facility import Facility +from typing import Optional, Set +from typing_extensions import Self class FacilityList(BaseModel): """ FacilityList - """ - facilities: Optional[conlist(Facility)] = None + """ # noqa: E501 + facilities: Optional[List[Facility]] = None href: Optional[StrictStr] = None - __properties = ["facilities", "href"] + __properties: ClassVar[List[str]] = ["facilities", "href"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> FacilityList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of FacilityList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in facilities (list) _items = [] if self.facilities: @@ -65,16 +81,16 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> FacilityList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of FacilityList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return FacilityList.parse_obj(obj) + return cls.model_validate(obj) - _obj = FacilityList.parse_obj({ - "facilities": [Facility.from_dict(_item) for _item in obj.get("facilities")] if obj.get("facilities") is not None else None, + _obj = cls.model_validate({ + "facilities": [Facility.from_dict(_item) for _item in obj["facilities"]] if obj.get("facilities") is not None else None, "href": obj.get("href") }) return _obj diff --git a/equinix_metal/equinix_metal/models/filesystem.py b/equinix_metal/equinix_metal/models/filesystem.py index 26faa499..916864b1 100644 --- a/equinix_metal/equinix_metal/models/filesystem.py +++ b/equinix_metal/equinix_metal/models/filesystem.py @@ -18,60 +18,76 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.mount import Mount +from typing import Optional, Set +from typing_extensions import Self class Filesystem(BaseModel): """ Filesystem - """ + """ # noqa: E501 href: Optional[StrictStr] = None mount: Optional[Mount] = None - __properties = ["href", "mount"] + __properties: ClassVar[List[str]] = ["href", "mount"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> Filesystem: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Filesystem from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of mount if self.mount: _dict['mount'] = self.mount.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> Filesystem: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Filesystem from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Filesystem.parse_obj(obj) + return cls.model_validate(obj) - _obj = Filesystem.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "mount": Mount.from_dict(obj.get("mount")) if obj.get("mount") is not None else None + "mount": Mount.from_dict(obj["mount"]) if obj.get("mount") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/find_ip_address_by_id200_response.py b/equinix_metal/equinix_metal/models/find_ip_address_by_id200_response.py index e887295a..2feb0ade 100644 --- a/equinix_metal/equinix_metal/models/find_ip_address_by_id200_response.py +++ b/equinix_metal/equinix_metal/models/find_ip_address_by_id200_response.py @@ -14,18 +14,16 @@ from __future__ import annotations -from inspect import getfullargspec import json import pprint -import re # noqa: F401 - +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator from typing import Any, List, Optional -from pydantic import BaseModel, Field, StrictStr, ValidationError, validator from equinix_metal.models.ip_assignment import IPAssignment from equinix_metal.models.ip_reservation import IPReservation from equinix_metal.models.vrf_ip_reservation import VrfIpReservation -from typing import Union, Any, List, TYPE_CHECKING from pydantic import StrictStr, Field +from typing import Union, List, Optional, Dict +from typing_extensions import Literal, Self FINDIPADDRESSBYID200RESPONSE_ONE_OF_SCHEMAS = ["IPAssignment", "IPReservation", "VrfIpReservation"] @@ -39,16 +37,16 @@ class FindIPAddressById200Response(BaseModel): oneof_schema_2_validator: Optional[IPReservation] = None # data type: VrfIpReservation oneof_schema_3_validator: Optional[VrfIpReservation] = None - if TYPE_CHECKING: - actual_instance: Union[IPAssignment, IPReservation, VrfIpReservation] - else: - actual_instance: Any - one_of_schemas: List[str] = Field(FINDIPADDRESSBYID200RESPONSE_ONE_OF_SCHEMAS, const=True) + actual_instance: Optional[Union[IPAssignment, IPReservation, VrfIpReservation]] = None + one_of_schemas: List[str] = Field(default=Literal["IPAssignment", "IPReservation", "VrfIpReservation"]) + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - validate_assignment = True - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: if args: if len(args) > 1: raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") @@ -58,9 +56,9 @@ def __init__(self, *args, **kwargs): else: super().__init__(**kwargs) - @validator('actual_instance') + @field_validator('actual_instance') def actual_instance_must_validate_oneof(cls, v): - instance = FindIPAddressById200Response.construct() + instance = FindIPAddressById200Response.model_construct() error_messages = [] match = 0 # validate data type: IPAssignment @@ -88,13 +86,13 @@ def actual_instance_must_validate_oneof(cls, v): return v @classmethod - def from_dict(cls, obj: dict) -> FindIPAddressById200Response: + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: return cls.from_json(json.dumps(obj)) @classmethod - def from_json(cls, json_str: str) -> FindIPAddressById200Response: + def from_json(cls, json_str: str) -> Self: """Returns the object represented by the json string""" - instance = FindIPAddressById200Response.construct() + instance = cls.model_construct() error_messages = [] match = 0 @@ -131,19 +129,17 @@ def to_json(self) -> str: if self.actual_instance is None: return "null" - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): return self.actual_instance.to_json() else: return json.dumps(self.actual_instance) - def to_dict(self) -> dict: + def to_dict(self) -> Optional[Union[Dict[str, Any], IPAssignment, IPReservation, VrfIpReservation]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None - to_dict = getattr(self.actual_instance, "to_dict", None) - if callable(to_dict): + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): return self.actual_instance.to_dict() else: # primitive type @@ -151,6 +147,6 @@ def to_dict(self) -> dict: def to_str(self) -> str: """Returns the string representation of the actual instance""" - return pprint.pformat(self.dict()) + return pprint.pformat(self.model_dump()) diff --git a/equinix_metal/equinix_metal/models/find_metal_gateway_by_id200_response.py b/equinix_metal/equinix_metal/models/find_metal_gateway_by_id200_response.py index 7a616278..a545a04d 100644 --- a/equinix_metal/equinix_metal/models/find_metal_gateway_by_id200_response.py +++ b/equinix_metal/equinix_metal/models/find_metal_gateway_by_id200_response.py @@ -14,17 +14,15 @@ from __future__ import annotations -from inspect import getfullargspec import json import pprint -import re # noqa: F401 - +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator from typing import Any, List, Optional -from pydantic import BaseModel, Field, StrictStr, ValidationError, validator from equinix_metal.models.metal_gateway import MetalGateway from equinix_metal.models.vrf_metal_gateway import VrfMetalGateway -from typing import Union, Any, List, TYPE_CHECKING from pydantic import StrictStr, Field +from typing import Union, List, Optional, Dict +from typing_extensions import Literal, Self FINDMETALGATEWAYBYID200RESPONSE_ONE_OF_SCHEMAS = ["MetalGateway", "VrfMetalGateway"] @@ -36,16 +34,16 @@ class FindMetalGatewayById200Response(BaseModel): oneof_schema_1_validator: Optional[MetalGateway] = None # data type: VrfMetalGateway oneof_schema_2_validator: Optional[VrfMetalGateway] = None - if TYPE_CHECKING: - actual_instance: Union[MetalGateway, VrfMetalGateway] - else: - actual_instance: Any - one_of_schemas: List[str] = Field(FINDMETALGATEWAYBYID200RESPONSE_ONE_OF_SCHEMAS, const=True) + actual_instance: Optional[Union[MetalGateway, VrfMetalGateway]] = None + one_of_schemas: List[str] = Field(default=Literal["MetalGateway", "VrfMetalGateway"]) + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - validate_assignment = True - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: if args: if len(args) > 1: raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") @@ -55,9 +53,9 @@ def __init__(self, *args, **kwargs): else: super().__init__(**kwargs) - @validator('actual_instance') + @field_validator('actual_instance') def actual_instance_must_validate_oneof(cls, v): - instance = FindMetalGatewayById200Response.construct() + instance = FindMetalGatewayById200Response.model_construct() error_messages = [] match = 0 # validate data type: MetalGateway @@ -80,13 +78,13 @@ def actual_instance_must_validate_oneof(cls, v): return v @classmethod - def from_dict(cls, obj: dict) -> FindMetalGatewayById200Response: + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: return cls.from_json(json.dumps(obj)) @classmethod - def from_json(cls, json_str: str) -> FindMetalGatewayById200Response: + def from_json(cls, json_str: str) -> Self: """Returns the object represented by the json string""" - instance = FindMetalGatewayById200Response.construct() + instance = cls.model_construct() error_messages = [] match = 0 @@ -117,19 +115,17 @@ def to_json(self) -> str: if self.actual_instance is None: return "null" - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): return self.actual_instance.to_json() else: return json.dumps(self.actual_instance) - def to_dict(self) -> dict: + def to_dict(self) -> Optional[Union[Dict[str, Any], MetalGateway, VrfMetalGateway]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None - to_dict = getattr(self.actual_instance, "to_dict", None) - if callable(to_dict): + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): return self.actual_instance.to_dict() else: # primitive type @@ -137,6 +133,6 @@ def to_dict(self) -> dict: def to_str(self) -> str: """Returns the string representation of the actual instance""" - return pprint.pformat(self.dict()) + return pprint.pformat(self.model_dump()) diff --git a/equinix_metal/equinix_metal/models/find_traffic_timeframe_parameter.py b/equinix_metal/equinix_metal/models/find_traffic_timeframe_parameter.py index 3bbe9875..9f683f4a 100644 --- a/equinix_metal/equinix_metal/models/find_traffic_timeframe_parameter.py +++ b/equinix_metal/equinix_metal/models/find_traffic_timeframe_parameter.py @@ -19,54 +19,71 @@ import json from datetime import datetime -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class FindTrafficTimeframeParameter(BaseModel): """ FindTrafficTimeframeParameter - """ - ended_at: datetime = Field(...) + """ # noqa: E501 + ended_at: datetime href: Optional[StrictStr] = None - started_at: datetime = Field(...) - __properties = ["ended_at", "href", "started_at"] + started_at: datetime + __properties: ClassVar[List[str]] = ["ended_at", "href", "started_at"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> FindTrafficTimeframeParameter: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of FindTrafficTimeframeParameter from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> FindTrafficTimeframeParameter: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of FindTrafficTimeframeParameter from a dict""" if obj is None: return None if not isinstance(obj, dict): - return FindTrafficTimeframeParameter.parse_obj(obj) + return cls.model_validate(obj) - _obj = FindTrafficTimeframeParameter.parse_obj({ + _obj = cls.model_validate({ "ended_at": obj.get("ended_at"), "href": obj.get("href"), "started_at": obj.get("started_at") diff --git a/equinix_metal/equinix_metal/models/firmware_set.py b/equinix_metal/equinix_metal/models/firmware_set.py index 704aadac..dc5c8592 100644 --- a/equinix_metal/equinix_metal/models/firmware_set.py +++ b/equinix_metal/equinix_metal/models/firmware_set.py @@ -19,52 +19,73 @@ import json from datetime import datetime -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.attribute import Attribute from equinix_metal.models.component import Component +from typing import Optional, Set +from typing_extensions import Self class FirmwareSet(BaseModel): """ Represents a Firmware Set - """ - attributes: Optional[conlist(Attribute)] = Field(None, description="Represents a list of attributes") - component_firmware: Optional[conlist(Component)] = Field(None, description="List of components versions") - created_at: Optional[datetime] = Field(None, description="Datetime when the block was created.") + """ # noqa: E501 + attributes: Optional[List[Attribute]] = Field(default=None, description="Represents a list of attributes") + component_firmware: Optional[List[Component]] = Field(default=None, description="List of components versions") + created_at: Optional[datetime] = Field(default=None, description="Datetime when the block was created.") href: Optional[StrictStr] = None - name: StrictStr = Field(..., description="Firmware Set Name") - updated_at: Optional[datetime] = Field(None, description="Datetime when the block was updated.") - uuid: StrictStr = Field(..., description="Firmware Set UUID") - __properties = ["attributes", "component_firmware", "created_at", "href", "name", "updated_at", "uuid"] + name: StrictStr = Field(description="Firmware Set Name") + updated_at: Optional[datetime] = Field(default=None, description="Datetime when the block was updated.") + uuid: StrictStr = Field(description="Firmware Set UUID") + __properties: ClassVar[List[str]] = ["attributes", "component_firmware", "created_at", "href", "name", "updated_at", "uuid"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> FirmwareSet: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of FirmwareSet from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - "created_at", - "name", - "updated_at", - "uuid", - }, - exclude_none=True) + 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. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "created_at", + "name", + "updated_at", + "uuid", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in attributes (list) _items = [] if self.attributes: @@ -82,17 +103,17 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> FirmwareSet: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of FirmwareSet from a dict""" if obj is None: return None if not isinstance(obj, dict): - return FirmwareSet.parse_obj(obj) + return cls.model_validate(obj) - _obj = FirmwareSet.parse_obj({ - "attributes": [Attribute.from_dict(_item) for _item in obj.get("attributes")] if obj.get("attributes") is not None else None, - "component_firmware": [Component.from_dict(_item) for _item in obj.get("component_firmware")] if obj.get("component_firmware") is not None else None, + _obj = cls.model_validate({ + "attributes": [Attribute.from_dict(_item) for _item in obj["attributes"]] if obj.get("attributes") is not None else None, + "component_firmware": [Component.from_dict(_item) for _item in obj["component_firmware"]] if obj.get("component_firmware") is not None else None, "created_at": obj.get("created_at"), "href": obj.get("href"), "name": obj.get("name"), diff --git a/equinix_metal/equinix_metal/models/firmware_set_list_response.py b/equinix_metal/equinix_metal/models/firmware_set_list_response.py index a69c0e01..288459b2 100644 --- a/equinix_metal/equinix_metal/models/firmware_set_list_response.py +++ b/equinix_metal/equinix_metal/models/firmware_set_list_response.py @@ -18,48 +18,64 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.firmware_set import FirmwareSet +from typing import Optional, Set +from typing_extensions import Self class FirmwareSetListResponse(BaseModel): """ Represents collection of Firmware Sets - """ + """ # noqa: E501 href: Optional[StrictStr] = None - page: Optional[StrictInt] = Field(None, description="Page returned") - page_count: Optional[StrictInt] = Field(None, description="Items returned in current page") - page_size: Optional[StrictInt] = Field(None, description="Max number of items returned in a page") - records: Optional[conlist(FirmwareSet)] = Field(None, description="Represents a list of FirmwareSets") - total_pages: Optional[StrictInt] = Field(None, description="Total count of pages") - total_record_count: Optional[StrictInt] = Field(None, description="Total count of items") - __properties = ["href", "page", "page_count", "page_size", "records", "total_pages", "total_record_count"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + page: Optional[StrictInt] = Field(default=None, description="Page returned") + page_count: Optional[StrictInt] = Field(default=None, description="Items returned in current page") + page_size: Optional[StrictInt] = Field(default=None, description="Max number of items returned in a page") + records: Optional[List[FirmwareSet]] = Field(default=None, description="Represents a list of FirmwareSets") + total_pages: Optional[StrictInt] = Field(default=None, description="Total count of pages") + total_record_count: Optional[StrictInt] = Field(default=None, description="Total count of items") + __properties: ClassVar[List[str]] = ["href", "page", "page_count", "page_size", "records", "total_pages", "total_record_count"] + + 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.dict(by_alias=True)) + 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) -> FirmwareSetListResponse: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of FirmwareSetListResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in records (list) _items = [] if self.records: @@ -70,20 +86,20 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> FirmwareSetListResponse: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of FirmwareSetListResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return FirmwareSetListResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = FirmwareSetListResponse.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), "page": obj.get("page"), "page_count": obj.get("page_count"), "page_size": obj.get("page_size"), - "records": [FirmwareSet.from_dict(_item) for _item in obj.get("records")] if obj.get("records") is not None else None, + "records": [FirmwareSet.from_dict(_item) for _item in obj["records"]] if obj.get("records") is not None else None, "total_pages": obj.get("total_pages"), "total_record_count": obj.get("total_record_count") }) diff --git a/equinix_metal/equinix_metal/models/firmware_set_response.py b/equinix_metal/equinix_metal/models/firmware_set_response.py index c25e225a..82c16e98 100644 --- a/equinix_metal/equinix_metal/models/firmware_set_response.py +++ b/equinix_metal/equinix_metal/models/firmware_set_response.py @@ -18,60 +18,76 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.firmware_set import FirmwareSet +from typing import Optional, Set +from typing_extensions import Self class FirmwareSetResponse(BaseModel): """ Represents single Firmware set response - """ + """ # noqa: E501 href: Optional[StrictStr] = None record: Optional[FirmwareSet] = None - __properties = ["href", "record"] + __properties: ClassVar[List[str]] = ["href", "record"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> FirmwareSetResponse: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of FirmwareSetResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of record if self.record: _dict['record'] = self.record.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> FirmwareSetResponse: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of FirmwareSetResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return FirmwareSetResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = FirmwareSetResponse.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "record": FirmwareSet.from_dict(obj.get("record")) if obj.get("record") is not None else None + "record": FirmwareSet.from_dict(obj["record"]) if obj.get("record") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/global_bgp_range.py b/equinix_metal/equinix_metal/models/global_bgp_range.py index 2c0c914f..8f52733a 100644 --- a/equinix_metal/equinix_metal/models/global_bgp_range.py +++ b/equinix_metal/equinix_metal/models/global_bgp_range.py @@ -18,65 +18,81 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.href import Href +from typing import Optional, Set +from typing_extensions import Self class GlobalBgpRange(BaseModel): """ GlobalBgpRange - """ + """ # noqa: E501 address_family: Optional[StrictInt] = None href: Optional[StrictStr] = None id: Optional[StrictStr] = None project: Optional[Href] = None range: Optional[StrictStr] = None - __properties = ["address_family", "href", "id", "project", "range"] + __properties: ClassVar[List[str]] = ["address_family", "href", "id", "project", "range"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> GlobalBgpRange: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of GlobalBgpRange from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of project if self.project: _dict['project'] = self.project.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> GlobalBgpRange: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of GlobalBgpRange from a dict""" if obj is None: return None if not isinstance(obj, dict): - return GlobalBgpRange.parse_obj(obj) + return cls.model_validate(obj) - _obj = GlobalBgpRange.parse_obj({ + _obj = cls.model_validate({ "address_family": obj.get("address_family"), "href": obj.get("href"), "id": obj.get("id"), - "project": Href.from_dict(obj.get("project")) if obj.get("project") is not None else None, + "project": Href.from_dict(obj["project"]) if obj.get("project") is not None else None, "range": obj.get("range") }) return _obj diff --git a/equinix_metal/equinix_metal/models/global_bgp_range_list.py b/equinix_metal/equinix_metal/models/global_bgp_range_list.py index 428ff11a..397ecd43 100644 --- a/equinix_metal/equinix_metal/models/global_bgp_range_list.py +++ b/equinix_metal/equinix_metal/models/global_bgp_range_list.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.global_bgp_range import GlobalBgpRange +from typing import Optional, Set +from typing_extensions import Self class GlobalBgpRangeList(BaseModel): """ GlobalBgpRangeList - """ - global_bgp_ranges: Optional[conlist(GlobalBgpRange)] = None + """ # noqa: E501 + global_bgp_ranges: Optional[List[GlobalBgpRange]] = None href: Optional[StrictStr] = None - __properties = ["global_bgp_ranges", "href"] + __properties: ClassVar[List[str]] = ["global_bgp_ranges", "href"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> GlobalBgpRangeList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of GlobalBgpRangeList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in global_bgp_ranges (list) _items = [] if self.global_bgp_ranges: @@ -65,16 +81,16 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> GlobalBgpRangeList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of GlobalBgpRangeList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return GlobalBgpRangeList.parse_obj(obj) + return cls.model_validate(obj) - _obj = GlobalBgpRangeList.parse_obj({ - "global_bgp_ranges": [GlobalBgpRange.from_dict(_item) for _item in obj.get("global_bgp_ranges")] if obj.get("global_bgp_ranges") is not None else None, + _obj = cls.model_validate({ + "global_bgp_ranges": [GlobalBgpRange.from_dict(_item) for _item in obj["global_bgp_ranges"]] if obj.get("global_bgp_ranges") is not None else None, "href": obj.get("href") }) return _obj diff --git a/equinix_metal/equinix_metal/models/hardware_reservation.py b/equinix_metal/equinix_metal/models/hardware_reservation.py index 0a2deb64..ad83a84c 100644 --- a/equinix_metal/equinix_metal/models/hardware_reservation.py +++ b/equinix_metal/equinix_metal/models/hardware_reservation.py @@ -19,56 +19,73 @@ import json from datetime import datetime -from typing import Optional, Union -from pydantic import BaseModel, Field, StrictBool, StrictFloat, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union from equinix_metal.models.facility import Facility from equinix_metal.models.plan import Plan from equinix_metal.models.project import Project +from typing import Optional, Set +from typing_extensions import Self class HardwareReservation(BaseModel): """ HardwareReservation - """ + """ # noqa: E501 created_at: Optional[datetime] = None - custom_rate: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="Amount that will be charged for every billing_cycle.") + custom_rate: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Amount that will be charged for every billing_cycle.") device: Optional[Device] = None facility: Optional[Facility] = None href: Optional[StrictStr] = None id: Optional[StrictStr] = None - need_of_service: Optional[StrictBool] = Field(None, description="Whether this Device requires assistance from Equinix Metal.") + need_of_service: Optional[StrictBool] = Field(default=None, description="Whether this Device requires assistance from Equinix Metal.") plan: Optional[Plan] = None project: Optional[Project] = None - provisionable: Optional[StrictBool] = Field(None, description="Whether the reserved server is provisionable or not. Spare devices can't be provisioned unless they are activated first.") - short_id: Optional[StrictStr] = Field(None, description="Short version of the ID.") - spare: Optional[StrictBool] = Field(None, description="Whether the Hardware Reservation is a spare. Spare Hardware Reservations are used when a Hardware Reservations requires service from Equinix Metal") - switch_uuid: Optional[StrictStr] = Field(None, description="Switch short id. This can be used to determine if two devices are connected to the same switch, for example.") - termination_time: Optional[datetime] = Field(None, description="Expiration date for the reservation.") - __properties = ["created_at", "custom_rate", "device", "facility", "href", "id", "need_of_service", "plan", "project", "provisionable", "short_id", "spare", "switch_uuid", "termination_time"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + provisionable: Optional[StrictBool] = Field(default=None, description="Whether the reserved server is provisionable or not. Spare devices can't be provisioned unless they are activated first.") + short_id: Optional[StrictStr] = Field(default=None, description="Short version of the ID.") + spare: Optional[StrictBool] = Field(default=None, description="Whether the Hardware Reservation is a spare. Spare Hardware Reservations are used when a Hardware Reservations requires service from Equinix Metal") + switch_uuid: Optional[StrictStr] = Field(default=None, description="Switch short id. This can be used to determine if two devices are connected to the same switch, for example.") + termination_time: Optional[datetime] = Field(default=None, description="Expiration date for the reservation.") + __properties: ClassVar[List[str]] = ["created_at", "custom_rate", "device", "facility", "href", "id", "need_of_service", "plan", "project", "provisionable", "short_id", "spare", "switch_uuid", "termination_time"] + + 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.dict(by_alias=True)) + 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) -> HardwareReservation: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of HardwareReservation from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of device if self.device: _dict['device'] = self.device.to_dict() @@ -84,24 +101,24 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> HardwareReservation: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of HardwareReservation from a dict""" if obj is None: return None if not isinstance(obj, dict): - return HardwareReservation.parse_obj(obj) + return cls.model_validate(obj) - _obj = HardwareReservation.parse_obj({ + _obj = cls.model_validate({ "created_at": obj.get("created_at"), "custom_rate": obj.get("custom_rate"), - "device": Device.from_dict(obj.get("device")) if obj.get("device") is not None else None, - "facility": Facility.from_dict(obj.get("facility")) if obj.get("facility") is not None else None, + "device": Device.from_dict(obj["device"]) if obj.get("device") is not None else None, + "facility": Facility.from_dict(obj["facility"]) if obj.get("facility") is not None else None, "href": obj.get("href"), "id": obj.get("id"), "need_of_service": obj.get("need_of_service"), - "plan": Plan.from_dict(obj.get("plan")) if obj.get("plan") is not None else None, - "project": Project.from_dict(obj.get("project")) if obj.get("project") is not None else None, + "plan": Plan.from_dict(obj["plan"]) if obj.get("plan") is not None else None, + "project": Project.from_dict(obj["project"]) if obj.get("project") is not None else None, "provisionable": obj.get("provisionable"), "short_id": obj.get("short_id"), "spare": obj.get("spare"), @@ -111,5 +128,6 @@ def from_dict(cls, obj: dict) -> HardwareReservation: return _obj from equinix_metal.models.device import Device -HardwareReservation.update_forward_refs() +# TODO: Rewrite to not use raise_errors +HardwareReservation.model_rebuild(raise_errors=False) diff --git a/equinix_metal/equinix_metal/models/hardware_reservation_list.py b/equinix_metal/equinix_metal/models/hardware_reservation_list.py index ca429fd0..90c015b7 100644 --- a/equinix_metal/equinix_metal/models/hardware_reservation_list.py +++ b/equinix_metal/equinix_metal/models/hardware_reservation_list.py @@ -18,45 +18,61 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.hardware_reservation import HardwareReservation from equinix_metal.models.meta import Meta +from typing import Optional, Set +from typing_extensions import Self class HardwareReservationList(BaseModel): """ HardwareReservationList - """ - hardware_reservations: Optional[conlist(HardwareReservation)] = None + """ # noqa: E501 + hardware_reservations: Optional[List[HardwareReservation]] = None href: Optional[StrictStr] = None meta: Optional[Meta] = None - __properties = ["hardware_reservations", "href", "meta"] + __properties: ClassVar[List[str]] = ["hardware_reservations", "href", "meta"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> HardwareReservationList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of HardwareReservationList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in hardware_reservations (list) _items = [] if self.hardware_reservations: @@ -70,18 +86,18 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> HardwareReservationList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of HardwareReservationList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return HardwareReservationList.parse_obj(obj) + return cls.model_validate(obj) - _obj = HardwareReservationList.parse_obj({ - "hardware_reservations": [HardwareReservation.from_dict(_item) for _item in obj.get("hardware_reservations")] if obj.get("hardware_reservations") is not None else None, + _obj = cls.model_validate({ + "hardware_reservations": [HardwareReservation.from_dict(_item) for _item in obj["hardware_reservations"]] if obj.get("hardware_reservations") is not None else None, "href": obj.get("href"), - "meta": Meta.from_dict(obj.get("meta")) if obj.get("meta") is not None else None + "meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/href.py b/equinix_metal/equinix_metal/models/href.py index 2a148e10..041f2d91 100644 --- a/equinix_metal/equinix_metal/models/href.py +++ b/equinix_metal/equinix_metal/models/href.py @@ -18,53 +18,69 @@ import re # noqa: F401 import json - - -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self class Href(BaseModel): """ Href - """ - href: StrictStr = Field(...) - __properties = ["href"] + """ # noqa: E501 + href: StrictStr + __properties: ClassVar[List[str]] = ["href"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> Href: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Href from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> Href: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Href from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Href.parse_obj(obj) + return cls.model_validate(obj) - _obj = Href.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href") }) return _obj diff --git a/equinix_metal/equinix_metal/models/instances_batch_create_input.py b/equinix_metal/equinix_metal/models/instances_batch_create_input.py index ceeec998..b8c0d91a 100644 --- a/equinix_metal/equinix_metal/models/instances_batch_create_input.py +++ b/equinix_metal/equinix_metal/models/instances_batch_create_input.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.instances_batch_create_input_batches_inner import InstancesBatchCreateInputBatchesInner +from typing import Optional, Set +from typing_extensions import Self class InstancesBatchCreateInput(BaseModel): """ InstancesBatchCreateInput - """ - batches: Optional[conlist(InstancesBatchCreateInputBatchesInner)] = None + """ # noqa: E501 + batches: Optional[List[InstancesBatchCreateInputBatchesInner]] = None href: Optional[StrictStr] = None - __properties = ["batches", "href"] + __properties: ClassVar[List[str]] = ["batches", "href"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> InstancesBatchCreateInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of InstancesBatchCreateInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in batches (list) _items = [] if self.batches: @@ -65,16 +81,16 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> InstancesBatchCreateInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of InstancesBatchCreateInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return InstancesBatchCreateInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = InstancesBatchCreateInput.parse_obj({ - "batches": [InstancesBatchCreateInputBatchesInner.from_dict(_item) for _item in obj.get("batches")] if obj.get("batches") is not None else None, + _obj = cls.model_validate({ + "batches": [InstancesBatchCreateInputBatchesInner.from_dict(_item) for _item in obj["batches"]] if obj.get("batches") is not None else None, "href": obj.get("href") }) return _obj diff --git a/equinix_metal/equinix_metal/models/instances_batch_create_input_batches_inner.py b/equinix_metal/equinix_metal/models/instances_batch_create_input_batches_inner.py index ebb22c57..dc692a47 100644 --- a/equinix_metal/equinix_metal/models/instances_batch_create_input_batches_inner.py +++ b/equinix_metal/equinix_metal/models/instances_batch_create_input_batches_inner.py @@ -19,83 +19,100 @@ import json from datetime import datetime -from typing import Any, Dict, List, Optional, Union -from pydantic import BaseModel, Field, StrictBool, StrictFloat, StrictInt, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union from equinix_metal.models.facility_input_facility import FacilityInputFacility from equinix_metal.models.ip_address import IPAddress from equinix_metal.models.ssh_key_input import SSHKeyInput from equinix_metal.models.storage import Storage +from typing import Optional, Set +from typing_extensions import Self class InstancesBatchCreateInputBatchesInner(BaseModel): """ InstancesBatchCreateInputBatchesInner - """ - hostnames: Optional[conlist(StrictStr)] = None - quantity: Optional[StrictInt] = Field(None, description="The number of devices to create in this batch. The hostname may contain an `{{index}}` placeholder, which will be replaced with the index of the device in the batch. For example, if the hostname is `device-{{index}}`, the first device in the batch will have the hostname `device-01`, the second device will have the hostname `device-02`, and so on.") + """ # noqa: E501 + hostnames: Optional[List[StrictStr]] = None + quantity: Optional[StrictInt] = Field(default=None, description="The number of devices to create in this batch. The hostname may contain an `{{index}}` placeholder, which will be replaced with the index of the device in the batch. For example, if the hostname is `device-{{index}}`, the first device in the batch will have the hostname `device-01`, the second device will have the hostname `device-02`, and so on.") href: Optional[StrictStr] = None - metro: StrictStr = Field(..., description="Metro code or ID of where the instance should be provisioned in. Either metro or facility must be provided.") - always_pxe: Optional[StrictBool] = Field(None, description="When true, devices with a `custom_ipxe` OS will always boot to iPXE. The default setting of false ensures that iPXE will be used on only the first boot.") - billing_cycle: Optional[StrictStr] = Field(None, description="The billing cycle of the device.") - customdata: Optional[Dict[str, Any]] = Field(None, description="Customdata is an arbitrary JSON value that can be accessed via the metadata service.") - description: Optional[StrictStr] = Field(None, description="Any description of the device or how it will be used. This may be used to inform other API consumers with project access.") - features: Optional[conlist(StrictStr)] = Field(None, description="The features attribute allows you to optionally specify what features your server should have. In the API shorthand syntax, all features listed are `required`: ``` { \"features\": [\"tpm\"] } ``` Alternatively, if you do not require a certain feature, but would prefer to be assigned a server with that feature if there are any available, you may specify that feature with a `preferred` value. The request will not fail if we have no servers with that feature in our inventory. The API offers an alternative syntax for mixing preferred and required features: ``` { \"features\": { \"tpm\": \"required\", \"raid\": \"preferred\" } } ``` The request will only fail if there are no available servers matching the required `tpm` criteria.") - hardware_reservation_id: Optional[StrictStr] = Field(None, description="The Hardware Reservation UUID to provision. Alternatively, `next-available` can be specified to select from any of the available hardware reservations. An error will be returned if the requested reservation option is not available. See [Reserved Hardware](https://metal.equinix.com/developers/docs/deploy/reserved/) for more details.") - hostname: Optional[StrictStr] = Field(None, description="The hostname to use within the operating system. The same hostname may be used on multiple devices within a project.") - ip_addresses: Optional[conlist(IPAddress)] = Field(None, description="The `ip_addresses attribute will allow you to specify the addresses you want created with your device. The default value configures public IPv4, public IPv6, and private IPv4. Private IPv4 address is required. When specifying `ip_addresses`, one of the array items must enable private IPv4. Some operating systems require public IPv4 address. In those cases you will receive an error message if public IPv4 is not enabled. For example, to only configure your server with a private IPv4 address, you can send `{ \"ip_addresses\": [{ \"address_family\": 4, \"public\": false }] }`. It is possible to request a subnet size larger than a `/30` by assigning addresses using the UUID(s) of ip_reservations in your project. For example, `{ \"ip_addresses\": [..., {\"address_family\": 4, \"public\": true, \"ip_reservations\": [\"uuid1\", \"uuid2\"]}] }` To access a server without public IPs, you can use our Out-of-Band console access (SOS) or proxy through another server in the project with public IPs enabled.") - ipxe_script_url: Optional[StrictStr] = Field(None, description="When set, the device will chainload an iPXE Script at boot fetched from the supplied URL. See [Custom iPXE](https://metal.equinix.com/developers/docs/operating-systems/custom-ipxe/) for more details.") - locked: Optional[StrictBool] = Field(False, description="Whether the device should be locked, preventing accidental deletion.") - network_frozen: Optional[StrictBool] = Field(None, description="If true, this instance can not be converted to a different network type.") - no_ssh_keys: Optional[StrictBool] = Field(False, description="Overrides default behaviour of attaching all of the organization members ssh keys and project ssh keys to device if no specific keys specified") - operating_system: StrictStr = Field(..., description="The slug of the operating system to provision. Check the Equinix Metal operating system documentation for rules that may be imposed per operating system, including restrictions on IP address options and device plans.") - plan: StrictStr = Field(..., description="The slug of the device plan to provision.") - private_ipv4_subnet_size: Optional[StrictInt] = Field(28, description="Deprecated. Use ip_addresses. Subnet range for addresses allocated to this device.") - project_ssh_keys: Optional[conlist(StrictStr)] = Field(None, description="A list of UUIDs identifying the device parent project that should be authorized to access this device (typically via /root/.ssh/authorized_keys). These keys will also appear in the device metadata. If no SSH keys are specified (`user_ssh_keys`, `project_ssh_keys`, and `ssh_keys` are all empty lists or omitted), all parent project keys, parent project members keys and organization members keys will be included. This behaviour can be changed with 'no_ssh_keys' option to omit any SSH key being added. ") - public_ipv4_subnet_size: Optional[StrictInt] = Field(31, description="Deprecated. Use ip_addresses. Subnet range for addresses allocated to this device. Your project must have addresses available for a non-default request.") - spot_instance: Optional[StrictBool] = Field(None, description="Create a spot instance. Spot instances are created with a maximum bid price. If the bid price is not met, the spot instance will be terminated as indicated by the `termination_time` field.") - spot_price_max: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="The maximum amount to bid for a spot instance.") - ssh_keys: Optional[conlist(SSHKeyInput)] = Field(None, description="A list of new or existing project ssh_keys that should be authorized to access this device (typically via /root/.ssh/authorized_keys). These keys will also appear in the device metadata. These keys are added in addition to any keys defined by `project_ssh_keys` and `user_ssh_keys`. ") + metro: StrictStr = Field(description="Metro code or ID of where the instance should be provisioned in. Either metro or facility must be provided.") + always_pxe: Optional[StrictBool] = Field(default=None, description="When true, devices with a `custom_ipxe` OS will always boot to iPXE. The default setting of false ensures that iPXE will be used on only the first boot.") + billing_cycle: Optional[StrictStr] = Field(default=None, description="The billing cycle of the device.") + customdata: Optional[Dict[str, Any]] = Field(default=None, description="Customdata is an arbitrary JSON value that can be accessed via the metadata service.") + description: Optional[StrictStr] = Field(default=None, description="Any description of the device or how it will be used. This may be used to inform other API consumers with project access.") + features: Optional[List[StrictStr]] = Field(default=None, description="The features attribute allows you to optionally specify what features your server should have. In the API shorthand syntax, all features listed are `required`: ``` { \"features\": [\"tpm\"] } ``` Alternatively, if you do not require a certain feature, but would prefer to be assigned a server with that feature if there are any available, you may specify that feature with a `preferred` value. The request will not fail if we have no servers with that feature in our inventory. The API offers an alternative syntax for mixing preferred and required features: ``` { \"features\": { \"tpm\": \"required\", \"raid\": \"preferred\" } } ``` The request will only fail if there are no available servers matching the required `tpm` criteria.") + hardware_reservation_id: Optional[StrictStr] = Field(default=None, description="The Hardware Reservation UUID to provision. Alternatively, `next-available` can be specified to select from any of the available hardware reservations. An error will be returned if the requested reservation option is not available. See [Reserved Hardware](https://metal.equinix.com/developers/docs/deploy/reserved/) for more details.") + hostname: Optional[StrictStr] = Field(default=None, description="The hostname to use within the operating system. The same hostname may be used on multiple devices within a project.") + ip_addresses: Optional[List[IPAddress]] = Field(default=None, description="The `ip_addresses attribute will allow you to specify the addresses you want created with your device. The default value configures public IPv4, public IPv6, and private IPv4. Private IPv4 address is required. When specifying `ip_addresses`, one of the array items must enable private IPv4. Some operating systems require public IPv4 address. In those cases you will receive an error message if public IPv4 is not enabled. For example, to only configure your server with a private IPv4 address, you can send `{ \"ip_addresses\": [{ \"address_family\": 4, \"public\": false }] }`. It is possible to request a subnet size larger than a `/30` by assigning addresses using the UUID(s) of ip_reservations in your project. For example, `{ \"ip_addresses\": [..., {\"address_family\": 4, \"public\": true, \"ip_reservations\": [\"uuid1\", \"uuid2\"]}] }` To access a server without public IPs, you can use our Out-of-Band console access (SOS) or proxy through another server in the project with public IPs enabled.") + ipxe_script_url: Optional[StrictStr] = Field(default=None, description="When set, the device will chainload an iPXE Script at boot fetched from the supplied URL. See [Custom iPXE](https://metal.equinix.com/developers/docs/operating-systems/custom-ipxe/) for more details.") + locked: Optional[StrictBool] = Field(default=False, description="Whether the device should be locked, preventing accidental deletion.") + network_frozen: Optional[StrictBool] = Field(default=None, description="If true, this instance can not be converted to a different network type.") + no_ssh_keys: Optional[StrictBool] = Field(default=False, description="Overrides default behaviour of attaching all of the organization members ssh keys and project ssh keys to device if no specific keys specified") + operating_system: StrictStr = Field(description="The slug of the operating system to provision. Check the Equinix Metal operating system documentation for rules that may be imposed per operating system, including restrictions on IP address options and device plans.") + plan: StrictStr = Field(description="The slug of the device plan to provision.") + private_ipv4_subnet_size: Optional[StrictInt] = Field(default=28, description="Deprecated. Use ip_addresses. Subnet range for addresses allocated to this device.") + project_ssh_keys: Optional[List[StrictStr]] = Field(default=None, description="A list of UUIDs identifying the device parent project that should be authorized to access this device (typically via /root/.ssh/authorized_keys). These keys will also appear in the device metadata. If no SSH keys are specified (`user_ssh_keys`, `project_ssh_keys`, and `ssh_keys` are all empty lists or omitted), all parent project keys, parent project members keys and organization members keys will be included. This behaviour can be changed with 'no_ssh_keys' option to omit any SSH key being added. ") + public_ipv4_subnet_size: Optional[StrictInt] = Field(default=31, description="Deprecated. Use ip_addresses. Subnet range for addresses allocated to this device. Your project must have addresses available for a non-default request.") + spot_instance: Optional[StrictBool] = Field(default=None, description="Create a spot instance. Spot instances are created with a maximum bid price. If the bid price is not met, the spot instance will be terminated as indicated by the `termination_time` field.") + spot_price_max: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The maximum amount to bid for a spot instance.") + ssh_keys: Optional[List[SSHKeyInput]] = Field(default=None, description="A list of new or existing project ssh_keys that should be authorized to access this device (typically via /root/.ssh/authorized_keys). These keys will also appear in the device metadata. These keys are added in addition to any keys defined by `project_ssh_keys` and `user_ssh_keys`. ") storage: Optional[Storage] = None - tags: Optional[conlist(StrictStr)] = None - termination_time: Optional[datetime] = Field(None, description="When the device will be terminated. If you don't supply timezone info, the timestamp is assumed to be in UTC. This is commonly set in advance for ephemeral spot market instances but this field may also be set with on-demand and reservation instances to automatically delete the resource at a given time. The termination time can also be used to release a hardware reservation instance at a given time, keeping the reservation open for other uses. On a spot market device, the termination time will be set automatically when outbid. ") - user_ssh_keys: Optional[conlist(StrictStr)] = Field(None, description="A list of UUIDs identifying the users that should be authorized to access this device (typically via /root/.ssh/authorized_keys). These keys will also appear in the device metadata. The users must be members of the project or organization. If no SSH keys are specified (`user_ssh_keys`, `project_ssh_keys`, and `ssh_keys` are all empty lists or omitted), all parent project keys, parent project members keys and organization members keys will be included. This behaviour can be changed with 'no_ssh_keys' option to omit any SSH key being added. ") - userdata: Optional[StrictStr] = Field(None, description="The userdata presented in the metadata service for this device. Userdata is fetched and interpreted by the operating system installed on the device. Acceptable formats are determined by the operating system, with the exception of a special iPXE enabling syntax which is handled before the operating system starts. See [Server User Data](https://metal.equinix.com/developers/docs/servers/user-data/) and [Provisioning with Custom iPXE](https://metal.equinix.com/developers/docs/operating-systems/custom-ipxe/#provisioning-with-custom-ipxe) for more details.") - facility: FacilityInputFacility = Field(...) - __properties = ["hostnames", "quantity", "href", "metro", "always_pxe", "billing_cycle", "customdata", "description", "features", "hardware_reservation_id", "hostname", "ip_addresses", "ipxe_script_url", "locked", "network_frozen", "no_ssh_keys", "operating_system", "plan", "private_ipv4_subnet_size", "project_ssh_keys", "public_ipv4_subnet_size", "spot_instance", "spot_price_max", "ssh_keys", "storage", "tags", "termination_time", "user_ssh_keys", "userdata", "facility"] - - @validator('billing_cycle') + tags: Optional[List[StrictStr]] = None + termination_time: Optional[datetime] = Field(default=None, description="When the device will be terminated. If you don't supply timezone info, the timestamp is assumed to be in UTC. This is commonly set in advance for ephemeral spot market instances but this field may also be set with on-demand and reservation instances to automatically delete the resource at a given time. The termination time can also be used to release a hardware reservation instance at a given time, keeping the reservation open for other uses. On a spot market device, the termination time will be set automatically when outbid. ") + user_ssh_keys: Optional[List[StrictStr]] = Field(default=None, description="A list of UUIDs identifying the users that should be authorized to access this device (typically via /root/.ssh/authorized_keys). These keys will also appear in the device metadata. The users must be members of the project or organization. If no SSH keys are specified (`user_ssh_keys`, `project_ssh_keys`, and `ssh_keys` are all empty lists or omitted), all parent project keys, parent project members keys and organization members keys will be included. This behaviour can be changed with 'no_ssh_keys' option to omit any SSH key being added. ") + userdata: Optional[StrictStr] = Field(default=None, description="The userdata presented in the metadata service for this device. Userdata is fetched and interpreted by the operating system installed on the device. Acceptable formats are determined by the operating system, with the exception of a special iPXE enabling syntax which is handled before the operating system starts. See [Server User Data](https://metal.equinix.com/developers/docs/servers/user-data/) and [Provisioning with Custom iPXE](https://metal.equinix.com/developers/docs/operating-systems/custom-ipxe/#provisioning-with-custom-ipxe) for more details.") + facility: FacilityInputFacility + __properties: ClassVar[List[str]] = ["hostnames", "quantity", "href", "metro", "always_pxe", "billing_cycle", "customdata", "description", "features", "hardware_reservation_id", "hostname", "ip_addresses", "ipxe_script_url", "locked", "network_frozen", "no_ssh_keys", "operating_system", "plan", "private_ipv4_subnet_size", "project_ssh_keys", "public_ipv4_subnet_size", "spot_instance", "spot_price_max", "ssh_keys", "storage", "tags", "termination_time", "user_ssh_keys", "userdata", "facility"] + + @field_validator('billing_cycle') def billing_cycle_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('hourly', 'daily', 'monthly', 'yearly'): + if value not in set(['hourly', 'daily', 'monthly', 'yearly']): raise ValueError("must be one of enum values ('hourly', 'daily', 'monthly', 'yearly')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> InstancesBatchCreateInputBatchesInner: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of InstancesBatchCreateInputBatchesInner from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in ip_addresses (list) _items = [] if self.ip_addresses: @@ -119,15 +136,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> InstancesBatchCreateInputBatchesInner: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of InstancesBatchCreateInputBatchesInner from a dict""" if obj is None: return None if not isinstance(obj, dict): - return InstancesBatchCreateInputBatchesInner.parse_obj(obj) + return cls.model_validate(obj) - _obj = InstancesBatchCreateInputBatchesInner.parse_obj({ + _obj = cls.model_validate({ "hostnames": obj.get("hostnames"), "quantity": obj.get("quantity"), "href": obj.get("href"), @@ -139,7 +156,7 @@ def from_dict(cls, obj: dict) -> InstancesBatchCreateInputBatchesInner: "features": obj.get("features"), "hardware_reservation_id": obj.get("hardware_reservation_id"), "hostname": obj.get("hostname"), - "ip_addresses": [IPAddress.from_dict(_item) for _item in obj.get("ip_addresses")] if obj.get("ip_addresses") is not None else None, + "ip_addresses": [IPAddress.from_dict(_item) for _item in obj["ip_addresses"]] if obj.get("ip_addresses") is not None else None, "ipxe_script_url": obj.get("ipxe_script_url"), "locked": obj.get("locked") if obj.get("locked") is not None else False, "network_frozen": obj.get("network_frozen"), @@ -151,13 +168,13 @@ def from_dict(cls, obj: dict) -> InstancesBatchCreateInputBatchesInner: "public_ipv4_subnet_size": obj.get("public_ipv4_subnet_size") if obj.get("public_ipv4_subnet_size") is not None else 31, "spot_instance": obj.get("spot_instance"), "spot_price_max": obj.get("spot_price_max"), - "ssh_keys": [SSHKeyInput.from_dict(_item) for _item in obj.get("ssh_keys")] if obj.get("ssh_keys") is not None else None, - "storage": Storage.from_dict(obj.get("storage")) if obj.get("storage") is not None else None, + "ssh_keys": [SSHKeyInput.from_dict(_item) for _item in obj["ssh_keys"]] if obj.get("ssh_keys") is not None else None, + "storage": Storage.from_dict(obj["storage"]) if obj.get("storage") is not None else None, "tags": obj.get("tags"), "termination_time": obj.get("termination_time"), "user_ssh_keys": obj.get("user_ssh_keys"), "userdata": obj.get("userdata"), - "facility": FacilityInputFacility.from_dict(obj.get("facility")) if obj.get("facility") is not None else None + "facility": FacilityInputFacility.from_dict(obj["facility"]) if obj.get("facility") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/interconnection.py b/equinix_metal/equinix_metal/models/interconnection.py index df8e2278..f138e90c 100644 --- a/equinix_metal/equinix_metal/models/interconnection.py +++ b/equinix_metal/equinix_metal/models/interconnection.py @@ -19,94 +19,111 @@ import json from datetime import datetime -from typing import List, Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.fabric_service_token import FabricServiceToken from equinix_metal.models.href import Href from equinix_metal.models.interconnection_port import InterconnectionPort from equinix_metal.models.metro import Metro +from typing import Optional, Set +from typing_extensions import Self class Interconnection(BaseModel): """ Interconnection - """ - authorization_code: Optional[StrictStr] = Field(None, description="For Fabric VCs (Metal Billed), this allows Fabric to connect the Metal network to any connection Fabric facilitates. Fabric uses this token to be able to give more detailed information about the Metal end of the network, when viewing resources from within Fabric.") + """ # noqa: E501 + authorization_code: Optional[StrictStr] = Field(default=None, description="For Fabric VCs (Metal Billed), this allows Fabric to connect the Metal network to any connection Fabric facilitates. Fabric uses this token to be able to give more detailed information about the Metal end of the network, when viewing resources from within Fabric.") contact_email: Optional[StrictStr] = None created_at: Optional[datetime] = None description: Optional[StrictStr] = None facility: Optional[Href] = None href: Optional[StrictStr] = None id: Optional[StrictStr] = None - metro: Optional[Metro] = None - mode: Optional[StrictStr] = Field(None, description="The mode of the interconnection (only relevant to Dedicated Ports). Shared connections won't have this field. Can be either 'standard' or 'tunnel'. The default mode of an interconnection on a Dedicated Port is 'standard'. The mode can only be changed when there are no associated virtual circuits on the interconnection. In tunnel mode, an 802.1q tunnel is added to a port to send/receive double tagged packets from server instances.") + metro: Optional[Metro] = Field(default=None, description="The location of where the shared or Dedicated Port is located. For interconnections with Dedicated Ports, this will be the location of the Dedicated Ports. For Fabric VCs (Metal Billed), this is where interconnection will be originating from, as we pre-authorize the use of one of our shared ports as the origin of the interconnection using A-Side service tokens. We only allow local connections for Fabric VCs (Metal Billed), so the destination location must be the same as the origin. For Fabric VCs (Fabric Billed), this will be the destination of the interconnection. We allow remote connections for Fabric VCs (Fabric Billed), so the origin of the interconnection can be a different metro set here.") + mode: Optional[StrictStr] = Field(default=None, description="The mode of the interconnection (only relevant to Dedicated Ports). Shared connections won't have this field. Can be either 'standard' or 'tunnel'. The default mode of an interconnection on a Dedicated Port is 'standard'. The mode can only be changed when there are no associated virtual circuits on the interconnection. In tunnel mode, an 802.1q tunnel is added to a port to send/receive double tagged packets from server instances.") name: Optional[StrictStr] = None organization: Optional[Href] = None - ports: Optional[conlist(InterconnectionPort)] = Field(None, description="For Fabric VCs, these represent Virtual Port(s) created for the interconnection. For dedicated interconnections, these represent the Dedicated Port(s).") - redundancy: Optional[StrictStr] = Field(None, description="Either 'primary', meaning a single interconnection, or 'redundant', meaning a redundant interconnection.") + ports: Optional[List[InterconnectionPort]] = Field(default=None, description="For Fabric VCs, these represent Virtual Port(s) created for the interconnection. For dedicated interconnections, these represent the Dedicated Port(s).") + redundancy: Optional[StrictStr] = Field(default=None, description="Either 'primary', meaning a single interconnection, or 'redundant', meaning a redundant interconnection.") requested_by: Optional[Href] = None - service_tokens: Optional[conlist(FabricServiceToken)] = Field(None, description="For Fabric VCs (Metal Billed), this will show details of the A-Side service tokens issued for the interconnection. For Fabric VCs (Fabric Billed), this will show the details of the Z-Side service tokens issued for the interconnection. Dedicated interconnections will not have any service tokens issued. There will be one per interconnection, so for redundant interconnections, there should be two service tokens issued.") - speed: Optional[StrictInt] = Field(None, description="For interconnections on Dedicated Ports and shared connections, this represents the interconnection's speed in bps. For Fabric VCs, this field refers to the maximum speed of the interconnection in bps. This value will default to 10Gbps for Fabric VCs (Fabric Billed).") + service_tokens: Optional[List[FabricServiceToken]] = Field(default=None, description="For Fabric VCs (Metal Billed), this will show details of the A-Side service tokens issued for the interconnection. For Fabric VCs (Fabric Billed), this will show the details of the Z-Side service tokens issued for the interconnection. Dedicated interconnections will not have any service tokens issued. There will be one per interconnection, so for redundant interconnections, there should be two service tokens issued.") + speed: Optional[StrictInt] = Field(default=None, description="For interconnections on Dedicated Ports and shared connections, this represents the interconnection's speed in bps. For Fabric VCs, this field refers to the maximum speed of the interconnection in bps. This value will default to 10Gbps for Fabric VCs (Fabric Billed).") status: Optional[StrictStr] = None - tags: Optional[conlist(StrictStr)] = None - token: Optional[StrictStr] = Field(None, description="This token is used for shared interconnections to be used as the Fabric Token. This field is entirely deprecated.") - type: Optional[StrictStr] = Field(None, description="The 'shared' type of interconnection refers to shared connections, or later also known as Fabric Virtual Connections (or Fabric VCs). The 'dedicated' type of interconnection refers to interconnections created with Dedicated Ports. The 'shared_port_vlan' type of interconnection refers to shared connections created without service tokens. The 'shared_port_vlan_to_csp' type of interconnection refers to connections created directly to a supported cloud service provider.") + tags: Optional[List[StrictStr]] = None + token: Optional[StrictStr] = Field(default=None, description="This token is used for shared interconnections to be used as the Fabric Token. This field is entirely deprecated.") + type: Optional[StrictStr] = Field(default=None, description="The 'shared' type of interconnection refers to shared connections, or later also known as Fabric Virtual Connections (or Fabric VCs). The 'dedicated' type of interconnection refers to interconnections created with Dedicated Ports. The 'shared_port_vlan' type of interconnection refers to shared connections created without service tokens. The 'shared_port_vlan_to_csp' type of interconnection refers to connections created directly to a supported cloud service provider.") updated_at: Optional[datetime] = None - __properties = ["authorization_code", "contact_email", "created_at", "description", "facility", "href", "id", "metro", "mode", "name", "organization", "ports", "redundancy", "requested_by", "service_tokens", "speed", "status", "tags", "token", "type", "updated_at"] + __properties: ClassVar[List[str]] = ["authorization_code", "contact_email", "created_at", "description", "facility", "href", "id", "metro", "mode", "name", "organization", "ports", "redundancy", "requested_by", "service_tokens", "speed", "status", "tags", "token", "type", "updated_at"] - @validator('mode') + @field_validator('mode') def mode_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('standard', 'tunnel'): + if value not in set(['standard', 'tunnel']): raise ValueError("must be one of enum values ('standard', 'tunnel')") return value - @validator('redundancy') + @field_validator('redundancy') def redundancy_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('primary', 'redundant'): + if value not in set(['primary', 'redundant']): raise ValueError("must be one of enum values ('primary', 'redundant')") return value - @validator('type') + @field_validator('type') def type_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('shared', 'dedicated', 'shared_port_vlan', 'shared_port_vlan_to_csp'): + if value not in set(['shared', 'dedicated', 'shared_port_vlan', 'shared_port_vlan_to_csp']): raise ValueError("must be one of enum values ('shared', 'dedicated', 'shared_port_vlan', 'shared_port_vlan_to_csp')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> Interconnection: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Interconnection from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of facility if self.facility: _dict['facility'] = self.facility.to_dict() @@ -136,30 +153,30 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> Interconnection: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Interconnection from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Interconnection.parse_obj(obj) + return cls.model_validate(obj) - _obj = Interconnection.parse_obj({ + _obj = cls.model_validate({ "authorization_code": obj.get("authorization_code"), "contact_email": obj.get("contact_email"), "created_at": obj.get("created_at"), "description": obj.get("description"), - "facility": Href.from_dict(obj.get("facility")) if obj.get("facility") is not None else None, + "facility": Href.from_dict(obj["facility"]) if obj.get("facility") is not None else None, "href": obj.get("href"), "id": obj.get("id"), - "metro": Metro.from_dict(obj.get("metro")) if obj.get("metro") is not None else None, + "metro": Metro.from_dict(obj["metro"]) if obj.get("metro") is not None else None, "mode": obj.get("mode"), "name": obj.get("name"), - "organization": Href.from_dict(obj.get("organization")) if obj.get("organization") is not None else None, - "ports": [InterconnectionPort.from_dict(_item) for _item in obj.get("ports")] if obj.get("ports") is not None else None, + "organization": Href.from_dict(obj["organization"]) if obj.get("organization") is not None else None, + "ports": [InterconnectionPort.from_dict(_item) for _item in obj["ports"]] if obj.get("ports") is not None else None, "redundancy": obj.get("redundancy"), - "requested_by": Href.from_dict(obj.get("requested_by")) if obj.get("requested_by") is not None else None, - "service_tokens": [FabricServiceToken.from_dict(_item) for _item in obj.get("service_tokens")] if obj.get("service_tokens") is not None else None, + "requested_by": Href.from_dict(obj["requested_by"]) if obj.get("requested_by") is not None else None, + "service_tokens": [FabricServiceToken.from_dict(_item) for _item in obj["service_tokens"]] if obj.get("service_tokens") is not None else None, "speed": obj.get("speed"), "status": obj.get("status"), "tags": obj.get("tags"), diff --git a/equinix_metal/equinix_metal/models/interconnection_list.py b/equinix_metal/equinix_metal/models/interconnection_list.py index 4fa2bfaf..a7eaf059 100644 --- a/equinix_metal/equinix_metal/models/interconnection_list.py +++ b/equinix_metal/equinix_metal/models/interconnection_list.py @@ -18,45 +18,61 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.interconnection import Interconnection from equinix_metal.models.meta import Meta +from typing import Optional, Set +from typing_extensions import Self class InterconnectionList(BaseModel): """ InterconnectionList - """ + """ # noqa: E501 href: Optional[StrictStr] = None - interconnections: Optional[conlist(Interconnection)] = None + interconnections: Optional[List[Interconnection]] = None meta: Optional[Meta] = None - __properties = ["href", "interconnections", "meta"] + __properties: ClassVar[List[str]] = ["href", "interconnections", "meta"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> InterconnectionList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of InterconnectionList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in interconnections (list) _items = [] if self.interconnections: @@ -70,18 +86,18 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> InterconnectionList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of InterconnectionList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return InterconnectionList.parse_obj(obj) + return cls.model_validate(obj) - _obj = InterconnectionList.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "interconnections": [Interconnection.from_dict(_item) for _item in obj.get("interconnections")] if obj.get("interconnections") is not None else None, - "meta": Meta.from_dict(obj.get("meta")) if obj.get("meta") is not None else None + "interconnections": [Interconnection.from_dict(_item) for _item in obj["interconnections"]] if obj.get("interconnections") is not None else None, + "meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/interconnection_metro_list.py b/equinix_metal/equinix_metal/models/interconnection_metro_list.py index 4d974ec8..102992cd 100644 --- a/equinix_metal/equinix_metal/models/interconnection_metro_list.py +++ b/equinix_metal/equinix_metal/models/interconnection_metro_list.py @@ -18,45 +18,61 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.interconnection_metro_list_metros_inner import InterconnectionMetroListMetrosInner from equinix_metal.models.meta import Meta +from typing import Optional, Set +from typing_extensions import Self class InterconnectionMetroList(BaseModel): """ InterconnectionMetroList - """ + """ # noqa: E501 href: Optional[StrictStr] = None meta: Optional[Meta] = None - metros: Optional[conlist(InterconnectionMetroListMetrosInner)] = None - __properties = ["href", "meta", "metros"] + metros: Optional[List[InterconnectionMetroListMetrosInner]] = None + __properties: ClassVar[List[str]] = ["href", "meta", "metros"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> InterconnectionMetroList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of InterconnectionMetroList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of meta if self.meta: _dict['meta'] = self.meta.to_dict() @@ -70,18 +86,18 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> InterconnectionMetroList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of InterconnectionMetroList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return InterconnectionMetroList.parse_obj(obj) + return cls.model_validate(obj) - _obj = InterconnectionMetroList.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "meta": Meta.from_dict(obj.get("meta")) if obj.get("meta") is not None else None, - "metros": [InterconnectionMetroListMetrosInner.from_dict(_item) for _item in obj.get("metros")] if obj.get("metros") is not None else None + "meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None, + "metros": [InterconnectionMetroListMetrosInner.from_dict(_item) for _item in obj["metros"]] if obj.get("metros") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/interconnection_metro_list_metros_inner.py b/equinix_metal/equinix_metal/models/interconnection_metro_list_metros_inner.py index f666a949..27eb8e43 100644 --- a/equinix_metal/equinix_metal/models/interconnection_metro_list_metros_inner.py +++ b/equinix_metal/equinix_metal/models/interconnection_metro_list_metros_inner.py @@ -18,47 +18,63 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.interconnection_metro_list_metros_inner_all_of_providers_inner import InterconnectionMetroListMetrosInnerAllOfProvidersInner +from typing import Optional, Set +from typing_extensions import Self class InterconnectionMetroListMetrosInner(BaseModel): """ InterconnectionMetroListMetrosInner - """ + """ # noqa: E501 code: Optional[StrictStr] = None country: Optional[StrictStr] = None href: Optional[StrictStr] = None id: Optional[StrictStr] = None name: Optional[StrictStr] = None - providers: Optional[conlist(InterconnectionMetroListMetrosInnerAllOfProvidersInner)] = Field(None, description="A list of providers and their equivalent regions available for connecting to the provider network.") - __properties = ["code", "country", "href", "id", "name", "providers"] + providers: Optional[List[InterconnectionMetroListMetrosInnerAllOfProvidersInner]] = Field(default=None, description="A list of providers and their equivalent regions available for connecting to the provider network.") + __properties: ClassVar[List[str]] = ["code", "country", "href", "id", "name", "providers"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> InterconnectionMetroListMetrosInner: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of InterconnectionMetroListMetrosInner from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in providers (list) _items = [] if self.providers: @@ -69,21 +85,21 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> InterconnectionMetroListMetrosInner: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of InterconnectionMetroListMetrosInner from a dict""" if obj is None: return None if not isinstance(obj, dict): - return InterconnectionMetroListMetrosInner.parse_obj(obj) + return cls.model_validate(obj) - _obj = InterconnectionMetroListMetrosInner.parse_obj({ + _obj = cls.model_validate({ "code": obj.get("code"), "country": obj.get("country"), "href": obj.get("href"), "id": obj.get("id"), "name": obj.get("name"), - "providers": [InterconnectionMetroListMetrosInnerAllOfProvidersInner.from_dict(_item) for _item in obj.get("providers")] if obj.get("providers") is not None else None + "providers": [InterconnectionMetroListMetrosInnerAllOfProvidersInner.from_dict(_item) for _item in obj["providers"]] if obj.get("providers") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/interconnection_metro_list_metros_inner_all_of_providers_inner.py b/equinix_metal/equinix_metal/models/interconnection_metro_list_metros_inner_all_of_providers_inner.py index 7c940f3e..c5c4176f 100644 --- a/equinix_metal/equinix_metal/models/interconnection_metro_list_metros_inner_all_of_providers_inner.py +++ b/equinix_metal/equinix_metal/models/interconnection_metro_list_metros_inner_all_of_providers_inner.py @@ -18,56 +18,72 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class InterconnectionMetroListMetrosInnerAllOfProvidersInner(BaseModel): """ InterconnectionMetroListMetrosInnerAllOfProvidersInner - """ + """ # noqa: E501 href: Optional[StrictStr] = None - locations: Optional[conlist(StrictStr)] = None + locations: Optional[List[StrictStr]] = None name: Optional[StrictStr] = None type: Optional[StrictStr] = None - __properties = ["href", "locations", "name", "type"] + __properties: ClassVar[List[str]] = ["href", "locations", "name", "type"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> InterconnectionMetroListMetrosInnerAllOfProvidersInner: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of InterconnectionMetroListMetrosInnerAllOfProvidersInner from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> InterconnectionMetroListMetrosInnerAllOfProvidersInner: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of InterconnectionMetroListMetrosInnerAllOfProvidersInner from a dict""" if obj is None: return None if not isinstance(obj, dict): - return InterconnectionMetroListMetrosInnerAllOfProvidersInner.parse_obj(obj) + return cls.model_validate(obj) - _obj = InterconnectionMetroListMetrosInnerAllOfProvidersInner.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), "locations": obj.get("locations"), "name": obj.get("name"), diff --git a/equinix_metal/equinix_metal/models/interconnection_port.py b/equinix_metal/equinix_metal/models/interconnection_port.py index b6c9d0e7..a7f6b4bf 100644 --- a/equinix_metal/equinix_metal/models/interconnection_port.py +++ b/equinix_metal/equinix_metal/models/interconnection_port.py @@ -18,72 +18,88 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.href import Href from equinix_metal.models.virtual_circuit import VirtualCircuit +from typing import Optional, Set +from typing_extensions import Self class InterconnectionPort(BaseModel): """ InterconnectionPort - """ + """ # noqa: E501 href: Optional[StrictStr] = None id: Optional[StrictStr] = None link_status: Optional[StrictStr] = None name: Optional[StrictStr] = None organization: Optional[Href] = None - role: Optional[StrictStr] = Field(None, description="Either 'primary' or 'secondary'.") + role: Optional[StrictStr] = Field(default=None, description="Either 'primary' or 'secondary'.") speed: Optional[StrictInt] = None - status: Optional[StrictStr] = Field(None, description="For both Fabric VCs and Dedicated Ports, this will be 'requested' on creation and 'deleting' on deletion. Once the Fabric VC has found its corresponding Fabric connection, this will turn to 'active'. For Dedicated Ports, once the dedicated port is associated, this will also turn to 'active'. For Fabric VCs, this can turn into an 'expired' state if the service token associated is expired.") - switch_id: Optional[StrictStr] = Field(None, description="A switch 'short ID'") - virtual_circuits: Optional[conlist(VirtualCircuit)] = None - __properties = ["href", "id", "link_status", "name", "organization", "role", "speed", "status", "switch_id", "virtual_circuits"] + status: Optional[StrictStr] = Field(default=None, description="For both Fabric VCs and Dedicated Ports, this will be 'requested' on creation and 'deleting' on deletion. Once the Fabric VC has found its corresponding Fabric connection, this will turn to 'active'. For Dedicated Ports, once the dedicated port is associated, this will also turn to 'active'. For Fabric VCs, this can turn into an 'expired' state if the service token associated is expired.") + switch_id: Optional[StrictStr] = Field(default=None, description="A switch 'short ID'") + virtual_circuits: Optional[List[VirtualCircuit]] = None + __properties: ClassVar[List[str]] = ["href", "id", "link_status", "name", "organization", "role", "speed", "status", "switch_id", "virtual_circuits"] - @validator('role') + @field_validator('role') def role_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('primary', 'secondary'): + if value not in set(['primary', 'secondary']): raise ValueError("must be one of enum values ('primary', 'secondary')") return value - @validator('status') + @field_validator('status') def status_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('requested', 'active', 'deleting', 'expired', 'delete_failed'): + if value not in set(['requested', 'active', 'deleting', 'expired', 'delete_failed']): raise ValueError("must be one of enum values ('requested', 'active', 'deleting', 'expired', 'delete_failed')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> InterconnectionPort: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of InterconnectionPort from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of organization if self.organization: _dict['organization'] = self.organization.to_dict() @@ -97,25 +113,25 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> InterconnectionPort: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of InterconnectionPort from a dict""" if obj is None: return None if not isinstance(obj, dict): - return InterconnectionPort.parse_obj(obj) + return cls.model_validate(obj) - _obj = InterconnectionPort.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), "id": obj.get("id"), "link_status": obj.get("link_status"), "name": obj.get("name"), - "organization": Href.from_dict(obj.get("organization")) if obj.get("organization") is not None else None, + "organization": Href.from_dict(obj["organization"]) if obj.get("organization") is not None else None, "role": obj.get("role"), "speed": obj.get("speed"), "status": obj.get("status"), "switch_id": obj.get("switch_id"), - "virtual_circuits": [VirtualCircuit.from_dict(_item) for _item in obj.get("virtual_circuits")] if obj.get("virtual_circuits") is not None else None + "virtual_circuits": [VirtualCircuit.from_dict(_item) for _item in obj["virtual_circuits"]] if obj.get("virtual_circuits") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/interconnection_port_list.py b/equinix_metal/equinix_metal/models/interconnection_port_list.py index a0b1ee67..238dadf6 100644 --- a/equinix_metal/equinix_metal/models/interconnection_port_list.py +++ b/equinix_metal/equinix_metal/models/interconnection_port_list.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.interconnection_port import InterconnectionPort +from typing import Optional, Set +from typing_extensions import Self class InterconnectionPortList(BaseModel): """ InterconnectionPortList - """ + """ # noqa: E501 href: Optional[StrictStr] = None - ports: Optional[conlist(InterconnectionPort)] = None - __properties = ["href", "ports"] + ports: Optional[List[InterconnectionPort]] = None + __properties: ClassVar[List[str]] = ["href", "ports"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> InterconnectionPortList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of InterconnectionPortList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in ports (list) _items = [] if self.ports: @@ -65,17 +81,17 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> InterconnectionPortList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of InterconnectionPortList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return InterconnectionPortList.parse_obj(obj) + return cls.model_validate(obj) - _obj = InterconnectionPortList.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "ports": [InterconnectionPort.from_dict(_item) for _item in obj.get("ports")] if obj.get("ports") is not None else None + "ports": [InterconnectionPort.from_dict(_item) for _item in obj["ports"]] if obj.get("ports") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/interconnection_pricing_list.py b/equinix_metal/equinix_metal/models/interconnection_pricing_list.py index a60cc0da..d663426c 100644 --- a/equinix_metal/equinix_metal/models/interconnection_pricing_list.py +++ b/equinix_metal/equinix_metal/models/interconnection_pricing_list.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.interconnection_pricing_list_provider_pricing_inner import InterconnectionPricingListProviderPricingInner +from typing import Optional, Set +from typing_extensions import Self class InterconnectionPricingList(BaseModel): """ InterconnectionPricingList - """ + """ # noqa: E501 href: Optional[StrictStr] = None - provider_pricing: Optional[conlist(InterconnectionPricingListProviderPricingInner)] = Field(None, description="Pricing information per connection provider.") - __properties = ["href", "provider_pricing"] + provider_pricing: Optional[List[InterconnectionPricingListProviderPricingInner]] = Field(default=None, description="Pricing information per connection provider.") + __properties: ClassVar[List[str]] = ["href", "provider_pricing"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> InterconnectionPricingList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of InterconnectionPricingList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in provider_pricing (list) _items = [] if self.provider_pricing: @@ -65,17 +81,17 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> InterconnectionPricingList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of InterconnectionPricingList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return InterconnectionPricingList.parse_obj(obj) + return cls.model_validate(obj) - _obj = InterconnectionPricingList.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "provider_pricing": [InterconnectionPricingListProviderPricingInner.from_dict(_item) for _item in obj.get("provider_pricing")] if obj.get("provider_pricing") is not None else None + "provider_pricing": [InterconnectionPricingListProviderPricingInner.from_dict(_item) for _item in obj["provider_pricing"]] if obj.get("provider_pricing") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/interconnection_pricing_list_provider_pricing_inner.py b/equinix_metal/equinix_metal/models/interconnection_pricing_list_provider_pricing_inner.py index 5bc95c89..618d2bab 100644 --- a/equinix_metal/equinix_metal/models/interconnection_pricing_list_provider_pricing_inner.py +++ b/equinix_metal/equinix_metal/models/interconnection_pricing_list_provider_pricing_inner.py @@ -18,44 +18,60 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.interconnection_pricing_list_provider_pricing_inner_tiers_inner import InterconnectionPricingListProviderPricingInnerTiersInner +from typing import Optional, Set +from typing_extensions import Self class InterconnectionPricingListProviderPricingInner(BaseModel): """ InterconnectionPricingListProviderPricingInner - """ + """ # noqa: E501 href: Optional[StrictStr] = None provider: Optional[StrictStr] = None - tiers: Optional[conlist(InterconnectionPricingListProviderPricingInnerTiersInner)] = None - __properties = ["href", "provider", "tiers"] + tiers: Optional[List[InterconnectionPricingListProviderPricingInnerTiersInner]] = None + __properties: ClassVar[List[str]] = ["href", "provider", "tiers"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> InterconnectionPricingListProviderPricingInner: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of InterconnectionPricingListProviderPricingInner from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in tiers (list) _items = [] if self.tiers: @@ -66,18 +82,18 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> InterconnectionPricingListProviderPricingInner: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of InterconnectionPricingListProviderPricingInner from a dict""" if obj is None: return None if not isinstance(obj, dict): - return InterconnectionPricingListProviderPricingInner.parse_obj(obj) + return cls.model_validate(obj) - _obj = InterconnectionPricingListProviderPricingInner.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), "provider": obj.get("provider"), - "tiers": [InterconnectionPricingListProviderPricingInnerTiersInner.from_dict(_item) for _item in obj.get("tiers")] if obj.get("tiers") is not None else None + "tiers": [InterconnectionPricingListProviderPricingInnerTiersInner.from_dict(_item) for _item in obj["tiers"]] if obj.get("tiers") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/interconnection_pricing_list_provider_pricing_inner_tiers_inner.py b/equinix_metal/equinix_metal/models/interconnection_pricing_list_provider_pricing_inner_tiers_inner.py index 67118b31..716ab32d 100644 --- a/equinix_metal/equinix_metal/models/interconnection_pricing_list_provider_pricing_inner_tiers_inner.py +++ b/equinix_metal/equinix_metal/models/interconnection_pricing_list_provider_pricing_inner_tiers_inner.py @@ -18,56 +18,72 @@ import re # noqa: F401 import json - -from typing import Optional, Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self class InterconnectionPricingListProviderPricingInnerTiersInner(BaseModel): """ InterconnectionPricingListProviderPricingInnerTiersInner - """ - bandwidth: Optional[StrictInt] = Field(None, description="Bandwidth tier in Mbps") + """ # noqa: E501 + bandwidth: Optional[StrictInt] = Field(default=None, description="Bandwidth tier in Mbps") billing_cycle: Optional[StrictStr] = None href: Optional[StrictStr] = None price: Optional[Union[StrictFloat, StrictInt]] = None - __properties = ["bandwidth", "billing_cycle", "href", "price"] + __properties: ClassVar[List[str]] = ["bandwidth", "billing_cycle", "href", "price"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> InterconnectionPricingListProviderPricingInnerTiersInner: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of InterconnectionPricingListProviderPricingInnerTiersInner from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> InterconnectionPricingListProviderPricingInnerTiersInner: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of InterconnectionPricingListProviderPricingInnerTiersInner from a dict""" if obj is None: return None if not isinstance(obj, dict): - return InterconnectionPricingListProviderPricingInnerTiersInner.parse_obj(obj) + return cls.model_validate(obj) - _obj = InterconnectionPricingListProviderPricingInnerTiersInner.parse_obj({ + _obj = cls.model_validate({ "bandwidth": obj.get("bandwidth"), "billing_cycle": obj.get("billing_cycle"), "href": obj.get("href"), diff --git a/equinix_metal/equinix_metal/models/interconnection_update_input.py b/equinix_metal/equinix_metal/models/interconnection_update_input.py index 7d60f119..c301d556 100644 --- a/equinix_metal/equinix_metal/models/interconnection_update_input.py +++ b/equinix_metal/equinix_metal/models/interconnection_update_input.py @@ -18,68 +18,84 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class InterconnectionUpdateInput(BaseModel): """ InterconnectionUpdateInput - """ + """ # noqa: E501 contact_email: Optional[StrictStr] = None description: Optional[StrictStr] = None href: Optional[StrictStr] = None - mode: Optional[StrictStr] = Field(None, description="The mode of the interconnection (only relevant to Dedicated Ports). Shared connections won't have this field. Can be either 'standard' or 'tunnel'. The default mode of an interconnection on a Dedicated Port is 'standard'. The mode can only be changed when there are no associated virtual circuits on the interconnection. In tunnel mode, an 802.1q tunnel is added to a port to send/receive double tagged packets from server instances.") + mode: Optional[StrictStr] = Field(default=None, description="The mode of the interconnection (only relevant to Dedicated Ports). Shared connections won't have this field. Can be either 'standard' or 'tunnel'. The default mode of an interconnection on a Dedicated Port is 'standard'. The mode can only be changed when there are no associated virtual circuits on the interconnection. In tunnel mode, an 802.1q tunnel is added to a port to send/receive double tagged packets from server instances.") name: Optional[StrictStr] = None - tags: Optional[conlist(StrictStr)] = None - __properties = ["contact_email", "description", "href", "mode", "name", "tags"] + tags: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["contact_email", "description", "href", "mode", "name", "tags"] - @validator('mode') + @field_validator('mode') def mode_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('standard', 'tunnel'): + if value not in set(['standard', 'tunnel']): raise ValueError("must be one of enum values ('standard', 'tunnel')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> InterconnectionUpdateInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of InterconnectionUpdateInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> InterconnectionUpdateInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of InterconnectionUpdateInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return InterconnectionUpdateInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = InterconnectionUpdateInput.parse_obj({ + _obj = cls.model_validate({ "contact_email": obj.get("contact_email"), "description": obj.get("description"), "href": obj.get("href"), diff --git a/equinix_metal/equinix_metal/models/invitation.py b/equinix_metal/equinix_metal/models/invitation.py index 556b2517..f7f56349 100644 --- a/equinix_metal/equinix_metal/models/invitation.py +++ b/equinix_metal/equinix_metal/models/invitation.py @@ -19,14 +19,16 @@ import json from datetime import datetime -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.href import Href +from typing import Optional, Set +from typing_extensions import Self class Invitation(BaseModel): """ Invitation - """ + """ # noqa: E501 created_at: Optional[datetime] = None href: Optional[StrictStr] = None id: Optional[StrictStr] = None @@ -35,46 +37,61 @@ class Invitation(BaseModel): invitee: Optional[StrictStr] = None nonce: Optional[StrictStr] = None organization: Optional[Href] = None - projects: Optional[conlist(Href)] = None - roles: Optional[conlist(StrictStr)] = None + projects: Optional[List[Href]] = None + roles: Optional[List[StrictStr]] = None updated_at: Optional[datetime] = None - __properties = ["created_at", "href", "id", "invitation", "invited_by", "invitee", "nonce", "organization", "projects", "roles", "updated_at"] + __properties: ClassVar[List[str]] = ["created_at", "href", "id", "invitation", "invited_by", "invitee", "nonce", "organization", "projects", "roles", "updated_at"] - @validator('roles') + @field_validator('roles') def roles_validate_enum(cls, value): """Validates the enum""" if value is None: return value for i in value: - if i not in ('admin', 'billing', 'collaborator', 'limited_collaborator'): + if i not in set(['admin', 'billing', 'collaborator', 'limited_collaborator']): raise ValueError("each list item must be one of ('admin', 'billing', 'collaborator', 'limited_collaborator')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> Invitation: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Invitation from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of invitation if self.invitation: _dict['invitation'] = self.invitation.to_dict() @@ -94,24 +111,24 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> Invitation: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Invitation from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Invitation.parse_obj(obj) + return cls.model_validate(obj) - _obj = Invitation.parse_obj({ + _obj = cls.model_validate({ "created_at": obj.get("created_at"), "href": obj.get("href"), "id": obj.get("id"), - "invitation": Href.from_dict(obj.get("invitation")) if obj.get("invitation") is not None else None, - "invited_by": Href.from_dict(obj.get("invited_by")) if obj.get("invited_by") is not None else None, + "invitation": Href.from_dict(obj["invitation"]) if obj.get("invitation") is not None else None, + "invited_by": Href.from_dict(obj["invited_by"]) if obj.get("invited_by") is not None else None, "invitee": obj.get("invitee"), "nonce": obj.get("nonce"), - "organization": Href.from_dict(obj.get("organization")) if obj.get("organization") is not None else None, - "projects": [Href.from_dict(_item) for _item in obj.get("projects")] if obj.get("projects") is not None else None, + "organization": Href.from_dict(obj["organization"]) if obj.get("organization") is not None else None, + "projects": [Href.from_dict(_item) for _item in obj["projects"]] if obj.get("projects") is not None else None, "roles": obj.get("roles"), "updated_at": obj.get("updated_at") }) diff --git a/equinix_metal/equinix_metal/models/invitation_input.py b/equinix_metal/equinix_metal/models/invitation_input.py index d4816600..9ff4f323 100644 --- a/equinix_metal/equinix_metal/models/invitation_input.py +++ b/equinix_metal/equinix_metal/models/invitation_input.py @@ -18,69 +18,85 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class InvitationInput(BaseModel): """ InvitationInput - """ + """ # noqa: E501 href: Optional[StrictStr] = None - invitee: StrictStr = Field(...) + invitee: StrictStr message: Optional[StrictStr] = None organization_id: Optional[StrictStr] = None - projects_ids: Optional[conlist(StrictStr)] = None - roles: Optional[conlist(StrictStr)] = None - __properties = ["href", "invitee", "message", "organization_id", "projects_ids", "roles"] + projects_ids: Optional[List[StrictStr]] = None + roles: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["href", "invitee", "message", "organization_id", "projects_ids", "roles"] - @validator('roles') + @field_validator('roles') def roles_validate_enum(cls, value): """Validates the enum""" if value is None: return value for i in value: - if i not in ('admin', 'billing', 'collaborator', 'limited_collaborator'): + if i not in set(['admin', 'billing', 'collaborator', 'limited_collaborator']): raise ValueError("each list item must be one of ('admin', 'billing', 'collaborator', 'limited_collaborator')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> InvitationInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of InvitationInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> InvitationInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of InvitationInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return InvitationInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = InvitationInput.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), "invitee": obj.get("invitee"), "message": obj.get("message"), diff --git a/equinix_metal/equinix_metal/models/invitation_list.py b/equinix_metal/equinix_metal/models/invitation_list.py index 1a73d9a4..488e3538 100644 --- a/equinix_metal/equinix_metal/models/invitation_list.py +++ b/equinix_metal/equinix_metal/models/invitation_list.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.membership import Membership +from typing import Optional, Set +from typing_extensions import Self class InvitationList(BaseModel): """ InvitationList - """ + """ # noqa: E501 href: Optional[StrictStr] = None - invitations: Optional[conlist(Membership)] = None - __properties = ["href", "invitations"] + invitations: Optional[List[Membership]] = None + __properties: ClassVar[List[str]] = ["href", "invitations"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> InvitationList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of InvitationList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in invitations (list) _items = [] if self.invitations: @@ -65,17 +81,17 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> InvitationList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of InvitationList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return InvitationList.parse_obj(obj) + return cls.model_validate(obj) - _obj = InvitationList.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "invitations": [Membership.from_dict(_item) for _item in obj.get("invitations")] if obj.get("invitations") is not None else None + "invitations": [Membership.from_dict(_item) for _item in obj["invitations"]] if obj.get("invitations") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/invoice.py b/equinix_metal/equinix_metal/models/invoice.py index 84056a4c..c7bb5b5b 100644 --- a/equinix_metal/equinix_metal/models/invoice.py +++ b/equinix_metal/equinix_metal/models/invoice.py @@ -19,15 +19,17 @@ import json from datetime import date -from typing import List, Optional, Union -from pydantic import BaseModel, StrictFloat, StrictInt, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union from equinix_metal.models.line_item import LineItem from equinix_metal.models.project_id_name import ProjectIdName +from typing import Optional, Set +from typing_extensions import Self class Invoice(BaseModel): """ Invoice - """ + """ # noqa: E501 amount: Optional[Union[StrictFloat, StrictInt]] = None balance: Optional[Union[StrictFloat, StrictInt]] = None created_on: Optional[date] = None @@ -37,38 +39,53 @@ class Invoice(BaseModel): due_on: Optional[date] = None href: Optional[StrictStr] = None id: Optional[StrictStr] = None - items: Optional[conlist(LineItem)] = None + items: Optional[List[LineItem]] = None number: Optional[StrictStr] = None project: Optional[ProjectIdName] = None reference_number: Optional[StrictStr] = None status: Optional[StrictStr] = None target_date: Optional[date] = None - __properties = ["amount", "balance", "created_on", "credit_amount", "credits_applied", "currency", "due_on", "href", "id", "items", "number", "project", "reference_number", "status", "target_date"] + __properties: ClassVar[List[str]] = ["amount", "balance", "created_on", "credit_amount", "credits_applied", "currency", "due_on", "href", "id", "items", "number", "project", "reference_number", "status", "target_date"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> Invoice: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Invoice from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in items (list) _items = [] if self.items: @@ -82,15 +99,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> Invoice: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Invoice from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Invoice.parse_obj(obj) + return cls.model_validate(obj) - _obj = Invoice.parse_obj({ + _obj = cls.model_validate({ "amount": obj.get("amount"), "balance": obj.get("balance"), "created_on": obj.get("created_on"), @@ -100,9 +117,9 @@ def from_dict(cls, obj: dict) -> Invoice: "due_on": obj.get("due_on"), "href": obj.get("href"), "id": obj.get("id"), - "items": [LineItem.from_dict(_item) for _item in obj.get("items")] if obj.get("items") is not None else None, + "items": [LineItem.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None, "number": obj.get("number"), - "project": ProjectIdName.from_dict(obj.get("project")) if obj.get("project") is not None else None, + "project": ProjectIdName.from_dict(obj["project"]) if obj.get("project") is not None else None, "reference_number": obj.get("reference_number"), "status": obj.get("status"), "target_date": obj.get("target_date") diff --git a/equinix_metal/equinix_metal/models/invoice_list.py b/equinix_metal/equinix_metal/models/invoice_list.py index e2561596..bded7b38 100644 --- a/equinix_metal/equinix_metal/models/invoice_list.py +++ b/equinix_metal/equinix_metal/models/invoice_list.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.invoice import Invoice +from typing import Optional, Set +from typing_extensions import Self class InvoiceList(BaseModel): """ InvoiceList - """ + """ # noqa: E501 href: Optional[StrictStr] = None - invoices: Optional[conlist(Invoice)] = None - __properties = ["href", "invoices"] + invoices: Optional[List[Invoice]] = None + __properties: ClassVar[List[str]] = ["href", "invoices"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> InvoiceList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of InvoiceList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in invoices (list) _items = [] if self.invoices: @@ -65,17 +81,17 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> InvoiceList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of InvoiceList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return InvoiceList.parse_obj(obj) + return cls.model_validate(obj) - _obj = InvoiceList.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "invoices": [Invoice.from_dict(_item) for _item in obj.get("invoices")] if obj.get("invoices") is not None else None + "invoices": [Invoice.from_dict(_item) for _item in obj["invoices"]] if obj.get("invoices") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/ip_address.py b/equinix_metal/equinix_metal/models/ip_address.py index e40a5869..76dd29ff 100644 --- a/equinix_metal/equinix_metal/models/ip_address.py +++ b/equinix_metal/equinix_metal/models/ip_address.py @@ -18,67 +18,83 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class IPAddress(BaseModel): """ IPAddress - """ - address_family: Optional[StrictInt] = Field(None, description="Address Family for IP Address") - cidr: Optional[StrictInt] = Field(None, description="Cidr Size for the IP Block created. Valid values depends on the operating system being provisioned. (28..32 for IPv4 addresses, 124..127 for IPv6 addresses)") + """ # noqa: E501 + address_family: Optional[StrictInt] = Field(default=None, description="Address Family for IP Address") + cidr: Optional[StrictInt] = Field(default=None, description="Cidr Size for the IP Block created. Valid values depends on the operating system being provisioned. (28..32 for IPv4 addresses, 124..127 for IPv6 addresses)") href: Optional[StrictStr] = None - ip_reservations: Optional[conlist(StrictStr)] = Field(None, description="UUIDs of any IP reservations to use when assigning IPs") - public: Optional[StrictBool] = Field(True, description="Address Type for IP Address") - __properties = ["address_family", "cidr", "href", "ip_reservations", "public"] + ip_reservations: Optional[List[StrictStr]] = Field(default=None, description="UUIDs of any IP reservations to use when assigning IPs") + public: Optional[StrictBool] = Field(default=True, description="Address Type for IP Address") + __properties: ClassVar[List[str]] = ["address_family", "cidr", "href", "ip_reservations", "public"] - @validator('address_family') + @field_validator('address_family') def address_family_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in (4, 6): + if value not in set([4, 6]): raise ValueError("must be one of enum values (4, 6)") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> IPAddress: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of IPAddress from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> IPAddress: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of IPAddress from a dict""" if obj is None: return None if not isinstance(obj, dict): - return IPAddress.parse_obj(obj) + return cls.model_validate(obj) - _obj = IPAddress.parse_obj({ + _obj = cls.model_validate({ "address_family": obj.get("address_family"), "cidr": obj.get("cidr"), "href": obj.get("href"), diff --git a/equinix_metal/equinix_metal/models/ip_assignment.py b/equinix_metal/equinix_metal/models/ip_assignment.py index 42a096ec..6c9e29b2 100644 --- a/equinix_metal/equinix_metal/models/ip_assignment.py +++ b/equinix_metal/equinix_metal/models/ip_assignment.py @@ -19,19 +19,21 @@ import json from datetime import datetime -from typing import Optional -from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr, validator +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.href import Href from equinix_metal.models.ip_assignment_metro import IPAssignmentMetro from equinix_metal.models.parent_block import ParentBlock +from typing import Optional, Set +from typing_extensions import Self class IPAssignment(BaseModel): """ IPAssignment - """ + """ # noqa: E501 address: Optional[StrictStr] = None address_family: Optional[StrictInt] = None - assigned_to: Href = Field(...) + assigned_to: Href cidr: Optional[StrictInt] = None created_at: Optional[datetime] = None enabled: Optional[StrictBool] = None @@ -44,46 +46,61 @@ class IPAssignment(BaseModel): metro: Optional[IPAssignmentMetro] = None netmask: Optional[StrictStr] = None network: Optional[StrictStr] = None - next_hop: Optional[StrictStr] = Field(None, description="Only set when this is a Metal Gateway Elastic IP Assignment. The IP address within the Metal Gateway to which requests to the Elastic IP are forwarded. ") + next_hop: Optional[StrictStr] = Field(default=None, description="Only set when this is a Metal Gateway Elastic IP Assignment. The IP address within the Metal Gateway to which requests to the Elastic IP are forwarded. ") parent_block: Optional[ParentBlock] = None public: Optional[StrictBool] = None - state: Optional[StrictStr] = Field(None, description="Only set when this is a Metal Gateway Elastic IP Assignment. Describes the current configuration state of this IP on the network. ") - __properties = ["address", "address_family", "assigned_to", "cidr", "created_at", "enabled", "gateway", "global_ip", "href", "id", "manageable", "management", "metro", "netmask", "network", "next_hop", "parent_block", "public", "state"] + state: Optional[StrictStr] = Field(default=None, description="Only set when this is a Metal Gateway Elastic IP Assignment. Describes the current configuration state of this IP on the network. ") + __properties: ClassVar[List[str]] = ["address", "address_family", "assigned_to", "cidr", "created_at", "enabled", "gateway", "global_ip", "href", "id", "manageable", "management", "metro", "netmask", "network", "next_hop", "parent_block", "public", "state"] - @validator('state') + @field_validator('state') def state_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('pending', 'active', 'deleting'): + if value not in set(['pending', 'active', 'deleting']): raise ValueError("must be one of enum values ('pending', 'active', 'deleting')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> IPAssignment: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of IPAssignment from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of assigned_to if self.assigned_to: _dict['assigned_to'] = self.assigned_to.to_dict() @@ -96,18 +113,18 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> IPAssignment: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of IPAssignment from a dict""" if obj is None: return None if not isinstance(obj, dict): - return IPAssignment.parse_obj(obj) + return cls.model_validate(obj) - _obj = IPAssignment.parse_obj({ + _obj = cls.model_validate({ "address": obj.get("address"), "address_family": obj.get("address_family"), - "assigned_to": Href.from_dict(obj.get("assigned_to")) if obj.get("assigned_to") is not None else None, + "assigned_to": Href.from_dict(obj["assigned_to"]) if obj.get("assigned_to") is not None else None, "cidr": obj.get("cidr"), "created_at": obj.get("created_at"), "enabled": obj.get("enabled"), @@ -117,11 +134,11 @@ def from_dict(cls, obj: dict) -> IPAssignment: "id": obj.get("id"), "manageable": obj.get("manageable"), "management": obj.get("management"), - "metro": IPAssignmentMetro.from_dict(obj.get("metro")) if obj.get("metro") is not None else None, + "metro": IPAssignmentMetro.from_dict(obj["metro"]) if obj.get("metro") is not None else None, "netmask": obj.get("netmask"), "network": obj.get("network"), "next_hop": obj.get("next_hop"), - "parent_block": ParentBlock.from_dict(obj.get("parent_block")) if obj.get("parent_block") is not None else None, + "parent_block": ParentBlock.from_dict(obj["parent_block"]) if obj.get("parent_block") is not None else None, "public": obj.get("public"), "state": obj.get("state") }) diff --git a/equinix_metal/equinix_metal/models/ip_assignment_input.py b/equinix_metal/equinix_metal/models/ip_assignment_input.py index 2ac83f87..68b698b4 100644 --- a/equinix_metal/equinix_metal/models/ip_assignment_input.py +++ b/equinix_metal/equinix_metal/models/ip_assignment_input.py @@ -18,55 +18,71 @@ import re # noqa: F401 import json - -from typing import Any, Dict, Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class IPAssignmentInput(BaseModel): """ IPAssignmentInput - """ - address: StrictStr = Field(...) + """ # noqa: E501 + address: StrictStr customdata: Optional[Dict[str, Any]] = None href: Optional[StrictStr] = None - __properties = ["address", "customdata", "href"] + __properties: ClassVar[List[str]] = ["address", "customdata", "href"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> IPAssignmentInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of IPAssignmentInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> IPAssignmentInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of IPAssignmentInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return IPAssignmentInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = IPAssignmentInput.parse_obj({ + _obj = cls.model_validate({ "address": obj.get("address"), "customdata": obj.get("customdata"), "href": obj.get("href") diff --git a/equinix_metal/equinix_metal/models/ip_assignment_list.py b/equinix_metal/equinix_metal/models/ip_assignment_list.py index 91ba5d9c..f50290ca 100644 --- a/equinix_metal/equinix_metal/models/ip_assignment_list.py +++ b/equinix_metal/equinix_metal/models/ip_assignment_list.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.ip_assignment import IPAssignment +from typing import Optional, Set +from typing_extensions import Self class IPAssignmentList(BaseModel): """ IPAssignmentList - """ + """ # noqa: E501 href: Optional[StrictStr] = None - ip_addresses: Optional[conlist(IPAssignment)] = None - __properties = ["href", "ip_addresses"] + ip_addresses: Optional[List[IPAssignment]] = None + __properties: ClassVar[List[str]] = ["href", "ip_addresses"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> IPAssignmentList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of IPAssignmentList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in ip_addresses (list) _items = [] if self.ip_addresses: @@ -65,17 +81,17 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> IPAssignmentList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of IPAssignmentList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return IPAssignmentList.parse_obj(obj) + return cls.model_validate(obj) - _obj = IPAssignmentList.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "ip_addresses": [IPAssignment.from_dict(_item) for _item in obj.get("ip_addresses")] if obj.get("ip_addresses") is not None else None + "ip_addresses": [IPAssignment.from_dict(_item) for _item in obj["ip_addresses"]] if obj.get("ip_addresses") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/ip_assignment_metro.py b/equinix_metal/equinix_metal/models/ip_assignment_metro.py index d3bea68e..5e6139fd 100644 --- a/equinix_metal/equinix_metal/models/ip_assignment_metro.py +++ b/equinix_metal/equinix_metal/models/ip_assignment_metro.py @@ -18,57 +18,73 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class IPAssignmentMetro(BaseModel): """ IPAssignmentMetro - """ + """ # noqa: E501 code: Optional[StrictStr] = None country: Optional[StrictStr] = None href: Optional[StrictStr] = None id: Optional[StrictStr] = None name: Optional[StrictStr] = None - __properties = ["code", "country", "href", "id", "name"] + __properties: ClassVar[List[str]] = ["code", "country", "href", "id", "name"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> IPAssignmentMetro: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of IPAssignmentMetro from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> IPAssignmentMetro: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of IPAssignmentMetro from a dict""" if obj is None: return None if not isinstance(obj, dict): - return IPAssignmentMetro.parse_obj(obj) + return cls.model_validate(obj) - _obj = IPAssignmentMetro.parse_obj({ + _obj = cls.model_validate({ "code": obj.get("code"), "country": obj.get("country"), "href": obj.get("href"), diff --git a/equinix_metal/equinix_metal/models/ip_assignment_update_input.py b/equinix_metal/equinix_metal/models/ip_assignment_update_input.py index 92ddcf84..d227ba21 100644 --- a/equinix_metal/equinix_metal/models/ip_assignment_update_input.py +++ b/equinix_metal/equinix_metal/models/ip_assignment_update_input.py @@ -18,56 +18,72 @@ import re # noqa: F401 import json - -from typing import Any, Dict, List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class IPAssignmentUpdateInput(BaseModel): """ IPAssignmentUpdateInput - """ + """ # noqa: E501 customdata: Optional[Dict[str, Any]] = None details: Optional[StrictStr] = None href: Optional[StrictStr] = None - tags: Optional[conlist(StrictStr)] = None - __properties = ["customdata", "details", "href", "tags"] + tags: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["customdata", "details", "href", "tags"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> IPAssignmentUpdateInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of IPAssignmentUpdateInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> IPAssignmentUpdateInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of IPAssignmentUpdateInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return IPAssignmentUpdateInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = IPAssignmentUpdateInput.parse_obj({ + _obj = cls.model_validate({ "customdata": obj.get("customdata"), "details": obj.get("details"), "href": obj.get("href"), diff --git a/equinix_metal/equinix_metal/models/ip_availabilities_list.py b/equinix_metal/equinix_metal/models/ip_availabilities_list.py index 3c7ae5bd..21f5aae2 100644 --- a/equinix_metal/equinix_metal/models/ip_availabilities_list.py +++ b/equinix_metal/equinix_metal/models/ip_availabilities_list.py @@ -18,54 +18,70 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class IPAvailabilitiesList(BaseModel): """ IPAvailabilitiesList - """ - available: Optional[conlist(StrictStr)] = None + """ # noqa: E501 + available: Optional[List[StrictStr]] = None href: Optional[StrictStr] = None - __properties = ["available", "href"] + __properties: ClassVar[List[str]] = ["available", "href"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> IPAvailabilitiesList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of IPAvailabilitiesList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> IPAvailabilitiesList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of IPAvailabilitiesList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return IPAvailabilitiesList.parse_obj(obj) + return cls.model_validate(obj) - _obj = IPAvailabilitiesList.parse_obj({ + _obj = cls.model_validate({ "available": obj.get("available"), "href": obj.get("href") }) diff --git a/equinix_metal/equinix_metal/models/ip_reservation.py b/equinix_metal/equinix_metal/models/ip_reservation.py index 9017fb89..1e796f52 100644 --- a/equinix_metal/equinix_metal/models/ip_reservation.py +++ b/equinix_metal/equinix_metal/models/ip_reservation.py @@ -19,22 +19,24 @@ import json from datetime import datetime -from typing import Any, Dict, List, Optional -from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.href import Href from equinix_metal.models.ip_reservation_facility import IPReservationFacility from equinix_metal.models.ip_reservation_metro import IPReservationMetro from equinix_metal.models.metal_gateway_lite import MetalGatewayLite from equinix_metal.models.project import Project +from typing import Optional, Set +from typing_extensions import Self class IPReservation(BaseModel): """ IPReservation - """ + """ # noqa: E501 addon: Optional[StrictBool] = None address: Optional[StrictStr] = None address_family: Optional[StrictInt] = None - assignments: Optional[conlist(Href)] = None + assignments: Optional[List[Href]] = None available: Optional[StrictStr] = None bill: Optional[StrictBool] = None cidr: Optional[StrictInt] = None @@ -58,41 +60,56 @@ class IPReservation(BaseModel): public: Optional[StrictBool] = None requested_by: Optional[Href] = None state: Optional[StrictStr] = None - tags: Optional[conlist(StrictStr)] = None - type: StrictStr = Field(...) - __properties = ["addon", "address", "address_family", "assignments", "available", "bill", "cidr", "created_at", "customdata", "details", "enabled", "facility", "gateway", "global_ip", "href", "id", "manageable", "management", "metal_gateway", "metro", "netmask", "network", "project", "project_lite", "public", "requested_by", "state", "tags", "type"] + tags: Optional[List[StrictStr]] = None + type: StrictStr + __properties: ClassVar[List[str]] = ["addon", "address", "address_family", "assignments", "available", "bill", "cidr", "created_at", "customdata", "details", "enabled", "facility", "gateway", "global_ip", "href", "id", "manageable", "management", "metal_gateway", "metro", "netmask", "network", "project", "project_lite", "public", "requested_by", "state", "tags", "type"] - @validator('type') + @field_validator('type') def type_validate_enum(cls, value): """Validates the enum""" - if value not in ('global_ipv4', 'public_ipv4', 'private_ipv4', 'public_ipv6', 'vrf'): - raise ValueError("must be one of enum values ('global_ipv4', 'public_ipv4', 'private_ipv4', 'public_ipv6', 'vrf')") + if value not in set(['global_ipv4', 'public_ipv4', 'private_ipv4', 'public_ipv6']): + raise ValueError("must be one of enum values ('global_ipv4', 'public_ipv4', 'private_ipv4', 'public_ipv6')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> IPReservation: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of IPReservation from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in assignments (list) _items = [] if self.assignments: @@ -121,19 +138,19 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> IPReservation: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of IPReservation from a dict""" if obj is None: return None if not isinstance(obj, dict): - return IPReservation.parse_obj(obj) + return cls.model_validate(obj) - _obj = IPReservation.parse_obj({ + _obj = cls.model_validate({ "addon": obj.get("addon"), "address": obj.get("address"), "address_family": obj.get("address_family"), - "assignments": [Href.from_dict(_item) for _item in obj.get("assignments")] if obj.get("assignments") is not None else None, + "assignments": [Href.from_dict(_item) for _item in obj["assignments"]] if obj.get("assignments") is not None else None, "available": obj.get("available"), "bill": obj.get("bill"), "cidr": obj.get("cidr"), @@ -141,21 +158,21 @@ def from_dict(cls, obj: dict) -> IPReservation: "customdata": obj.get("customdata"), "details": obj.get("details"), "enabled": obj.get("enabled"), - "facility": IPReservationFacility.from_dict(obj.get("facility")) if obj.get("facility") is not None else None, + "facility": IPReservationFacility.from_dict(obj["facility"]) if obj.get("facility") is not None else None, "gateway": obj.get("gateway"), "global_ip": obj.get("global_ip"), "href": obj.get("href"), "id": obj.get("id"), "manageable": obj.get("manageable"), "management": obj.get("management"), - "metal_gateway": MetalGatewayLite.from_dict(obj.get("metal_gateway")) if obj.get("metal_gateway") is not None else None, - "metro": IPReservationMetro.from_dict(obj.get("metro")) if obj.get("metro") is not None else None, + "metal_gateway": MetalGatewayLite.from_dict(obj["metal_gateway"]) if obj.get("metal_gateway") is not None else None, + "metro": IPReservationMetro.from_dict(obj["metro"]) if obj.get("metro") is not None else None, "netmask": obj.get("netmask"), "network": obj.get("network"), - "project": Project.from_dict(obj.get("project")) if obj.get("project") is not None else None, - "project_lite": Href.from_dict(obj.get("project_lite")) if obj.get("project_lite") is not None else None, + "project": Project.from_dict(obj["project"]) if obj.get("project") is not None else None, + "project_lite": Href.from_dict(obj["project_lite"]) if obj.get("project_lite") is not None else None, "public": obj.get("public"), - "requested_by": Href.from_dict(obj.get("requested_by")) if obj.get("requested_by") is not None else None, + "requested_by": Href.from_dict(obj["requested_by"]) if obj.get("requested_by") is not None else None, "state": obj.get("state"), "tags": obj.get("tags"), "type": obj.get("type") diff --git a/equinix_metal/equinix_metal/models/ip_reservation_facility.py b/equinix_metal/equinix_metal/models/ip_reservation_facility.py index 1822ae3d..d4f4c092 100644 --- a/equinix_metal/equinix_metal/models/ip_reservation_facility.py +++ b/equinix_metal/equinix_metal/models/ip_reservation_facility.py @@ -18,61 +18,77 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.address import Address from equinix_metal.models.device_metro import DeviceMetro +from typing import Optional, Set +from typing_extensions import Self class IPReservationFacility(BaseModel): """ IPReservationFacility - """ + """ # noqa: E501 address: Optional[Address] = None code: Optional[StrictStr] = None - features: Optional[conlist(StrictStr)] = None + features: Optional[List[StrictStr]] = None href: Optional[StrictStr] = None id: Optional[StrictStr] = None - ip_ranges: Optional[conlist(StrictStr)] = Field(None, description="IP ranges registered in facility. Can be used for GeoIP location") + ip_ranges: Optional[List[StrictStr]] = Field(default=None, description="IP ranges registered in facility. Can be used for GeoIP location") metro: Optional[DeviceMetro] = None name: Optional[StrictStr] = None - __properties = ["address", "code", "features", "href", "id", "ip_ranges", "metro", "name"] + __properties: ClassVar[List[str]] = ["address", "code", "features", "href", "id", "ip_ranges", "metro", "name"] - @validator('features') + @field_validator('features') def features_validate_enum(cls, value): """Validates the enum""" if value is None: return value for i in value: - if i not in ('baremetal', 'backend_transfer', 'layer_2', 'global_ipv4', 'ibx'): + if i not in set(['baremetal', 'backend_transfer', 'layer_2', 'global_ipv4', 'ibx']): raise ValueError("each list item must be one of ('baremetal', 'backend_transfer', 'layer_2', 'global_ipv4', 'ibx')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> IPReservationFacility: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of IPReservationFacility from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of address if self.address: _dict['address'] = self.address.to_dict() @@ -82,22 +98,22 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> IPReservationFacility: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of IPReservationFacility from a dict""" if obj is None: return None if not isinstance(obj, dict): - return IPReservationFacility.parse_obj(obj) + return cls.model_validate(obj) - _obj = IPReservationFacility.parse_obj({ - "address": Address.from_dict(obj.get("address")) if obj.get("address") is not None else None, + _obj = cls.model_validate({ + "address": Address.from_dict(obj["address"]) if obj.get("address") is not None else None, "code": obj.get("code"), "features": obj.get("features"), "href": obj.get("href"), "id": obj.get("id"), "ip_ranges": obj.get("ip_ranges"), - "metro": DeviceMetro.from_dict(obj.get("metro")) if obj.get("metro") is not None else None, + "metro": DeviceMetro.from_dict(obj["metro"]) if obj.get("metro") is not None else None, "name": obj.get("name") }) return _obj diff --git a/equinix_metal/equinix_metal/models/ip_reservation_list.py b/equinix_metal/equinix_metal/models/ip_reservation_list.py index d03580f7..e6431c8c 100644 --- a/equinix_metal/equinix_metal/models/ip_reservation_list.py +++ b/equinix_metal/equinix_metal/models/ip_reservation_list.py @@ -18,45 +18,61 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.ip_reservation_list_ip_addresses_inner import IPReservationListIpAddressesInner from equinix_metal.models.meta import Meta +from typing import Optional, Set +from typing_extensions import Self class IPReservationList(BaseModel): """ IPReservationList - """ + """ # noqa: E501 href: Optional[StrictStr] = None - ip_addresses: Optional[conlist(IPReservationListIpAddressesInner)] = None + ip_addresses: Optional[List[IPReservationListIpAddressesInner]] = None meta: Optional[Meta] = None - __properties = ["href", "ip_addresses", "meta"] + __properties: ClassVar[List[str]] = ["href", "ip_addresses", "meta"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> IPReservationList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of IPReservationList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in ip_addresses (list) _items = [] if self.ip_addresses: @@ -70,18 +86,18 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> IPReservationList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of IPReservationList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return IPReservationList.parse_obj(obj) + return cls.model_validate(obj) - _obj = IPReservationList.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "ip_addresses": [IPReservationListIpAddressesInner.from_dict(_item) for _item in obj.get("ip_addresses")] if obj.get("ip_addresses") is not None else None, - "meta": Meta.from_dict(obj.get("meta")) if obj.get("meta") is not None else None + "ip_addresses": [IPReservationListIpAddressesInner.from_dict(_item) for _item in obj["ip_addresses"]] if obj.get("ip_addresses") is not None else None, + "meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/ip_reservation_list_ip_addresses_inner.py b/equinix_metal/equinix_metal/models/ip_reservation_list_ip_addresses_inner.py index dc830105..f62a3957 100644 --- a/equinix_metal/equinix_metal/models/ip_reservation_list_ip_addresses_inner.py +++ b/equinix_metal/equinix_metal/models/ip_reservation_list_ip_addresses_inner.py @@ -18,13 +18,13 @@ import json import pprint import re # noqa: F401 - +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator from typing import Optional -from pydantic import BaseModel, Field, StrictStr, ValidationError, validator from equinix_metal.models.ip_reservation import IPReservation from equinix_metal.models.vrf_ip_reservation import VrfIpReservation -from typing import Union, Any, List, TYPE_CHECKING -from pydantic import StrictStr, Field +from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field IPRESERVATIONLISTIPADDRESSESINNER_ANY_OF_SCHEMAS = ["IPReservation", "VrfIpReservation"] @@ -38,15 +38,17 @@ class IPReservationListIpAddressesInner(BaseModel): # data type: VrfIpReservation anyof_schema_2_validator: Optional[VrfIpReservation] = None if TYPE_CHECKING: - actual_instance: Union[IPReservation, VrfIpReservation] + actual_instance: Optional[Union[IPReservation, VrfIpReservation]] = None else: - actual_instance: Any - any_of_schemas: List[str] = Field(IPRESERVATIONLISTIPADDRESSESINNER_ANY_OF_SCHEMAS, const=True) + actual_instance: Any = None + any_of_schemas: List[str] = Field(default=Literal["IPReservation", "VrfIpReservation"]) - class Config: - validate_assignment = True + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: if args: if len(args) > 1: raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") @@ -56,9 +58,9 @@ def __init__(self, *args, **kwargs): else: super().__init__(**kwargs) - @validator('actual_instance') + @field_validator('actual_instance') def actual_instance_must_validate_anyof(cls, v): - instance = IPReservationListIpAddressesInner.construct() + instance = IPReservationListIpAddressesInner.model_construct() error_messages = [] # validate data type: IPReservation if not isinstance(v, IPReservation): @@ -79,13 +81,13 @@ def actual_instance_must_validate_anyof(cls, v): return v @classmethod - def from_dict(cls, obj: dict) -> IPReservationListIpAddressesInner: + def from_dict(cls, obj: Dict[str, Any]) -> Self: return cls.from_json(json.dumps(obj)) @classmethod - def from_json(cls, json_str: str) -> IPReservationListIpAddressesInner: + def from_json(cls, json_str: str) -> Self: """Returns the object represented by the json string""" - instance = IPReservationListIpAddressesInner.construct() + instance = cls.model_construct() error_messages = [] # anyof_schema_1_validator: Optional[IPReservation] = None try: @@ -111,25 +113,23 @@ def to_json(self) -> str: if self.actual_instance is None: return "null" - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): return self.actual_instance.to_json() else: return json.dumps(self.actual_instance) - def to_dict(self) -> dict: + def to_dict(self) -> Optional[Union[Dict[str, Any], IPReservation, VrfIpReservation]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: - return "null" + return None - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): return self.actual_instance.to_dict() else: - return json.dumps(self.actual_instance) + return self.actual_instance def to_str(self) -> str: """Returns the string representation of the actual instance""" - return pprint.pformat(self.dict()) + return pprint.pformat(self.model_dump()) diff --git a/equinix_metal/equinix_metal/models/ip_reservation_metro.py b/equinix_metal/equinix_metal/models/ip_reservation_metro.py index 40a5daad..63287a61 100644 --- a/equinix_metal/equinix_metal/models/ip_reservation_metro.py +++ b/equinix_metal/equinix_metal/models/ip_reservation_metro.py @@ -18,57 +18,73 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class IPReservationMetro(BaseModel): """ IPReservationMetro - """ + """ # noqa: E501 code: Optional[StrictStr] = None country: Optional[StrictStr] = None href: Optional[StrictStr] = None id: Optional[StrictStr] = None name: Optional[StrictStr] = None - __properties = ["code", "country", "href", "id", "name"] + __properties: ClassVar[List[str]] = ["code", "country", "href", "id", "name"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> IPReservationMetro: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of IPReservationMetro from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> IPReservationMetro: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of IPReservationMetro from a dict""" if obj is None: return None if not isinstance(obj, dict): - return IPReservationMetro.parse_obj(obj) + return cls.model_validate(obj) - _obj = IPReservationMetro.parse_obj({ + _obj = cls.model_validate({ "code": obj.get("code"), "country": obj.get("country"), "href": obj.get("href"), diff --git a/equinix_metal/equinix_metal/models/ip_reservation_request_input.py b/equinix_metal/equinix_metal/models/ip_reservation_request_input.py index cbf8b026..457d5a12 100644 --- a/equinix_metal/equinix_metal/models/ip_reservation_request_input.py +++ b/equinix_metal/equinix_metal/models/ip_reservation_request_input.py @@ -18,62 +18,78 @@ import re # noqa: F401 import json - -from typing import Any, Dict, List, Optional -from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class IPReservationRequestInput(BaseModel): """ IPReservationRequestInput - """ + """ # noqa: E501 comments: Optional[StrictStr] = None customdata: Optional[Dict[str, Any]] = None details: Optional[StrictStr] = None facility: Optional[StrictStr] = None fail_on_approval_required: Optional[StrictBool] = None href: Optional[StrictStr] = None - metro: Optional[StrictStr] = Field(None, description="The code of the metro you are requesting the IP reservation in.") - quantity: StrictInt = Field(...) - tags: Optional[conlist(StrictStr)] = None - type: StrictStr = Field(...) - __properties = ["comments", "customdata", "details", "facility", "fail_on_approval_required", "href", "metro", "quantity", "tags", "type"] + metro: Optional[StrictStr] = Field(default=None, description="The code of the metro you are requesting the IP reservation in.") + quantity: StrictInt + tags: Optional[List[StrictStr]] = None + type: StrictStr + __properties: ClassVar[List[str]] = ["comments", "customdata", "details", "facility", "fail_on_approval_required", "href", "metro", "quantity", "tags", "type"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> IPReservationRequestInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of IPReservationRequestInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> IPReservationRequestInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of IPReservationRequestInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return IPReservationRequestInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = IPReservationRequestInput.parse_obj({ + _obj = cls.model_validate({ "comments": obj.get("comments"), "customdata": obj.get("customdata"), "details": obj.get("details"), diff --git a/equinix_metal/equinix_metal/models/license.py b/equinix_metal/equinix_metal/models/license.py index ed909c53..53c69701 100644 --- a/equinix_metal/equinix_metal/models/license.py +++ b/equinix_metal/equinix_metal/models/license.py @@ -18,15 +18,16 @@ import re # noqa: F401 import json - -from typing import Optional, Union -from pydantic import BaseModel, StrictFloat, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union from equinix_metal.models.href import Href +from typing import Optional, Set +from typing_extensions import Self class License(BaseModel): """ License - """ + """ # noqa: E501 description: Optional[StrictStr] = None href: Optional[StrictStr] = None id: Optional[StrictStr] = None @@ -34,32 +35,47 @@ class License(BaseModel): licensee_product: Optional[Href] = None project: Optional[Href] = None size: Optional[Union[StrictFloat, StrictInt]] = None - __properties = ["description", "href", "id", "license_key", "licensee_product", "project", "size"] + __properties: ClassVar[List[str]] = ["description", "href", "id", "license_key", "licensee_product", "project", "size"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> License: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of License from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of licensee_product if self.licensee_product: _dict['licensee_product'] = self.licensee_product.to_dict() @@ -69,21 +85,21 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> License: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of License from a dict""" if obj is None: return None if not isinstance(obj, dict): - return License.parse_obj(obj) + return cls.model_validate(obj) - _obj = License.parse_obj({ + _obj = cls.model_validate({ "description": obj.get("description"), "href": obj.get("href"), "id": obj.get("id"), "license_key": obj.get("license_key"), - "licensee_product": Href.from_dict(obj.get("licensee_product")) if obj.get("licensee_product") is not None else None, - "project": Href.from_dict(obj.get("project")) if obj.get("project") is not None else None, + "licensee_product": Href.from_dict(obj["licensee_product"]) if obj.get("licensee_product") is not None else None, + "project": Href.from_dict(obj["project"]) if obj.get("project") is not None else None, "size": obj.get("size") }) return _obj diff --git a/equinix_metal/equinix_metal/models/license_create_input.py b/equinix_metal/equinix_metal/models/license_create_input.py index 3e17b979..85ce06c6 100644 --- a/equinix_metal/equinix_metal/models/license_create_input.py +++ b/equinix_metal/equinix_metal/models/license_create_input.py @@ -18,56 +18,72 @@ import re # noqa: F401 import json - -from typing import Optional, Union -from pydantic import BaseModel, StrictFloat, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self class LicenseCreateInput(BaseModel): """ LicenseCreateInput - """ + """ # noqa: E501 description: Optional[StrictStr] = None href: Optional[StrictStr] = None licensee_product_id: Optional[StrictStr] = None size: Optional[Union[StrictFloat, StrictInt]] = None - __properties = ["description", "href", "licensee_product_id", "size"] + __properties: ClassVar[List[str]] = ["description", "href", "licensee_product_id", "size"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> LicenseCreateInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of LicenseCreateInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> LicenseCreateInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of LicenseCreateInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return LicenseCreateInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = LicenseCreateInput.parse_obj({ + _obj = cls.model_validate({ "description": obj.get("description"), "href": obj.get("href"), "licensee_product_id": obj.get("licensee_product_id"), diff --git a/equinix_metal/equinix_metal/models/license_list.py b/equinix_metal/equinix_metal/models/license_list.py index 3b1e49f0..bc2c2141 100644 --- a/equinix_metal/equinix_metal/models/license_list.py +++ b/equinix_metal/equinix_metal/models/license_list.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.license import License +from typing import Optional, Set +from typing_extensions import Self class LicenseList(BaseModel): """ LicenseList - """ + """ # noqa: E501 href: Optional[StrictStr] = None - licenses: Optional[conlist(License)] = None - __properties = ["href", "licenses"] + licenses: Optional[List[License]] = None + __properties: ClassVar[List[str]] = ["href", "licenses"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> LicenseList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of LicenseList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in licenses (list) _items = [] if self.licenses: @@ -65,17 +81,17 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> LicenseList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of LicenseList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return LicenseList.parse_obj(obj) + return cls.model_validate(obj) - _obj = LicenseList.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "licenses": [License.from_dict(_item) for _item in obj.get("licenses")] if obj.get("licenses") is not None else None + "licenses": [License.from_dict(_item) for _item in obj["licenses"]] if obj.get("licenses") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/license_update_input.py b/equinix_metal/equinix_metal/models/license_update_input.py index ee3544d9..6b918e20 100644 --- a/equinix_metal/equinix_metal/models/license_update_input.py +++ b/equinix_metal/equinix_metal/models/license_update_input.py @@ -18,55 +18,71 @@ import re # noqa: F401 import json - -from typing import Optional, Union -from pydantic import BaseModel, StrictFloat, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self class LicenseUpdateInput(BaseModel): """ LicenseUpdateInput - """ + """ # noqa: E501 description: Optional[StrictStr] = None href: Optional[StrictStr] = None size: Optional[Union[StrictFloat, StrictInt]] = None - __properties = ["description", "href", "size"] + __properties: ClassVar[List[str]] = ["description", "href", "size"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> LicenseUpdateInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of LicenseUpdateInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> LicenseUpdateInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of LicenseUpdateInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return LicenseUpdateInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = LicenseUpdateInput.parse_obj({ + _obj = cls.model_validate({ "description": obj.get("description"), "href": obj.get("href"), "size": obj.get("size") diff --git a/equinix_metal/equinix_metal/models/line_item.py b/equinix_metal/equinix_metal/models/line_item.py index b6edd591..40779581 100644 --- a/equinix_metal/equinix_metal/models/line_item.py +++ b/equinix_metal/equinix_metal/models/line_item.py @@ -18,15 +18,16 @@ import re # noqa: F401 import json - -from typing import Optional, Union -from pydantic import BaseModel, StrictFloat, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union from equinix_metal.models.plan import Plan +from typing import Optional, Set +from typing_extensions import Self class LineItem(BaseModel): """ LineItem - """ + """ # noqa: E501 amount: Optional[Union[StrictFloat, StrictInt]] = None currency: Optional[StrictStr] = None description: Optional[StrictStr] = None @@ -35,53 +36,68 @@ class LineItem(BaseModel): plan: Optional[Plan] = None unit: Optional[StrictStr] = None unit_price: Optional[Union[StrictFloat, StrictInt]] = None - __properties = ["amount", "currency", "description", "details", "href", "plan", "unit", "unit_price"] + __properties: ClassVar[List[str]] = ["amount", "currency", "description", "details", "href", "plan", "unit", "unit_price"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> LineItem: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of LineItem from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of plan if self.plan: _dict['plan'] = self.plan.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> LineItem: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of LineItem from a dict""" if obj is None: return None if not isinstance(obj, dict): - return LineItem.parse_obj(obj) + return cls.model_validate(obj) - _obj = LineItem.parse_obj({ + _obj = cls.model_validate({ "amount": obj.get("amount"), "currency": obj.get("currency"), "description": obj.get("description"), "details": obj.get("details"), "href": obj.get("href"), - "plan": Plan.from_dict(obj.get("plan")) if obj.get("plan") is not None else None, + "plan": Plan.from_dict(obj["plan"]) if obj.get("plan") is not None else None, "unit": obj.get("unit"), "unit_price": obj.get("unit_price") }) diff --git a/equinix_metal/equinix_metal/models/membership.py b/equinix_metal/equinix_metal/models/membership.py index 2185e4a3..24b76a53 100644 --- a/equinix_metal/equinix_metal/models/membership.py +++ b/equinix_metal/equinix_metal/models/membership.py @@ -19,47 +19,64 @@ import json from datetime import datetime -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.href import Href +from typing import Optional, Set +from typing_extensions import Self class Membership(BaseModel): """ Membership - """ + """ # noqa: E501 created_at: Optional[datetime] = None href: Optional[StrictStr] = None id: Optional[StrictStr] = None project: Optional[Href] = None - roles: Optional[conlist(StrictStr)] = None + roles: Optional[List[StrictStr]] = None updated_at: Optional[datetime] = None user: Optional[Href] = None - __properties = ["created_at", "href", "id", "project", "roles", "updated_at", "user"] + __properties: ClassVar[List[str]] = ["created_at", "href", "id", "project", "roles", "updated_at", "user"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> Membership: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Membership from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of project if self.project: _dict['project'] = self.project.to_dict() @@ -69,22 +86,22 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> Membership: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Membership from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Membership.parse_obj(obj) + return cls.model_validate(obj) - _obj = Membership.parse_obj({ + _obj = cls.model_validate({ "created_at": obj.get("created_at"), "href": obj.get("href"), "id": obj.get("id"), - "project": Href.from_dict(obj.get("project")) if obj.get("project") is not None else None, + "project": Href.from_dict(obj["project"]) if obj.get("project") is not None else None, "roles": obj.get("roles"), "updated_at": obj.get("updated_at"), - "user": Href.from_dict(obj.get("user")) if obj.get("user") is not None else None + "user": Href.from_dict(obj["user"]) if obj.get("user") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/membership_input.py b/equinix_metal/equinix_metal/models/membership_input.py index 60918559..26e82ce3 100644 --- a/equinix_metal/equinix_metal/models/membership_input.py +++ b/equinix_metal/equinix_metal/models/membership_input.py @@ -18,54 +18,70 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class MembershipInput(BaseModel): """ MembershipInput - """ + """ # noqa: E501 href: Optional[StrictStr] = None - role: Optional[conlist(StrictStr)] = None - __properties = ["href", "role"] + role: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["href", "role"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> MembershipInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of MembershipInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> MembershipInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of MembershipInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return MembershipInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = MembershipInput.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), "role": obj.get("role") }) diff --git a/equinix_metal/equinix_metal/models/membership_list.py b/equinix_metal/equinix_metal/models/membership_list.py index b990527a..302ecb78 100644 --- a/equinix_metal/equinix_metal/models/membership_list.py +++ b/equinix_metal/equinix_metal/models/membership_list.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.membership import Membership +from typing import Optional, Set +from typing_extensions import Self class MembershipList(BaseModel): """ MembershipList - """ + """ # noqa: E501 href: Optional[StrictStr] = None - memberships: Optional[conlist(Membership)] = None - __properties = ["href", "memberships"] + memberships: Optional[List[Membership]] = None + __properties: ClassVar[List[str]] = ["href", "memberships"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> MembershipList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of MembershipList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in memberships (list) _items = [] if self.memberships: @@ -65,17 +81,17 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> MembershipList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of MembershipList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return MembershipList.parse_obj(obj) + return cls.model_validate(obj) - _obj = MembershipList.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "memberships": [Membership.from_dict(_item) for _item in obj.get("memberships")] if obj.get("memberships") is not None else None + "memberships": [Membership.from_dict(_item) for _item in obj["memberships"]] if obj.get("memberships") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/meta.py b/equinix_metal/equinix_metal/models/meta.py index e298cdec..9923055c 100644 --- a/equinix_metal/equinix_metal/models/meta.py +++ b/equinix_metal/equinix_metal/models/meta.py @@ -18,15 +18,16 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.href import Href +from typing import Optional, Set +from typing_extensions import Self class Meta(BaseModel): """ Meta - """ + """ # noqa: E501 current_page: Optional[StrictInt] = None first: Optional[Href] = None href: Optional[StrictStr] = None @@ -34,34 +35,49 @@ class Meta(BaseModel): last_page: Optional[StrictInt] = None next: Optional[Href] = None previous: Optional[Href] = None - var_self: Optional[Href] = Field(None, alias="self") + var_self: Optional[Href] = Field(default=None, alias="self") total: Optional[StrictInt] = None - __properties = ["current_page", "first", "href", "last", "last_page", "next", "previous", "self", "total"] + __properties: ClassVar[List[str]] = ["current_page", "first", "href", "last", "last_page", "next", "previous", "self", "total"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> Meta: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Meta from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of first if self.first: _dict['first'] = self.first.to_dict() @@ -80,23 +96,23 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> Meta: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Meta from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Meta.parse_obj(obj) + return cls.model_validate(obj) - _obj = Meta.parse_obj({ + _obj = cls.model_validate({ "current_page": obj.get("current_page"), - "first": Href.from_dict(obj.get("first")) if obj.get("first") is not None else None, + "first": Href.from_dict(obj["first"]) if obj.get("first") is not None else None, "href": obj.get("href"), - "last": Href.from_dict(obj.get("last")) if obj.get("last") is not None else None, + "last": Href.from_dict(obj["last"]) if obj.get("last") is not None else None, "last_page": obj.get("last_page"), - "next": Href.from_dict(obj.get("next")) if obj.get("next") is not None else None, - "previous": Href.from_dict(obj.get("previous")) if obj.get("previous") is not None else None, - "var_self": Href.from_dict(obj.get("self")) if obj.get("self") is not None else None, + "next": Href.from_dict(obj["next"]) if obj.get("next") is not None else None, + "previous": Href.from_dict(obj["previous"]) if obj.get("previous") is not None else None, + "self": Href.from_dict(obj["self"]) if obj.get("self") is not None else None, "total": obj.get("total") }) return _obj diff --git a/equinix_metal/equinix_metal/models/metadata.py b/equinix_metal/equinix_metal/models/metadata.py index a87d26b1..f60e8205 100644 --- a/equinix_metal/equinix_metal/models/metadata.py +++ b/equinix_metal/equinix_metal/models/metadata.py @@ -18,86 +18,102 @@ import re # noqa: F401 import json - -from typing import Any, Dict, List, Optional -from pydantic import BaseModel, Field, StrictBool, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.metadata_network import MetadataNetwork +from typing import Optional, Set +from typing_extensions import Self class Metadata(BaseModel): """ Metadata - """ - var_class: Optional[StrictStr] = Field(None, alias="class") + """ # noqa: E501 + var_class: Optional[StrictStr] = Field(default=None, alias="class") customdata: Optional[Dict[str, Any]] = None - facility: Optional[StrictStr] = Field(None, description="The facility code of the instance") + facility: Optional[StrictStr] = Field(default=None, description="The facility code of the instance") hostname: Optional[StrictStr] = None href: Optional[StrictStr] = None id: Optional[StrictStr] = None iqn: Optional[StrictStr] = None - metro: Optional[StrictStr] = Field(None, description="The metro code of the instance") + metro: Optional[StrictStr] = Field(default=None, description="The metro code of the instance") network: Optional[MetadataNetwork] = None operating_system: Optional[Dict[str, Any]] = None - plan: Optional[StrictStr] = Field(None, description="The plan slug of the instance") - private_subnets: Optional[conlist(StrictStr)] = Field(None, description="An array of the private subnets") + plan: Optional[StrictStr] = Field(default=None, description="The plan slug of the instance") + private_subnets: Optional[List[StrictStr]] = Field(default=None, description="An array of the private subnets") reserved: Optional[StrictBool] = None - specs: Optional[Dict[str, Any]] = Field(None, description="The specs of the plan version of the instance") - ssh_keys: Optional[conlist(StrictStr)] = None - state: Optional[StrictStr] = Field(None, description="The current state the instance is in. * When an instance is initially created it will be in the `queued` state until it is picked up by the provisioner. * Once provisioning has begun on the instance it's state will move to `provisioning`. * When an instance is deleted, it will move to `deprovisioning` state until the deprovision is completed and the instance state moves to `deleted`. * If an instance fails to provision or deprovision it will move to `failed` state. * Once an instance has completed provisioning it will move to `active` state. * If an instance is currently powering off or powering on it will move to `powering_off` or `powering_on` states respectively. * When the instance is powered off completely it will move to the `inactive` state. * When an instance is powered on completely it will move to the `active` state. * Using the reinstall action to install a new OS on the instance will cause the instance state to change to `reinstalling`. * When the reinstall action is complete the instance will move to `active` state.") + specs: Optional[Dict[str, Any]] = Field(default=None, description="The specs of the plan version of the instance") + ssh_keys: Optional[List[StrictStr]] = None + state: Optional[StrictStr] = Field(default=None, description="The current state the instance is in. * When an instance is initially created it will be in the `queued` state until it is picked up by the provisioner. * Once provisioning has begun on the instance it's state will move to `provisioning`. * When an instance is deleted, it will move to `deprovisioning` state until the deprovision is completed and the instance state moves to `deleted`. * If an instance fails to provision or deprovision it will move to `failed` state. * Once an instance has completed provisioning it will move to `active` state. * If an instance is currently powering off or powering on it will move to `powering_off` or `powering_on` states respectively. * When the instance is powered off completely it will move to the `inactive` state. * When an instance is powered on completely it will move to the `active` state. * Using the reinstall action to install a new OS on the instance will cause the instance state to change to `reinstalling`. * When the reinstall action is complete the instance will move to `active` state.") switch_short_id: Optional[StrictStr] = None - tags: Optional[conlist(StrictStr)] = None - volumes: Optional[conlist(StrictStr)] = None - __properties = ["class", "customdata", "facility", "hostname", "href", "id", "iqn", "metro", "network", "operating_system", "plan", "private_subnets", "reserved", "specs", "ssh_keys", "state", "switch_short_id", "tags", "volumes"] + tags: Optional[List[StrictStr]] = None + volumes: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["class", "customdata", "facility", "hostname", "href", "id", "iqn", "metro", "network", "operating_system", "plan", "private_subnets", "reserved", "specs", "ssh_keys", "state", "switch_short_id", "tags", "volumes"] - @validator('state') + @field_validator('state') def state_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('queued', 'provisioning', 'deprovisioning', 'reinstalling', 'active', 'inactive', 'failed', 'powering_on', 'powering_off', 'deleted'): + if value not in set(['queued', 'provisioning', 'deprovisioning', 'reinstalling', 'active', 'inactive', 'failed', 'powering_on', 'powering_off', 'deleted']): raise ValueError("must be one of enum values ('queued', 'provisioning', 'deprovisioning', 'reinstalling', 'active', 'inactive', 'failed', 'powering_on', 'powering_off', 'deleted')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> Metadata: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Metadata from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of network if self.network: _dict['network'] = self.network.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> Metadata: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Metadata from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Metadata.parse_obj(obj) + return cls.model_validate(obj) - _obj = Metadata.parse_obj({ - "var_class": obj.get("class"), + _obj = cls.model_validate({ + "class": obj.get("class"), "customdata": obj.get("customdata"), "facility": obj.get("facility"), "hostname": obj.get("hostname"), @@ -105,7 +121,7 @@ def from_dict(cls, obj: dict) -> Metadata: "id": obj.get("id"), "iqn": obj.get("iqn"), "metro": obj.get("metro"), - "network": MetadataNetwork.from_dict(obj.get("network")) if obj.get("network") is not None else None, + "network": MetadataNetwork.from_dict(obj["network"]) if obj.get("network") is not None else None, "operating_system": obj.get("operating_system"), "plan": obj.get("plan"), "private_subnets": obj.get("private_subnets"), diff --git a/equinix_metal/equinix_metal/models/metadata_network.py b/equinix_metal/equinix_metal/models/metadata_network.py index 02c6e012..6d6d8ff5 100644 --- a/equinix_metal/equinix_metal/models/metadata_network.py +++ b/equinix_metal/equinix_metal/models/metadata_network.py @@ -18,64 +18,80 @@ import re # noqa: F401 import json - -from typing import Any, Dict, List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.metadata_network_network import MetadataNetworkNetwork +from typing import Optional, Set +from typing_extensions import Self class MetadataNetwork(BaseModel): """ MetadataNetwork - """ - addresses: Optional[conlist(StrictStr)] = None + """ # noqa: E501 + addresses: Optional[List[StrictStr]] = None href: Optional[StrictStr] = None - interfaces: Optional[conlist(Dict[str, Any])] = None + interfaces: Optional[List[Dict[str, Any]]] = None network: Optional[MetadataNetworkNetwork] = None - __properties = ["addresses", "href", "interfaces", "network"] + __properties: ClassVar[List[str]] = ["addresses", "href", "interfaces", "network"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> MetadataNetwork: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of MetadataNetwork from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of network if self.network: _dict['network'] = self.network.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> MetadataNetwork: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of MetadataNetwork from a dict""" if obj is None: return None if not isinstance(obj, dict): - return MetadataNetwork.parse_obj(obj) + return cls.model_validate(obj) - _obj = MetadataNetwork.parse_obj({ + _obj = cls.model_validate({ "addresses": obj.get("addresses"), "href": obj.get("href"), "interfaces": obj.get("interfaces"), - "network": MetadataNetworkNetwork.from_dict(obj.get("network")) if obj.get("network") is not None else None + "network": MetadataNetworkNetwork.from_dict(obj["network"]) if obj.get("network") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/metadata_network_network.py b/equinix_metal/equinix_metal/models/metadata_network_network.py index 1464acda..d73907df 100644 --- a/equinix_metal/equinix_metal/models/metadata_network_network.py +++ b/equinix_metal/equinix_metal/models/metadata_network_network.py @@ -18,59 +18,75 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.metadata_network_network_bonding import MetadataNetworkNetworkBonding +from typing import Optional, Set +from typing_extensions import Self class MetadataNetworkNetwork(BaseModel): """ MetadataNetworkNetwork - """ + """ # noqa: E501 bonding: Optional[MetadataNetworkNetworkBonding] = None href: Optional[StrictStr] = None - __properties = ["bonding", "href"] + __properties: ClassVar[List[str]] = ["bonding", "href"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> MetadataNetworkNetwork: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of MetadataNetworkNetwork from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of bonding if self.bonding: _dict['bonding'] = self.bonding.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> MetadataNetworkNetwork: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of MetadataNetworkNetwork from a dict""" if obj is None: return None if not isinstance(obj, dict): - return MetadataNetworkNetwork.parse_obj(obj) + return cls.model_validate(obj) - _obj = MetadataNetworkNetwork.parse_obj({ - "bonding": MetadataNetworkNetworkBonding.from_dict(obj.get("bonding")) if obj.get("bonding") is not None else None, + _obj = cls.model_validate({ + "bonding": MetadataNetworkNetworkBonding.from_dict(obj["bonding"]) if obj.get("bonding") is not None else None, "href": obj.get("href") }) return _obj diff --git a/equinix_metal/equinix_metal/models/metadata_network_network_bonding.py b/equinix_metal/equinix_metal/models/metadata_network_network_bonding.py index 738417f8..66b4c8ed 100644 --- a/equinix_metal/equinix_metal/models/metadata_network_network_bonding.py +++ b/equinix_metal/equinix_metal/models/metadata_network_network_bonding.py @@ -18,56 +18,72 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class MetadataNetworkNetworkBonding(BaseModel): """ MetadataNetworkNetworkBonding - """ + """ # noqa: E501 href: Optional[StrictStr] = None link_aggregation: Optional[StrictStr] = None mac: Optional[StrictStr] = None mode: Optional[StrictInt] = None - __properties = ["href", "link_aggregation", "mac", "mode"] + __properties: ClassVar[List[str]] = ["href", "link_aggregation", "mac", "mode"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> MetadataNetworkNetworkBonding: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of MetadataNetworkNetworkBonding from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> MetadataNetworkNetworkBonding: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of MetadataNetworkNetworkBonding from a dict""" if obj is None: return None if not isinstance(obj, dict): - return MetadataNetworkNetworkBonding.parse_obj(obj) + return cls.model_validate(obj) - _obj = MetadataNetworkNetworkBonding.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), "link_aggregation": obj.get("link_aggregation"), "mac": obj.get("mac"), diff --git a/equinix_metal/equinix_metal/models/metal_gateway.py b/equinix_metal/equinix_metal/models/metal_gateway.py index a175148b..82da178e 100644 --- a/equinix_metal/equinix_metal/models/metal_gateway.py +++ b/equinix_metal/equinix_metal/models/metal_gateway.py @@ -19,62 +19,79 @@ import json from datetime import datetime -from typing import Optional -from pydantic import BaseModel, Field, StrictStr, validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.href import Href from equinix_metal.models.ip_reservation import IPReservation from equinix_metal.models.project import Project from equinix_metal.models.virtual_network import VirtualNetwork +from typing import Optional, Set +from typing_extensions import Self class MetalGateway(BaseModel): """ MetalGateway - """ + """ # noqa: E501 created_at: Optional[datetime] = None created_by: Optional[Href] = None href: Optional[StrictStr] = None id: Optional[StrictStr] = None ip_reservation: Optional[IPReservation] = None project: Optional[Project] = None - state: Optional[StrictStr] = Field(None, description="The current state of the Metal Gateway. 'Ready' indicates the gateway record has been configured, but is currently not active on the network. 'Active' indicates the gateway has been configured on the network. 'Deleting' is a temporary state used to indicate that the gateway is in the process of being un-configured from the network, after which the gateway record will be deleted.") + state: Optional[StrictStr] = Field(default=None, description="The current state of the Metal Gateway. 'Ready' indicates the gateway record has been configured, but is currently not active on the network. 'Active' indicates the gateway has been configured on the network. 'Deleting' is a temporary state used to indicate that the gateway is in the process of being un-configured from the network, after which the gateway record will be deleted.") updated_at: Optional[datetime] = None virtual_network: Optional[VirtualNetwork] = None - __properties = ["created_at", "created_by", "href", "id", "ip_reservation", "project", "state", "updated_at", "virtual_network"] + __properties: ClassVar[List[str]] = ["created_at", "created_by", "href", "id", "ip_reservation", "project", "state", "updated_at", "virtual_network"] - @validator('state') + @field_validator('state') def state_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('ready', 'active', 'deleting'): + if value not in set(['ready', 'active', 'deleting']): raise ValueError("must be one of enum values ('ready', 'active', 'deleting')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> MetalGateway: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of MetalGateway from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of created_by if self.created_by: _dict['created_by'] = self.created_by.to_dict() @@ -90,24 +107,24 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> MetalGateway: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of MetalGateway from a dict""" if obj is None: return None if not isinstance(obj, dict): - return MetalGateway.parse_obj(obj) + return cls.model_validate(obj) - _obj = MetalGateway.parse_obj({ + _obj = cls.model_validate({ "created_at": obj.get("created_at"), - "created_by": Href.from_dict(obj.get("created_by")) if obj.get("created_by") is not None else None, + "created_by": Href.from_dict(obj["created_by"]) if obj.get("created_by") is not None else None, "href": obj.get("href"), "id": obj.get("id"), - "ip_reservation": IPReservation.from_dict(obj.get("ip_reservation")) if obj.get("ip_reservation") is not None else None, - "project": Project.from_dict(obj.get("project")) if obj.get("project") is not None else None, + "ip_reservation": IPReservation.from_dict(obj["ip_reservation"]) if obj.get("ip_reservation") is not None else None, + "project": Project.from_dict(obj["project"]) if obj.get("project") is not None else None, "state": obj.get("state"), "updated_at": obj.get("updated_at"), - "virtual_network": VirtualNetwork.from_dict(obj.get("virtual_network")) if obj.get("virtual_network") is not None else None + "virtual_network": VirtualNetwork.from_dict(obj["virtual_network"]) if obj.get("virtual_network") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/metal_gateway_create_input.py b/equinix_metal/equinix_metal/models/metal_gateway_create_input.py index 56879ea7..ae675122 100644 --- a/equinix_metal/equinix_metal/models/metal_gateway_create_input.py +++ b/equinix_metal/equinix_metal/models/metal_gateway_create_input.py @@ -18,56 +18,72 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class MetalGatewayCreateInput(BaseModel): """ MetalGatewayCreateInput - """ + """ # noqa: E501 href: Optional[StrictStr] = None - ip_reservation_id: Optional[StrictStr] = Field(None, description="The UUID of an IP reservation that belongs to the same project as where the metal gateway will be created in. This field is required unless the private IPv4 subnet size is specified.") - private_ipv4_subnet_size: Optional[StrictInt] = Field(None, description="The subnet size (8, 16, 32, 64, or 128) of the private IPv4 reservation that will be created for the metal gateway. This field is required unless a project IP reservation was specified. Please keep in mind that the number of private metal gateway ranges are limited per project. If you would like to increase the limit per project, please contact support for assistance.") - virtual_network_id: StrictStr = Field(..., description="The UUID of a metro virtual network that belongs to the same project as where the metal gateway will be created in.") - __properties = ["href", "ip_reservation_id", "private_ipv4_subnet_size", "virtual_network_id"] + ip_reservation_id: Optional[StrictStr] = Field(default=None, description="The UUID of an IP reservation that belongs to the same project as where the metal gateway will be created in. This field is required unless the private IPv4 subnet size is specified.") + private_ipv4_subnet_size: Optional[StrictInt] = Field(default=None, description="The subnet size (8, 16, 32, 64, or 128) of the private IPv4 reservation that will be created for the metal gateway. This field is required unless a project IP reservation was specified. Please keep in mind that the number of private metal gateway ranges are limited per project. If you would like to increase the limit per project, please contact support for assistance.") + virtual_network_id: StrictStr = Field(description="The UUID of a metro virtual network that belongs to the same project as where the metal gateway will be created in.") + __properties: ClassVar[List[str]] = ["href", "ip_reservation_id", "private_ipv4_subnet_size", "virtual_network_id"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> MetalGatewayCreateInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of MetalGatewayCreateInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> MetalGatewayCreateInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of MetalGatewayCreateInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return MetalGatewayCreateInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = MetalGatewayCreateInput.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), "ip_reservation_id": obj.get("ip_reservation_id"), "private_ipv4_subnet_size": obj.get("private_ipv4_subnet_size"), diff --git a/equinix_metal/equinix_metal/models/metal_gateway_elastic_ip_create_input.py b/equinix_metal/equinix_metal/models/metal_gateway_elastic_ip_create_input.py index 27d1e3cb..ab764de4 100644 --- a/equinix_metal/equinix_metal/models/metal_gateway_elastic_ip_create_input.py +++ b/equinix_metal/equinix_metal/models/metal_gateway_elastic_ip_create_input.py @@ -18,57 +18,73 @@ import re # noqa: F401 import json - -from typing import Any, Dict, List, Optional -from pydantic import BaseModel, Field, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class MetalGatewayElasticIpCreateInput(BaseModel): """ MetalGatewayElasticIpCreateInput - """ - address: StrictStr = Field(..., description="An IP address (or IP Address range) contained within one of the project's IP Reservations") - customdata: Optional[Dict[str, Any]] = Field(None, description="Optional User-defined JSON object value.") + """ # noqa: E501 + address: StrictStr = Field(description="An IP address (or IP Address range) contained within one of the project's IP Reservations") + customdata: Optional[Dict[str, Any]] = Field(default=None, description="Optional User-defined JSON object value.") href: Optional[StrictStr] = None - next_hop: StrictStr = Field(..., description="An IP address contained within the Metal Gateways' IP Reservation range.") - tags: Optional[conlist(StrictStr)] = Field(None, description="Optional list of User-defined tags. Can be used by users to provide additional details or context regarding the purpose or usage of this resource.") - __properties = ["address", "customdata", "href", "next_hop", "tags"] + next_hop: StrictStr = Field(description="An IP address contained within the Metal Gateways' IP Reservation range.") + tags: Optional[List[StrictStr]] = Field(default=None, description="Optional list of User-defined tags. Can be used by users to provide additional details or context regarding the purpose or usage of this resource.") + __properties: ClassVar[List[str]] = ["address", "customdata", "href", "next_hop", "tags"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> MetalGatewayElasticIpCreateInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of MetalGatewayElasticIpCreateInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> MetalGatewayElasticIpCreateInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of MetalGatewayElasticIpCreateInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return MetalGatewayElasticIpCreateInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = MetalGatewayElasticIpCreateInput.parse_obj({ + _obj = cls.model_validate({ "address": obj.get("address"), "customdata": obj.get("customdata"), "href": obj.get("href"), diff --git a/equinix_metal/equinix_metal/models/metal_gateway_list.py b/equinix_metal/equinix_metal/models/metal_gateway_list.py index 7f5bd676..8b913a22 100644 --- a/equinix_metal/equinix_metal/models/metal_gateway_list.py +++ b/equinix_metal/equinix_metal/models/metal_gateway_list.py @@ -18,45 +18,61 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.meta import Meta from equinix_metal.models.metal_gateway_list_metal_gateways_inner import MetalGatewayListMetalGatewaysInner +from typing import Optional, Set +from typing_extensions import Self class MetalGatewayList(BaseModel): """ MetalGatewayList - """ + """ # noqa: E501 href: Optional[StrictStr] = None meta: Optional[Meta] = None - metal_gateways: Optional[conlist(MetalGatewayListMetalGatewaysInner)] = None - __properties = ["href", "meta", "metal_gateways"] + metal_gateways: Optional[List[MetalGatewayListMetalGatewaysInner]] = None + __properties: ClassVar[List[str]] = ["href", "meta", "metal_gateways"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> MetalGatewayList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of MetalGatewayList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of meta if self.meta: _dict['meta'] = self.meta.to_dict() @@ -70,18 +86,18 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> MetalGatewayList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of MetalGatewayList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return MetalGatewayList.parse_obj(obj) + return cls.model_validate(obj) - _obj = MetalGatewayList.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "meta": Meta.from_dict(obj.get("meta")) if obj.get("meta") is not None else None, - "metal_gateways": [MetalGatewayListMetalGatewaysInner.from_dict(_item) for _item in obj.get("metal_gateways")] if obj.get("metal_gateways") is not None else None + "meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None, + "metal_gateways": [MetalGatewayListMetalGatewaysInner.from_dict(_item) for _item in obj["metal_gateways"]] if obj.get("metal_gateways") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/metal_gateway_list_metal_gateways_inner.py b/equinix_metal/equinix_metal/models/metal_gateway_list_metal_gateways_inner.py index dd59b2f0..2c8d5668 100644 --- a/equinix_metal/equinix_metal/models/metal_gateway_list_metal_gateways_inner.py +++ b/equinix_metal/equinix_metal/models/metal_gateway_list_metal_gateways_inner.py @@ -18,13 +18,13 @@ import json import pprint import re # noqa: F401 - +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator from typing import Optional -from pydantic import BaseModel, Field, StrictStr, ValidationError, validator from equinix_metal.models.metal_gateway import MetalGateway from equinix_metal.models.vrf_metal_gateway import VrfMetalGateway -from typing import Union, Any, List, TYPE_CHECKING -from pydantic import StrictStr, Field +from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field METALGATEWAYLISTMETALGATEWAYSINNER_ANY_OF_SCHEMAS = ["MetalGateway", "VrfMetalGateway"] @@ -38,15 +38,17 @@ class MetalGatewayListMetalGatewaysInner(BaseModel): # data type: VrfMetalGateway anyof_schema_2_validator: Optional[VrfMetalGateway] = None if TYPE_CHECKING: - actual_instance: Union[MetalGateway, VrfMetalGateway] + actual_instance: Optional[Union[MetalGateway, VrfMetalGateway]] = None else: - actual_instance: Any - any_of_schemas: List[str] = Field(METALGATEWAYLISTMETALGATEWAYSINNER_ANY_OF_SCHEMAS, const=True) + actual_instance: Any = None + any_of_schemas: List[str] = Field(default=Literal["MetalGateway", "VrfMetalGateway"]) - class Config: - validate_assignment = True + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: if args: if len(args) > 1: raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") @@ -56,9 +58,9 @@ def __init__(self, *args, **kwargs): else: super().__init__(**kwargs) - @validator('actual_instance') + @field_validator('actual_instance') def actual_instance_must_validate_anyof(cls, v): - instance = MetalGatewayListMetalGatewaysInner.construct() + instance = MetalGatewayListMetalGatewaysInner.model_construct() error_messages = [] # validate data type: MetalGateway if not isinstance(v, MetalGateway): @@ -79,13 +81,13 @@ def actual_instance_must_validate_anyof(cls, v): return v @classmethod - def from_dict(cls, obj: dict) -> MetalGatewayListMetalGatewaysInner: + def from_dict(cls, obj: Dict[str, Any]) -> Self: return cls.from_json(json.dumps(obj)) @classmethod - def from_json(cls, json_str: str) -> MetalGatewayListMetalGatewaysInner: + def from_json(cls, json_str: str) -> Self: """Returns the object represented by the json string""" - instance = MetalGatewayListMetalGatewaysInner.construct() + instance = cls.model_construct() error_messages = [] # anyof_schema_1_validator: Optional[MetalGateway] = None try: @@ -111,25 +113,23 @@ def to_json(self) -> str: if self.actual_instance is None: return "null" - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): return self.actual_instance.to_json() else: return json.dumps(self.actual_instance) - def to_dict(self) -> dict: + def to_dict(self) -> Optional[Union[Dict[str, Any], MetalGateway, VrfMetalGateway]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: - return "null" + return None - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): return self.actual_instance.to_dict() else: - return json.dumps(self.actual_instance) + return self.actual_instance def to_str(self) -> str: """Returns the string representation of the actual instance""" - return pprint.pformat(self.dict()) + return pprint.pformat(self.model_dump()) diff --git a/equinix_metal/equinix_metal/models/metal_gateway_lite.py b/equinix_metal/equinix_metal/models/metal_gateway_lite.py index 4f20acdc..e432f064 100644 --- a/equinix_metal/equinix_metal/models/metal_gateway_lite.py +++ b/equinix_metal/equinix_metal/models/metal_gateway_lite.py @@ -19,68 +19,85 @@ import json from datetime import datetime -from typing import Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, validator +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class MetalGatewayLite(BaseModel): """ MetalGatewayLite - """ + """ # noqa: E501 created_at: Optional[datetime] = None - gateway_address: Optional[StrictStr] = Field(None, description="The gateway address with subnet CIDR value for this Metal Gateway. For example, a Metal Gateway using an IP reservation with block 10.1.2.0/27 would have a gateway address of 10.1.2.1/27.") + gateway_address: Optional[StrictStr] = Field(default=None, description="The gateway address with subnet CIDR value for this Metal Gateway. For example, a Metal Gateway using an IP reservation with block 10.1.2.0/27 would have a gateway address of 10.1.2.1/27.") href: Optional[StrictStr] = None id: Optional[StrictStr] = None - state: Optional[StrictStr] = Field(None, description="The current state of the Metal Gateway. 'Ready' indicates the gateway record has been configured, but is currently not active on the network. 'Active' indicates the gateway has been configured on the network. 'Deleting' is a temporary state used to indicate that the gateway is in the process of being un-configured from the network, after which the gateway record will be deleted.") + state: Optional[StrictStr] = Field(default=None, description="The current state of the Metal Gateway. 'Ready' indicates the gateway record has been configured, but is currently not active on the network. 'Active' indicates the gateway has been configured on the network. 'Deleting' is a temporary state used to indicate that the gateway is in the process of being un-configured from the network, after which the gateway record will be deleted.") updated_at: Optional[datetime] = None - vlan: Optional[StrictInt] = Field(None, description="The VLAN id of the Virtual Network record associated to this Metal Gateway.") - __properties = ["created_at", "gateway_address", "href", "id", "state", "updated_at", "vlan"] + vlan: Optional[StrictInt] = Field(default=None, description="The VLAN id of the Virtual Network record associated to this Metal Gateway.") + __properties: ClassVar[List[str]] = ["created_at", "gateway_address", "href", "id", "state", "updated_at", "vlan"] - @validator('state') + @field_validator('state') def state_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('ready', 'active', 'deleting'): + if value not in set(['ready', 'active', 'deleting']): raise ValueError("must be one of enum values ('ready', 'active', 'deleting')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> MetalGatewayLite: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of MetalGatewayLite from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> MetalGatewayLite: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of MetalGatewayLite from a dict""" if obj is None: return None if not isinstance(obj, dict): - return MetalGatewayLite.parse_obj(obj) + return cls.model_validate(obj) - _obj = MetalGatewayLite.parse_obj({ + _obj = cls.model_validate({ "created_at": obj.get("created_at"), "gateway_address": obj.get("gateway_address"), "href": obj.get("href"), diff --git a/equinix_metal/equinix_metal/models/metro.py b/equinix_metal/equinix_metal/models/metro.py index 630b23e1..fe14fd30 100644 --- a/equinix_metal/equinix_metal/models/metro.py +++ b/equinix_metal/equinix_metal/models/metro.py @@ -18,57 +18,73 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class Metro(BaseModel): """ Metro - """ + """ # noqa: E501 code: Optional[StrictStr] = None country: Optional[StrictStr] = None href: Optional[StrictStr] = None id: Optional[StrictStr] = None name: Optional[StrictStr] = None - __properties = ["code", "country", "href", "id", "name"] + __properties: ClassVar[List[str]] = ["code", "country", "href", "id", "name"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> Metro: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Metro from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> Metro: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Metro from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Metro.parse_obj(obj) + return cls.model_validate(obj) - _obj = Metro.parse_obj({ + _obj = cls.model_validate({ "code": obj.get("code"), "country": obj.get("country"), "href": obj.get("href"), diff --git a/equinix_metal/equinix_metal/models/metro_input.py b/equinix_metal/equinix_metal/models/metro_input.py index 19ea0e07..ea5a8c15 100644 --- a/equinix_metal/equinix_metal/models/metro_input.py +++ b/equinix_metal/equinix_metal/models/metro_input.py @@ -18,54 +18,70 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class MetroInput(BaseModel): """ MetroInput - """ + """ # noqa: E501 href: Optional[StrictStr] = None - metro: StrictStr = Field(..., description="Metro code or ID of where the instance should be provisioned in. Either metro or facility must be provided.") - __properties = ["href", "metro"] + metro: StrictStr = Field(description="Metro code or ID of where the instance should be provisioned in. Either metro or facility must be provided.") + __properties: ClassVar[List[str]] = ["href", "metro"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> MetroInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of MetroInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> MetroInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of MetroInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return MetroInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = MetroInput.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), "metro": obj.get("metro") }) diff --git a/equinix_metal/equinix_metal/models/metro_list.py b/equinix_metal/equinix_metal/models/metro_list.py index 40e80867..80e8d524 100644 --- a/equinix_metal/equinix_metal/models/metro_list.py +++ b/equinix_metal/equinix_metal/models/metro_list.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.metro import Metro +from typing import Optional, Set +from typing_extensions import Self class MetroList(BaseModel): """ MetroList - """ + """ # noqa: E501 href: Optional[StrictStr] = None - metros: Optional[conlist(Metro)] = None - __properties = ["href", "metros"] + metros: Optional[List[Metro]] = None + __properties: ClassVar[List[str]] = ["href", "metros"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> MetroList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of MetroList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in metros (list) _items = [] if self.metros: @@ -65,17 +81,17 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> MetroList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of MetroList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return MetroList.parse_obj(obj) + return cls.model_validate(obj) - _obj = MetroList.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "metros": [Metro.from_dict(_item) for _item in obj.get("metros")] if obj.get("metros") is not None else None + "metros": [Metro.from_dict(_item) for _item in obj["metros"]] if obj.get("metros") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/mount.py b/equinix_metal/equinix_metal/models/mount.py index 34b41ff8..cb99fd28 100644 --- a/equinix_metal/equinix_metal/models/mount.py +++ b/equinix_metal/equinix_metal/models/mount.py @@ -18,57 +18,73 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class Mount(BaseModel): """ Mount - """ + """ # noqa: E501 device: Optional[StrictStr] = None format: Optional[StrictStr] = None href: Optional[StrictStr] = None - options: Optional[conlist(StrictStr)] = None + options: Optional[List[StrictStr]] = None point: Optional[StrictStr] = None - __properties = ["device", "format", "href", "options", "point"] + __properties: ClassVar[List[str]] = ["device", "format", "href", "options", "point"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> Mount: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Mount from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> Mount: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Mount from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Mount.parse_obj(obj) + return cls.model_validate(obj) - _obj = Mount.parse_obj({ + _obj = cls.model_validate({ "device": obj.get("device"), "format": obj.get("format"), "href": obj.get("href"), diff --git a/equinix_metal/equinix_metal/models/move_hardware_reservation_request.py b/equinix_metal/equinix_metal/models/move_hardware_reservation_request.py index 0b0967c8..eb4fac9c 100644 --- a/equinix_metal/equinix_metal/models/move_hardware_reservation_request.py +++ b/equinix_metal/equinix_metal/models/move_hardware_reservation_request.py @@ -18,54 +18,70 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class MoveHardwareReservationRequest(BaseModel): """ MoveHardwareReservationRequest - """ + """ # noqa: E501 href: Optional[StrictStr] = None project_id: Optional[StrictStr] = None - __properties = ["href", "project_id"] + __properties: ClassVar[List[str]] = ["href", "project_id"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> MoveHardwareReservationRequest: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of MoveHardwareReservationRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> MoveHardwareReservationRequest: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of MoveHardwareReservationRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return MoveHardwareReservationRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = MoveHardwareReservationRequest.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), "project_id": obj.get("project_id") }) diff --git a/equinix_metal/equinix_metal/models/new_password.py b/equinix_metal/equinix_metal/models/new_password.py index 7da07bfb..930353b4 100644 --- a/equinix_metal/equinix_metal/models/new_password.py +++ b/equinix_metal/equinix_metal/models/new_password.py @@ -18,54 +18,70 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class NewPassword(BaseModel): """ NewPassword - """ + """ # noqa: E501 href: Optional[StrictStr] = None new_password: Optional[StrictStr] = None - __properties = ["href", "new_password"] + __properties: ClassVar[List[str]] = ["href", "new_password"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> NewPassword: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of NewPassword from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> NewPassword: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of NewPassword from a dict""" if obj is None: return None if not isinstance(obj, dict): - return NewPassword.parse_obj(obj) + return cls.model_validate(obj) - _obj = NewPassword.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), "new_password": obj.get("new_password") }) diff --git a/equinix_metal/equinix_metal/models/operating_system.py b/equinix_metal/equinix_metal/models/operating_system.py index 46101a1b..1424cd91 100644 --- a/equinix_metal/equinix_metal/models/operating_system.py +++ b/equinix_metal/equinix_metal/models/operating_system.py @@ -18,65 +18,82 @@ import re # noqa: F401 import json - -from typing import Any, Dict, List, Optional -from pydantic import BaseModel, Field, StrictBool, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class OperatingSystem(BaseModel): """ OperatingSystem - """ - default_operating_system: Optional[StrictBool] = Field(None, description="Default operating system for the distro.") + """ # noqa: E501 + default_operating_system: Optional[StrictBool] = Field(default=None, description="Default operating system for the distro.") distro: Optional[StrictStr] = None distro_label: Optional[StrictStr] = None href: Optional[StrictStr] = None id: Optional[StrictStr] = None - licensed: Optional[StrictBool] = Field(None, description="Licenced OS is priced according to pricing property") + licensed: Optional[StrictBool] = Field(default=None, description="Licenced OS is priced according to pricing property") name: Optional[StrictStr] = None - preinstallable: Optional[StrictBool] = Field(None, description="Servers can be already preinstalled with OS in order to shorten provision time.") - pricing: Optional[Dict[str, Any]] = Field(None, description="This object contains price per time unit and optional multiplier value if licence price depends on hardware plan or components (e.g. number of cores)") - provisionable_on: Optional[conlist(StrictStr)] = None + preinstallable: Optional[StrictBool] = Field(default=None, description="Servers can be already preinstalled with OS in order to shorten provision time.") + pricing: Optional[Dict[str, Any]] = Field(default=None, description="This object contains price per time unit and optional multiplier value if licence price depends on hardware plan or components (e.g. number of cores)") + provisionable_on: Optional[List[StrictStr]] = None slug: Optional[StrictStr] = None version: Optional[StrictStr] = None - __properties = ["default_operating_system", "distro", "distro_label", "href", "id", "licensed", "name", "preinstallable", "pricing", "provisionable_on", "slug", "version"] + __properties: ClassVar[List[str]] = ["default_operating_system", "distro", "distro_label", "href", "id", "licensed", "name", "preinstallable", "pricing", "provisionable_on", "slug", "version"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> OperatingSystem: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of OperatingSystem from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - "default_operating_system", - }, - exclude_none=True) + 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. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "default_operating_system", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> OperatingSystem: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of OperatingSystem from a dict""" if obj is None: return None if not isinstance(obj, dict): - return OperatingSystem.parse_obj(obj) + return cls.model_validate(obj) - _obj = OperatingSystem.parse_obj({ + _obj = cls.model_validate({ "default_operating_system": obj.get("default_operating_system"), "distro": obj.get("distro"), "distro_label": obj.get("distro_label"), diff --git a/equinix_metal/equinix_metal/models/operating_system_list.py b/equinix_metal/equinix_metal/models/operating_system_list.py index a23329ed..37e9ed96 100644 --- a/equinix_metal/equinix_metal/models/operating_system_list.py +++ b/equinix_metal/equinix_metal/models/operating_system_list.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.operating_system import OperatingSystem +from typing import Optional, Set +from typing_extensions import Self class OperatingSystemList(BaseModel): """ OperatingSystemList - """ + """ # noqa: E501 href: Optional[StrictStr] = None - operating_systems: Optional[conlist(OperatingSystem)] = None - __properties = ["href", "operating_systems"] + operating_systems: Optional[List[OperatingSystem]] = None + __properties: ClassVar[List[str]] = ["href", "operating_systems"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> OperatingSystemList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of OperatingSystemList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in operating_systems (list) _items = [] if self.operating_systems: @@ -65,17 +81,17 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> OperatingSystemList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of OperatingSystemList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return OperatingSystemList.parse_obj(obj) + return cls.model_validate(obj) - _obj = OperatingSystemList.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "operating_systems": [OperatingSystem.from_dict(_item) for _item in obj.get("operating_systems")] if obj.get("operating_systems") is not None else None + "operating_systems": [OperatingSystem.from_dict(_item) for _item in obj["operating_systems"]] if obj.get("operating_systems") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/organization.py b/equinix_metal/equinix_metal/models/organization.py index 9d871766..f61cdc31 100644 --- a/equinix_metal/equinix_metal/models/organization.py +++ b/equinix_metal/equinix_metal/models/organization.py @@ -19,59 +19,76 @@ import json from datetime import datetime -from typing import Any, Dict, List, Optional, Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union from equinix_metal.models.address import Address from equinix_metal.models.href import Href +from typing import Optional, Set +from typing_extensions import Self class Organization(BaseModel): """ Organization - """ + """ # noqa: E501 address: Optional[Address] = None billing_address: Optional[Address] = None created_at: Optional[datetime] = None credit_amount: Optional[Union[StrictFloat, StrictInt]] = None customdata: Optional[Dict[str, Any]] = None description: Optional[StrictStr] = None - enforce_2fa_at: Optional[datetime] = Field(None, description="Force to all members to have enabled the two factor authentication after that date, unless the value is null") + enforce_2fa_at: Optional[datetime] = Field(default=None, description="Force to all members to have enabled the two factor authentication after that date, unless the value is null") href: Optional[StrictStr] = None id: Optional[StrictStr] = None logo: Optional[StrictStr] = None - members: Optional[conlist(Href)] = None - memberships: Optional[conlist(Href)] = None + members: Optional[List[Href]] = None + memberships: Optional[List[Href]] = None name: Optional[StrictStr] = None - projects: Optional[conlist(Href)] = None + projects: Optional[List[Href]] = None terms: Optional[StrictInt] = None twitter: Optional[StrictStr] = None updated_at: Optional[datetime] = None website: Optional[StrictStr] = None - __properties = ["address", "billing_address", "created_at", "credit_amount", "customdata", "description", "enforce_2fa_at", "href", "id", "logo", "members", "memberships", "name", "projects", "terms", "twitter", "updated_at", "website"] + __properties: ClassVar[List[str]] = ["address", "billing_address", "created_at", "credit_amount", "customdata", "description", "enforce_2fa_at", "href", "id", "logo", "members", "memberships", "name", "projects", "terms", "twitter", "updated_at", "website"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> Organization: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Organization from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of address if self.address: _dict['address'] = self.address.to_dict() @@ -102,17 +119,17 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> Organization: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Organization from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Organization.parse_obj(obj) + return cls.model_validate(obj) - _obj = Organization.parse_obj({ - "address": Address.from_dict(obj.get("address")) if obj.get("address") is not None else None, - "billing_address": Address.from_dict(obj.get("billing_address")) if obj.get("billing_address") is not None else None, + _obj = cls.model_validate({ + "address": Address.from_dict(obj["address"]) if obj.get("address") is not None else None, + "billing_address": Address.from_dict(obj["billing_address"]) if obj.get("billing_address") is not None else None, "created_at": obj.get("created_at"), "credit_amount": obj.get("credit_amount"), "customdata": obj.get("customdata"), @@ -121,10 +138,10 @@ def from_dict(cls, obj: dict) -> Organization: "href": obj.get("href"), "id": obj.get("id"), "logo": obj.get("logo"), - "members": [Href.from_dict(_item) for _item in obj.get("members")] if obj.get("members") is not None else None, - "memberships": [Href.from_dict(_item) for _item in obj.get("memberships")] if obj.get("memberships") is not None else None, + "members": [Href.from_dict(_item) for _item in obj["members"]] if obj.get("members") is not None else None, + "memberships": [Href.from_dict(_item) for _item in obj["memberships"]] if obj.get("memberships") is not None else None, "name": obj.get("name"), - "projects": [Href.from_dict(_item) for _item in obj.get("projects")] if obj.get("projects") is not None else None, + "projects": [Href.from_dict(_item) for _item in obj["projects"]] if obj.get("projects") is not None else None, "terms": obj.get("terms"), "twitter": obj.get("twitter"), "updated_at": obj.get("updated_at"), diff --git a/equinix_metal/equinix_metal/models/organization_input.py b/equinix_metal/equinix_metal/models/organization_input.py index e7c10328..9aee6d5c 100644 --- a/equinix_metal/equinix_metal/models/organization_input.py +++ b/equinix_metal/equinix_metal/models/organization_input.py @@ -19,50 +19,67 @@ import json from datetime import datetime -from typing import Any, Dict, Optional, Union -from pydantic import BaseModel, Field, StrictBytes, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictBytes, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union from equinix_metal.models.address import Address +from typing import Optional, Set +from typing_extensions import Self class OrganizationInput(BaseModel): """ OrganizationInput - """ + """ # noqa: E501 address: Optional[Address] = None billing_address: Optional[Address] = None customdata: Optional[Dict[str, Any]] = None description: Optional[StrictStr] = None - enforce_2fa_at: Optional[datetime] = Field(None, description="Force to all members to have enabled the two factor authentication after that date, unless the value is null") + enforce_2fa_at: Optional[datetime] = Field(default=None, description="Force to all members to have enabled the two factor authentication after that date, unless the value is null") href: Optional[StrictStr] = None - logo: Optional[Union[StrictBytes, StrictStr]] = Field(None, description="The logo for the organization; must be base64-encoded image data") + logo: Optional[Union[StrictBytes, StrictStr]] = Field(default=None, description="The logo for the organization; must be base64-encoded image data") name: Optional[StrictStr] = None twitter: Optional[StrictStr] = None website: Optional[StrictStr] = None - __properties = ["address", "billing_address", "customdata", "description", "enforce_2fa_at", "href", "logo", "name", "twitter", "website"] + __properties: ClassVar[List[str]] = ["address", "billing_address", "customdata", "description", "enforce_2fa_at", "href", "logo", "name", "twitter", "website"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> OrganizationInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of OrganizationInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of address if self.address: _dict['address'] = self.address.to_dict() @@ -72,17 +89,17 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> OrganizationInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of OrganizationInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return OrganizationInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = OrganizationInput.parse_obj({ - "address": Address.from_dict(obj.get("address")) if obj.get("address") is not None else None, - "billing_address": Address.from_dict(obj.get("billing_address")) if obj.get("billing_address") is not None else None, + _obj = cls.model_validate({ + "address": Address.from_dict(obj["address"]) if obj.get("address") is not None else None, + "billing_address": Address.from_dict(obj["billing_address"]) if obj.get("billing_address") is not None else None, "customdata": obj.get("customdata"), "description": obj.get("description"), "enforce_2fa_at": obj.get("enforce_2fa_at"), diff --git a/equinix_metal/equinix_metal/models/organization_list.py b/equinix_metal/equinix_metal/models/organization_list.py index 69a2f021..aa3addba 100644 --- a/equinix_metal/equinix_metal/models/organization_list.py +++ b/equinix_metal/equinix_metal/models/organization_list.py @@ -18,45 +18,61 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.meta import Meta from equinix_metal.models.organization import Organization +from typing import Optional, Set +from typing_extensions import Self class OrganizationList(BaseModel): """ OrganizationList - """ + """ # noqa: E501 href: Optional[StrictStr] = None meta: Optional[Meta] = None - organizations: Optional[conlist(Organization)] = None - __properties = ["href", "meta", "organizations"] + organizations: Optional[List[Organization]] = None + __properties: ClassVar[List[str]] = ["href", "meta", "organizations"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> OrganizationList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of OrganizationList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of meta if self.meta: _dict['meta'] = self.meta.to_dict() @@ -70,18 +86,18 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> OrganizationList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of OrganizationList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return OrganizationList.parse_obj(obj) + return cls.model_validate(obj) - _obj = OrganizationList.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "meta": Meta.from_dict(obj.get("meta")) if obj.get("meta") is not None else None, - "organizations": [Organization.from_dict(_item) for _item in obj.get("organizations")] if obj.get("organizations") is not None else None + "meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None, + "organizations": [Organization.from_dict(_item) for _item in obj["organizations"]] if obj.get("organizations") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/parent_block.py b/equinix_metal/equinix_metal/models/parent_block.py index fa064f35..2efcda55 100644 --- a/equinix_metal/equinix_metal/models/parent_block.py +++ b/equinix_metal/equinix_metal/models/parent_block.py @@ -18,56 +18,72 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class ParentBlock(BaseModel): """ ParentBlock - """ + """ # noqa: E501 cidr: Optional[StrictInt] = None href: Optional[StrictStr] = None netmask: Optional[StrictStr] = None network: Optional[StrictStr] = None - __properties = ["cidr", "href", "netmask", "network"] + __properties: ClassVar[List[str]] = ["cidr", "href", "netmask", "network"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> ParentBlock: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ParentBlock from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> ParentBlock: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ParentBlock from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ParentBlock.parse_obj(obj) + return cls.model_validate(obj) - _obj = ParentBlock.parse_obj({ + _obj = cls.model_validate({ "cidr": obj.get("cidr"), "href": obj.get("href"), "netmask": obj.get("netmask"), diff --git a/equinix_metal/equinix_metal/models/partition.py b/equinix_metal/equinix_metal/models/partition.py index 31d8fd50..ca0f08f6 100644 --- a/equinix_metal/equinix_metal/models/partition.py +++ b/equinix_metal/equinix_metal/models/partition.py @@ -18,56 +18,72 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class Partition(BaseModel): """ Partition - """ + """ # noqa: E501 href: Optional[StrictStr] = None label: Optional[StrictStr] = None number: Optional[StrictInt] = None size: Optional[StrictStr] = None - __properties = ["href", "label", "number", "size"] + __properties: ClassVar[List[str]] = ["href", "label", "number", "size"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> Partition: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Partition from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> Partition: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Partition from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Partition.parse_obj(obj) + return cls.model_validate(obj) - _obj = Partition.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), "label": obj.get("label"), "number": obj.get("number"), diff --git a/equinix_metal/equinix_metal/models/payment_method.py b/equinix_metal/equinix_metal/models/payment_method.py index 59053276..7dd035aa 100644 --- a/equinix_metal/equinix_metal/models/payment_method.py +++ b/equinix_metal/equinix_metal/models/payment_method.py @@ -19,15 +19,17 @@ import json from datetime import datetime -from typing import List, Optional -from pydantic import BaseModel, StrictBool, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.href import Href from equinix_metal.models.payment_method_billing_address import PaymentMethodBillingAddress +from typing import Optional, Set +from typing_extensions import Self class PaymentMethod(BaseModel): """ PaymentMethod - """ + """ # noqa: E501 billing_address: Optional[PaymentMethodBillingAddress] = None card_type: Optional[StrictStr] = None cardholder_name: Optional[StrictStr] = None @@ -41,35 +43,50 @@ class PaymentMethod(BaseModel): id: Optional[StrictStr] = None name: Optional[StrictStr] = None organization: Optional[Href] = None - projects: Optional[conlist(Href)] = None + projects: Optional[List[Href]] = None type: Optional[StrictStr] = None updated_at: Optional[datetime] = None - __properties = ["billing_address", "card_type", "cardholder_name", "created_at", "created_by_user", "default", "email", "expiration_month", "expiration_year", "href", "id", "name", "organization", "projects", "type", "updated_at"] + __properties: ClassVar[List[str]] = ["billing_address", "card_type", "cardholder_name", "created_at", "created_by_user", "default", "email", "expiration_month", "expiration_year", "href", "id", "name", "organization", "projects", "type", "updated_at"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> PaymentMethod: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PaymentMethod from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of billing_address if self.billing_address: _dict['billing_address'] = self.billing_address.to_dict() @@ -89,20 +106,20 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> PaymentMethod: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PaymentMethod from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PaymentMethod.parse_obj(obj) + return cls.model_validate(obj) - _obj = PaymentMethod.parse_obj({ - "billing_address": PaymentMethodBillingAddress.from_dict(obj.get("billing_address")) if obj.get("billing_address") is not None else None, + _obj = cls.model_validate({ + "billing_address": PaymentMethodBillingAddress.from_dict(obj["billing_address"]) if obj.get("billing_address") is not None else None, "card_type": obj.get("card_type"), "cardholder_name": obj.get("cardholder_name"), "created_at": obj.get("created_at"), - "created_by_user": Href.from_dict(obj.get("created_by_user")) if obj.get("created_by_user") is not None else None, + "created_by_user": Href.from_dict(obj["created_by_user"]) if obj.get("created_by_user") is not None else None, "default": obj.get("default"), "email": obj.get("email"), "expiration_month": obj.get("expiration_month"), @@ -110,8 +127,8 @@ def from_dict(cls, obj: dict) -> PaymentMethod: "href": obj.get("href"), "id": obj.get("id"), "name": obj.get("name"), - "organization": Href.from_dict(obj.get("organization")) if obj.get("organization") is not None else None, - "projects": [Href.from_dict(_item) for _item in obj.get("projects")] if obj.get("projects") is not None else None, + "organization": Href.from_dict(obj["organization"]) if obj.get("organization") is not None else None, + "projects": [Href.from_dict(_item) for _item in obj["projects"]] if obj.get("projects") is not None else None, "type": obj.get("type"), "updated_at": obj.get("updated_at") }) diff --git a/equinix_metal/equinix_metal/models/payment_method_billing_address.py b/equinix_metal/equinix_metal/models/payment_method_billing_address.py index 13f4a05a..9d2da80e 100644 --- a/equinix_metal/equinix_metal/models/payment_method_billing_address.py +++ b/equinix_metal/equinix_metal/models/payment_method_billing_address.py @@ -18,56 +18,72 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class PaymentMethodBillingAddress(BaseModel): """ PaymentMethodBillingAddress - """ + """ # noqa: E501 country_code_alpha2: Optional[StrictStr] = None href: Optional[StrictStr] = None postal_code: Optional[StrictStr] = None street_address: Optional[StrictStr] = None - __properties = ["country_code_alpha2", "href", "postal_code", "street_address"] + __properties: ClassVar[List[str]] = ["country_code_alpha2", "href", "postal_code", "street_address"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> PaymentMethodBillingAddress: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PaymentMethodBillingAddress from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> PaymentMethodBillingAddress: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PaymentMethodBillingAddress from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PaymentMethodBillingAddress.parse_obj(obj) + return cls.model_validate(obj) - _obj = PaymentMethodBillingAddress.parse_obj({ + _obj = cls.model_validate({ "country_code_alpha2": obj.get("country_code_alpha2"), "href": obj.get("href"), "postal_code": obj.get("postal_code"), diff --git a/equinix_metal/equinix_metal/models/payment_method_create_input.py b/equinix_metal/equinix_metal/models/payment_method_create_input.py index ad22c9c1..53ba4410 100644 --- a/equinix_metal/equinix_metal/models/payment_method_create_input.py +++ b/equinix_metal/equinix_metal/models/payment_method_create_input.py @@ -18,56 +18,72 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictBool, StrictStr +from pydantic import BaseModel, ConfigDict, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class PaymentMethodCreateInput(BaseModel): """ PaymentMethodCreateInput - """ + """ # noqa: E501 default: Optional[StrictBool] = None href: Optional[StrictStr] = None - name: StrictStr = Field(...) - nonce: StrictStr = Field(...) - __properties = ["default", "href", "name", "nonce"] + name: StrictStr + nonce: StrictStr + __properties: ClassVar[List[str]] = ["default", "href", "name", "nonce"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> PaymentMethodCreateInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PaymentMethodCreateInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> PaymentMethodCreateInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PaymentMethodCreateInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PaymentMethodCreateInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = PaymentMethodCreateInput.parse_obj({ + _obj = cls.model_validate({ "default": obj.get("default"), "href": obj.get("href"), "name": obj.get("name"), diff --git a/equinix_metal/equinix_metal/models/payment_method_list.py b/equinix_metal/equinix_metal/models/payment_method_list.py index f7388f5b..3b83bac0 100644 --- a/equinix_metal/equinix_metal/models/payment_method_list.py +++ b/equinix_metal/equinix_metal/models/payment_method_list.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.payment_method import PaymentMethod +from typing import Optional, Set +from typing_extensions import Self class PaymentMethodList(BaseModel): """ PaymentMethodList - """ + """ # noqa: E501 href: Optional[StrictStr] = None - payment_methods: Optional[conlist(PaymentMethod)] = None - __properties = ["href", "payment_methods"] + payment_methods: Optional[List[PaymentMethod]] = None + __properties: ClassVar[List[str]] = ["href", "payment_methods"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> PaymentMethodList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PaymentMethodList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in payment_methods (list) _items = [] if self.payment_methods: @@ -65,17 +81,17 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> PaymentMethodList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PaymentMethodList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PaymentMethodList.parse_obj(obj) + return cls.model_validate(obj) - _obj = PaymentMethodList.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "payment_methods": [PaymentMethod.from_dict(_item) for _item in obj.get("payment_methods")] if obj.get("payment_methods") is not None else None + "payment_methods": [PaymentMethod.from_dict(_item) for _item in obj["payment_methods"]] if obj.get("payment_methods") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/payment_method_update_input.py b/equinix_metal/equinix_metal/models/payment_method_update_input.py index e9d26499..9b28603b 100644 --- a/equinix_metal/equinix_metal/models/payment_method_update_input.py +++ b/equinix_metal/equinix_metal/models/payment_method_update_input.py @@ -18,14 +18,15 @@ import re # noqa: F401 import json - -from typing import Any, Dict, Optional -from pydantic import BaseModel, StrictBool, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class PaymentMethodUpdateInput(BaseModel): """ PaymentMethodUpdateInput - """ + """ # noqa: E501 billing_address: Optional[Dict[str, Any]] = None cardholder_name: Optional[StrictStr] = None default: Optional[StrictBool] = None @@ -33,44 +34,59 @@ class PaymentMethodUpdateInput(BaseModel): expiration_year: Optional[StrictInt] = None href: Optional[StrictStr] = None name: Optional[StrictStr] = None - __properties = ["billing_address", "cardholder_name", "default", "expiration_month", "expiration_year", "href", "name"] + __properties: ClassVar[List[str]] = ["billing_address", "cardholder_name", "default", "expiration_month", "expiration_year", "href", "name"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> PaymentMethodUpdateInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PaymentMethodUpdateInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> PaymentMethodUpdateInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PaymentMethodUpdateInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PaymentMethodUpdateInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = PaymentMethodUpdateInput.parse_obj({ + _obj = cls.model_validate({ "billing_address": obj.get("billing_address"), "cardholder_name": obj.get("cardholder_name"), "default": obj.get("default"), diff --git a/equinix_metal/equinix_metal/models/plan.py b/equinix_metal/equinix_metal/models/plan.py index 17705ab8..59ec0ad6 100644 --- a/equinix_metal/equinix_metal/models/plan.py +++ b/equinix_metal/equinix_metal/models/plan.py @@ -18,79 +18,96 @@ import re # noqa: F401 import json - -from typing import Any, Dict, List, Optional -from pydantic import BaseModel, Field, StrictBool, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated from equinix_metal.models.plan_available_in_inner import PlanAvailableInInner from equinix_metal.models.plan_available_in_metros_inner import PlanAvailableInMetrosInner from equinix_metal.models.plan_specs import PlanSpecs +from typing import Optional, Set +from typing_extensions import Self class Plan(BaseModel): """ Plan - """ - available_in: Optional[conlist(PlanAvailableInInner)] = Field(None, description="Shows which facilities the plan is available in, and the facility-based price if it is different from the default price.") - available_in_metros: Optional[conlist(PlanAvailableInMetrosInner)] = Field(None, description="Shows which metros the plan is available in, and the metro-based price if it is different from the default price.") - categories: Optional[conlist(StrictStr)] = Field(None, description="Categories of the plan, like compute or storage. A Plan can belong to multiple categories.") - var_class: Optional[StrictStr] = Field(None, alias="class") - deployment_types: Optional[conlist(StrictStr, min_items=0, unique_items=True)] = None + """ # noqa: E501 + available_in: Optional[List[PlanAvailableInInner]] = Field(default=None, description="Shows which facilities the plan is available in, and the facility-based price if it is different from the default price.") + available_in_metros: Optional[List[PlanAvailableInMetrosInner]] = Field(default=None, description="Shows which metros the plan is available in, and the metro-based price if it is different from the default price.") + categories: Optional[List[StrictStr]] = Field(default=None, description="Categories of the plan, like compute or storage. A Plan can belong to multiple categories.") + var_class: Optional[StrictStr] = Field(default=None, alias="class") + deployment_types: Optional[Annotated[List[StrictStr], Field(min_length=0)]] = None description: Optional[StrictStr] = None href: Optional[StrictStr] = None id: Optional[StrictStr] = None - legacy: Optional[StrictBool] = Field(None, description="Deprecated. Always return false") + legacy: Optional[StrictBool] = Field(default=None, description="Deprecated. Always return false") line: Optional[StrictStr] = None name: Optional[StrictStr] = None pricing: Optional[Dict[str, Any]] = None slug: Optional[StrictStr] = None specs: Optional[PlanSpecs] = None - type: Optional[StrictStr] = Field(None, description="The plan type") - __properties = ["available_in", "available_in_metros", "categories", "class", "deployment_types", "description", "href", "id", "legacy", "line", "name", "pricing", "slug", "specs", "type"] + type: Optional[StrictStr] = Field(default=None, description="The plan type") + __properties: ClassVar[List[str]] = ["available_in", "available_in_metros", "categories", "class", "deployment_types", "description", "href", "id", "legacy", "line", "name", "pricing", "slug", "specs", "type"] - @validator('deployment_types') + @field_validator('deployment_types') def deployment_types_validate_enum(cls, value): """Validates the enum""" if value is None: return value for i in value: - if i not in ('on_demand', 'spot_market'): + if i not in set(['on_demand', 'spot_market']): raise ValueError("each list item must be one of ('on_demand', 'spot_market')") return value - @validator('type') + @field_validator('type') def type_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('standard', 'workload_optimized', 'custom'): + if value not in set(['standard', 'workload_optimized', 'custom']): raise ValueError("must be one of enum values ('standard', 'workload_optimized', 'custom')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> Plan: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Plan from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in available_in (list) _items = [] if self.available_in: @@ -111,19 +128,19 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> Plan: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Plan from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Plan.parse_obj(obj) + return cls.model_validate(obj) - _obj = Plan.parse_obj({ - "available_in": [PlanAvailableInInner.from_dict(_item) for _item in obj.get("available_in")] if obj.get("available_in") is not None else None, - "available_in_metros": [PlanAvailableInMetrosInner.from_dict(_item) for _item in obj.get("available_in_metros")] if obj.get("available_in_metros") is not None else None, + _obj = cls.model_validate({ + "available_in": [PlanAvailableInInner.from_dict(_item) for _item in obj["available_in"]] if obj.get("available_in") is not None else None, + "available_in_metros": [PlanAvailableInMetrosInner.from_dict(_item) for _item in obj["available_in_metros"]] if obj.get("available_in_metros") is not None else None, "categories": obj.get("categories"), - "var_class": obj.get("class"), + "class": obj.get("class"), "deployment_types": obj.get("deployment_types"), "description": obj.get("description"), "href": obj.get("href"), @@ -133,7 +150,7 @@ def from_dict(cls, obj: dict) -> Plan: "name": obj.get("name"), "pricing": obj.get("pricing"), "slug": obj.get("slug"), - "specs": PlanSpecs.from_dict(obj.get("specs")) if obj.get("specs") is not None else None, + "specs": PlanSpecs.from_dict(obj["specs"]) if obj.get("specs") is not None else None, "type": obj.get("type") }) return _obj diff --git a/equinix_metal/equinix_metal/models/plan_available_in_inner.py b/equinix_metal/equinix_metal/models/plan_available_in_inner.py index 8cc57826..86d2792a 100644 --- a/equinix_metal/equinix_metal/models/plan_available_in_inner.py +++ b/equinix_metal/equinix_metal/models/plan_available_in_inner.py @@ -18,60 +18,76 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.plan_available_in_inner_price import PlanAvailableInInnerPrice +from typing import Optional, Set +from typing_extensions import Self class PlanAvailableInInner(BaseModel): """ PlanAvailableInInner - """ - href: Optional[StrictStr] = Field(None, description="href to the Facility") + """ # noqa: E501 + href: Optional[StrictStr] = Field(default=None, description="href to the Facility") price: Optional[PlanAvailableInInnerPrice] = None - __properties = ["href", "price"] + __properties: ClassVar[List[str]] = ["href", "price"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> PlanAvailableInInner: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PlanAvailableInInner from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of price if self.price: _dict['price'] = self.price.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> PlanAvailableInInner: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PlanAvailableInInner from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PlanAvailableInInner.parse_obj(obj) + return cls.model_validate(obj) - _obj = PlanAvailableInInner.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "price": PlanAvailableInInnerPrice.from_dict(obj.get("price")) if obj.get("price") is not None else None + "price": PlanAvailableInInnerPrice.from_dict(obj["price"]) if obj.get("price") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/plan_available_in_inner_price.py b/equinix_metal/equinix_metal/models/plan_available_in_inner_price.py index f4320f21..820fbcf4 100644 --- a/equinix_metal/equinix_metal/models/plan_available_in_inner_price.py +++ b/equinix_metal/equinix_metal/models/plan_available_in_inner_price.py @@ -18,54 +18,70 @@ import re # noqa: F401 import json - -from typing import Optional, Union -from pydantic import BaseModel, StrictFloat, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self class PlanAvailableInInnerPrice(BaseModel): """ PlanAvailableInInnerPrice - """ + """ # noqa: E501 hour: Optional[Union[StrictFloat, StrictInt]] = None href: Optional[StrictStr] = None - __properties = ["hour", "href"] + __properties: ClassVar[List[str]] = ["hour", "href"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> PlanAvailableInInnerPrice: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PlanAvailableInInnerPrice from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> PlanAvailableInInnerPrice: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PlanAvailableInInnerPrice from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PlanAvailableInInnerPrice.parse_obj(obj) + return cls.model_validate(obj) - _obj = PlanAvailableInInnerPrice.parse_obj({ + _obj = cls.model_validate({ "hour": obj.get("hour"), "href": obj.get("href") }) diff --git a/equinix_metal/equinix_metal/models/plan_available_in_metros_inner.py b/equinix_metal/equinix_metal/models/plan_available_in_metros_inner.py index 2ca866b7..15475765 100644 --- a/equinix_metal/equinix_metal/models/plan_available_in_metros_inner.py +++ b/equinix_metal/equinix_metal/models/plan_available_in_metros_inner.py @@ -18,60 +18,76 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.plan_available_in_inner_price import PlanAvailableInInnerPrice +from typing import Optional, Set +from typing_extensions import Self class PlanAvailableInMetrosInner(BaseModel): """ PlanAvailableInMetrosInner - """ - href: Optional[StrictStr] = Field(None, description="href to the Metro") + """ # noqa: E501 + href: Optional[StrictStr] = Field(default=None, description="href to the Metro") price: Optional[PlanAvailableInInnerPrice] = None - __properties = ["href", "price"] + __properties: ClassVar[List[str]] = ["href", "price"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> PlanAvailableInMetrosInner: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PlanAvailableInMetrosInner from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of price if self.price: _dict['price'] = self.price.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> PlanAvailableInMetrosInner: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PlanAvailableInMetrosInner from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PlanAvailableInMetrosInner.parse_obj(obj) + return cls.model_validate(obj) - _obj = PlanAvailableInMetrosInner.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "price": PlanAvailableInInnerPrice.from_dict(obj.get("price")) if obj.get("price") is not None else None + "price": PlanAvailableInInnerPrice.from_dict(obj["price"]) if obj.get("price") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/plan_list.py b/equinix_metal/equinix_metal/models/plan_list.py index c25081df..b570a0bf 100644 --- a/equinix_metal/equinix_metal/models/plan_list.py +++ b/equinix_metal/equinix_metal/models/plan_list.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.plan import Plan +from typing import Optional, Set +from typing_extensions import Self class PlanList(BaseModel): """ PlanList - """ + """ # noqa: E501 href: Optional[StrictStr] = None - plans: Optional[conlist(Plan)] = None - __properties = ["href", "plans"] + plans: Optional[List[Plan]] = None + __properties: ClassVar[List[str]] = ["href", "plans"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> PlanList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PlanList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in plans (list) _items = [] if self.plans: @@ -65,17 +81,17 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> PlanList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PlanList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PlanList.parse_obj(obj) + return cls.model_validate(obj) - _obj = PlanList.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "plans": [Plan.from_dict(_item) for _item in obj.get("plans")] if obj.get("plans") is not None else None + "plans": [Plan.from_dict(_item) for _item in obj["plans"]] if obj.get("plans") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/plan_specs.py b/equinix_metal/equinix_metal/models/plan_specs.py index c9221cfc..0a0c2089 100644 --- a/equinix_metal/equinix_metal/models/plan_specs.py +++ b/equinix_metal/equinix_metal/models/plan_specs.py @@ -18,51 +18,67 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.plan_specs_cpus_inner import PlanSpecsCpusInner from equinix_metal.models.plan_specs_drives_inner import PlanSpecsDrivesInner from equinix_metal.models.plan_specs_features import PlanSpecsFeatures from equinix_metal.models.plan_specs_memory import PlanSpecsMemory from equinix_metal.models.plan_specs_nics_inner import PlanSpecsNicsInner +from typing import Optional, Set +from typing_extensions import Self class PlanSpecs(BaseModel): """ PlanSpecs - """ - cpus: Optional[conlist(PlanSpecsCpusInner)] = None - drives: Optional[conlist(PlanSpecsDrivesInner)] = None + """ # noqa: E501 + cpus: Optional[List[PlanSpecsCpusInner]] = None + drives: Optional[List[PlanSpecsDrivesInner]] = None features: Optional[PlanSpecsFeatures] = None href: Optional[StrictStr] = None memory: Optional[PlanSpecsMemory] = None - nics: Optional[conlist(PlanSpecsNicsInner)] = None - __properties = ["cpus", "drives", "features", "href", "memory", "nics"] + nics: Optional[List[PlanSpecsNicsInner]] = None + __properties: ClassVar[List[str]] = ["cpus", "drives", "features", "href", "memory", "nics"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> PlanSpecs: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PlanSpecs from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in cpus (list) _items = [] if self.cpus: @@ -93,21 +109,21 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> PlanSpecs: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PlanSpecs from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PlanSpecs.parse_obj(obj) + return cls.model_validate(obj) - _obj = PlanSpecs.parse_obj({ - "cpus": [PlanSpecsCpusInner.from_dict(_item) for _item in obj.get("cpus")] if obj.get("cpus") is not None else None, - "drives": [PlanSpecsDrivesInner.from_dict(_item) for _item in obj.get("drives")] if obj.get("drives") is not None else None, - "features": PlanSpecsFeatures.from_dict(obj.get("features")) if obj.get("features") is not None else None, + _obj = cls.model_validate({ + "cpus": [PlanSpecsCpusInner.from_dict(_item) for _item in obj["cpus"]] if obj.get("cpus") is not None else None, + "drives": [PlanSpecsDrivesInner.from_dict(_item) for _item in obj["drives"]] if obj.get("drives") is not None else None, + "features": PlanSpecsFeatures.from_dict(obj["features"]) if obj.get("features") is not None else None, "href": obj.get("href"), - "memory": PlanSpecsMemory.from_dict(obj.get("memory")) if obj.get("memory") is not None else None, - "nics": [PlanSpecsNicsInner.from_dict(_item) for _item in obj.get("nics")] if obj.get("nics") is not None else None + "memory": PlanSpecsMemory.from_dict(obj["memory"]) if obj.get("memory") is not None else None, + "nics": [PlanSpecsNicsInner.from_dict(_item) for _item in obj["nics"]] if obj.get("nics") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/plan_specs_cpus_inner.py b/equinix_metal/equinix_metal/models/plan_specs_cpus_inner.py index 8c7bbdac..d11c7b96 100644 --- a/equinix_metal/equinix_metal/models/plan_specs_cpus_inner.py +++ b/equinix_metal/equinix_metal/models/plan_specs_cpus_inner.py @@ -18,55 +18,71 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class PlanSpecsCpusInner(BaseModel): """ PlanSpecsCpusInner - """ + """ # noqa: E501 count: Optional[StrictInt] = None href: Optional[StrictStr] = None type: Optional[StrictStr] = None - __properties = ["count", "href", "type"] + __properties: ClassVar[List[str]] = ["count", "href", "type"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> PlanSpecsCpusInner: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PlanSpecsCpusInner from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> PlanSpecsCpusInner: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PlanSpecsCpusInner from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PlanSpecsCpusInner.parse_obj(obj) + return cls.model_validate(obj) - _obj = PlanSpecsCpusInner.parse_obj({ + _obj = cls.model_validate({ "count": obj.get("count"), "href": obj.get("href"), "type": obj.get("type") diff --git a/equinix_metal/equinix_metal/models/plan_specs_drives_inner.py b/equinix_metal/equinix_metal/models/plan_specs_drives_inner.py index 71f8399f..46f3067a 100644 --- a/equinix_metal/equinix_metal/models/plan_specs_drives_inner.py +++ b/equinix_metal/equinix_metal/models/plan_specs_drives_inner.py @@ -18,67 +18,83 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictInt, StrictStr, validator +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class PlanSpecsDrivesInner(BaseModel): """ PlanSpecsDrivesInner - """ + """ # noqa: E501 category: Optional[StrictStr] = None count: Optional[StrictInt] = None href: Optional[StrictStr] = None size: Optional[StrictStr] = None type: Optional[StrictStr] = None - __properties = ["category", "count", "href", "size", "type"] + __properties: ClassVar[List[str]] = ["category", "count", "href", "size", "type"] - @validator('category') + @field_validator('category') def category_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('boot', 'cache', 'storage'): + if value not in set(['boot', 'cache', 'storage']): raise ValueError("must be one of enum values ('boot', 'cache', 'storage')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> PlanSpecsDrivesInner: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PlanSpecsDrivesInner from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> PlanSpecsDrivesInner: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PlanSpecsDrivesInner from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PlanSpecsDrivesInner.parse_obj(obj) + return cls.model_validate(obj) - _obj = PlanSpecsDrivesInner.parse_obj({ + _obj = cls.model_validate({ "category": obj.get("category"), "count": obj.get("count"), "href": obj.get("href"), diff --git a/equinix_metal/equinix_metal/models/plan_specs_features.py b/equinix_metal/equinix_metal/models/plan_specs_features.py index 1ba6705b..69406fd7 100644 --- a/equinix_metal/equinix_metal/models/plan_specs_features.py +++ b/equinix_metal/equinix_metal/models/plan_specs_features.py @@ -18,56 +18,72 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictBool, StrictStr +from pydantic import BaseModel, ConfigDict, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class PlanSpecsFeatures(BaseModel): """ PlanSpecsFeatures - """ + """ # noqa: E501 href: Optional[StrictStr] = None raid: Optional[StrictBool] = None txt: Optional[StrictBool] = None uefi: Optional[StrictBool] = None - __properties = ["href", "raid", "txt", "uefi"] + __properties: ClassVar[List[str]] = ["href", "raid", "txt", "uefi"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> PlanSpecsFeatures: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PlanSpecsFeatures from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> PlanSpecsFeatures: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PlanSpecsFeatures from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PlanSpecsFeatures.parse_obj(obj) + return cls.model_validate(obj) - _obj = PlanSpecsFeatures.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), "raid": obj.get("raid"), "txt": obj.get("txt"), diff --git a/equinix_metal/equinix_metal/models/plan_specs_memory.py b/equinix_metal/equinix_metal/models/plan_specs_memory.py index 8f8013a7..6df0cf4d 100644 --- a/equinix_metal/equinix_metal/models/plan_specs_memory.py +++ b/equinix_metal/equinix_metal/models/plan_specs_memory.py @@ -18,54 +18,70 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class PlanSpecsMemory(BaseModel): """ PlanSpecsMemory - """ + """ # noqa: E501 href: Optional[StrictStr] = None total: Optional[StrictStr] = None - __properties = ["href", "total"] + __properties: ClassVar[List[str]] = ["href", "total"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> PlanSpecsMemory: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PlanSpecsMemory from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> PlanSpecsMemory: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PlanSpecsMemory from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PlanSpecsMemory.parse_obj(obj) + return cls.model_validate(obj) - _obj = PlanSpecsMemory.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), "total": obj.get("total") }) diff --git a/equinix_metal/equinix_metal/models/plan_specs_nics_inner.py b/equinix_metal/equinix_metal/models/plan_specs_nics_inner.py index 694acfcc..368e9ec5 100644 --- a/equinix_metal/equinix_metal/models/plan_specs_nics_inner.py +++ b/equinix_metal/equinix_metal/models/plan_specs_nics_inner.py @@ -18,55 +18,71 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class PlanSpecsNicsInner(BaseModel): """ PlanSpecsNicsInner - """ + """ # noqa: E501 count: Optional[StrictInt] = None href: Optional[StrictStr] = None type: Optional[StrictStr] = None - __properties = ["count", "href", "type"] + __properties: ClassVar[List[str]] = ["count", "href", "type"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> PlanSpecsNicsInner: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PlanSpecsNicsInner from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> PlanSpecsNicsInner: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PlanSpecsNicsInner from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PlanSpecsNicsInner.parse_obj(obj) + return cls.model_validate(obj) - _obj = PlanSpecsNicsInner.parse_obj({ + _obj = cls.model_validate({ "count": obj.get("count"), "href": obj.get("href"), "type": obj.get("type") diff --git a/equinix_metal/equinix_metal/models/port.py b/equinix_metal/equinix_metal/models/port.py index daa3776b..ae9bf38b 100644 --- a/equinix_metal/equinix_metal/models/port.py +++ b/equinix_metal/equinix_metal/models/port.py @@ -18,74 +18,90 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictBool, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.bond_port_data import BondPortData from equinix_metal.models.href import Href from equinix_metal.models.port_data import PortData from equinix_metal.models.virtual_network import VirtualNetwork +from typing import Optional, Set +from typing_extensions import Self class Port(BaseModel): """ Port is a hardware port associated with a reserved or instantiated hardware device. - """ + """ # noqa: E501 bond: Optional[BondPortData] = None data: Optional[PortData] = None - disbond_operation_supported: Optional[StrictBool] = Field(None, description="Indicates whether or not the bond can be broken on the port (when applicable).") + disbond_operation_supported: Optional[StrictBool] = Field(default=None, description="Indicates whether or not the bond can be broken on the port (when applicable).") href: Optional[StrictStr] = None id: Optional[StrictStr] = None name: Optional[StrictStr] = None native_virtual_network: Optional[VirtualNetwork] = None - network_type: Optional[StrictStr] = Field(None, description="Composite network type of the bond") - type: Optional[StrictStr] = Field(None, description="Type is either \"NetworkBondPort\" for bond ports or \"NetworkPort\" for bondable ethernet ports") - virtual_networks: Optional[conlist(Href)] = None - __properties = ["bond", "data", "disbond_operation_supported", "href", "id", "name", "native_virtual_network", "network_type", "type", "virtual_networks"] + network_type: Optional[StrictStr] = Field(default=None, description="Composite network type of the bond") + type: Optional[StrictStr] = Field(default=None, description="Type is either \"NetworkBondPort\" for bond ports or \"NetworkPort\" for bondable ethernet ports") + virtual_networks: Optional[List[Href]] = None + __properties: ClassVar[List[str]] = ["bond", "data", "disbond_operation_supported", "href", "id", "name", "native_virtual_network", "network_type", "type", "virtual_networks"] - @validator('network_type') + @field_validator('network_type') def network_type_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('layer2-bonded', 'layer2-individual', 'layer3', 'hybrid', 'hybrid-bonded'): + if value not in set(['layer2-bonded', 'layer2-individual', 'layer3', 'hybrid', 'hybrid-bonded']): raise ValueError("must be one of enum values ('layer2-bonded', 'layer2-individual', 'layer3', 'hybrid', 'hybrid-bonded')") return value - @validator('type') + @field_validator('type') def type_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('NetworkPort', 'NetworkBondPort'): + if value not in set(['NetworkPort', 'NetworkBondPort']): raise ValueError("must be one of enum values ('NetworkPort', 'NetworkBondPort')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> Port: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Port from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of bond if self.bond: _dict['bond'] = self.bond.to_dict() @@ -105,25 +121,25 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> Port: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Port from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Port.parse_obj(obj) + return cls.model_validate(obj) - _obj = Port.parse_obj({ - "bond": BondPortData.from_dict(obj.get("bond")) if obj.get("bond") is not None else None, - "data": PortData.from_dict(obj.get("data")) if obj.get("data") is not None else None, + _obj = cls.model_validate({ + "bond": BondPortData.from_dict(obj["bond"]) if obj.get("bond") is not None else None, + "data": PortData.from_dict(obj["data"]) if obj.get("data") is not None else None, "disbond_operation_supported": obj.get("disbond_operation_supported"), "href": obj.get("href"), "id": obj.get("id"), "name": obj.get("name"), - "native_virtual_network": VirtualNetwork.from_dict(obj.get("native_virtual_network")) if obj.get("native_virtual_network") is not None else None, + "native_virtual_network": VirtualNetwork.from_dict(obj["native_virtual_network"]) if obj.get("native_virtual_network") is not None else None, "network_type": obj.get("network_type"), "type": obj.get("type"), - "virtual_networks": [Href.from_dict(_item) for _item in obj.get("virtual_networks")] if obj.get("virtual_networks") is not None else None + "virtual_networks": [Href.from_dict(_item) for _item in obj["virtual_networks"]] if obj.get("virtual_networks") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/port_assign_input.py b/equinix_metal/equinix_metal/models/port_assign_input.py index 0f707375..cd5027f0 100644 --- a/equinix_metal/equinix_metal/models/port_assign_input.py +++ b/equinix_metal/equinix_metal/models/port_assign_input.py @@ -18,54 +18,70 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class PortAssignInput(BaseModel): """ PortAssignInput - """ + """ # noqa: E501 href: Optional[StrictStr] = None - vnid: Optional[StrictStr] = Field(None, description="Virtual Network ID. May be the UUID of the Virtual Network record, or the VLAN value itself. ") - __properties = ["href", "vnid"] + vnid: Optional[StrictStr] = Field(default=None, description="Virtual Network ID. May be the UUID of the Virtual Network record, or the VLAN value itself. ") + __properties: ClassVar[List[str]] = ["href", "vnid"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> PortAssignInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PortAssignInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> PortAssignInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PortAssignInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PortAssignInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = PortAssignInput.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), "vnid": obj.get("vnid") }) diff --git a/equinix_metal/equinix_metal/models/port_convert_layer3_input.py b/equinix_metal/equinix_metal/models/port_convert_layer3_input.py index 48d04746..a85b7400 100644 --- a/equinix_metal/equinix_metal/models/port_convert_layer3_input.py +++ b/equinix_metal/equinix_metal/models/port_convert_layer3_input.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.port_convert_layer3_input_request_ips_inner import PortConvertLayer3InputRequestIpsInner +from typing import Optional, Set +from typing_extensions import Self class PortConvertLayer3Input(BaseModel): """ PortConvertLayer3Input - """ + """ # noqa: E501 href: Optional[StrictStr] = None - request_ips: Optional[conlist(PortConvertLayer3InputRequestIpsInner)] = None - __properties = ["href", "request_ips"] + request_ips: Optional[List[PortConvertLayer3InputRequestIpsInner]] = None + __properties: ClassVar[List[str]] = ["href", "request_ips"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> PortConvertLayer3Input: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PortConvertLayer3Input from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in request_ips (list) _items = [] if self.request_ips: @@ -65,17 +81,17 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> PortConvertLayer3Input: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PortConvertLayer3Input from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PortConvertLayer3Input.parse_obj(obj) + return cls.model_validate(obj) - _obj = PortConvertLayer3Input.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "request_ips": [PortConvertLayer3InputRequestIpsInner.from_dict(_item) for _item in obj.get("request_ips")] if obj.get("request_ips") is not None else None + "request_ips": [PortConvertLayer3InputRequestIpsInner.from_dict(_item) for _item in obj["request_ips"]] if obj.get("request_ips") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/port_convert_layer3_input_request_ips_inner.py b/equinix_metal/equinix_metal/models/port_convert_layer3_input_request_ips_inner.py index 6f501ed9..87091411 100644 --- a/equinix_metal/equinix_metal/models/port_convert_layer3_input_request_ips_inner.py +++ b/equinix_metal/equinix_metal/models/port_convert_layer3_input_request_ips_inner.py @@ -18,55 +18,71 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictBool, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class PortConvertLayer3InputRequestIpsInner(BaseModel): """ PortConvertLayer3InputRequestIpsInner - """ + """ # noqa: E501 address_family: Optional[StrictInt] = None href: Optional[StrictStr] = None public: Optional[StrictBool] = None - __properties = ["address_family", "href", "public"] + __properties: ClassVar[List[str]] = ["address_family", "href", "public"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> PortConvertLayer3InputRequestIpsInner: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PortConvertLayer3InputRequestIpsInner from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> PortConvertLayer3InputRequestIpsInner: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PortConvertLayer3InputRequestIpsInner from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PortConvertLayer3InputRequestIpsInner.parse_obj(obj) + return cls.model_validate(obj) - _obj = PortConvertLayer3InputRequestIpsInner.parse_obj({ + _obj = cls.model_validate({ "address_family": obj.get("address_family"), "href": obj.get("href"), "public": obj.get("public") diff --git a/equinix_metal/equinix_metal/models/port_data.py b/equinix_metal/equinix_metal/models/port_data.py index 9c95c2fc..f15786d5 100644 --- a/equinix_metal/equinix_metal/models/port_data.py +++ b/equinix_metal/equinix_metal/models/port_data.py @@ -18,55 +18,71 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictBool, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class PortData(BaseModel): """ PortData - """ - bonded: Optional[StrictBool] = Field(None, description="Bonded is true for NetworkPort ports in a bond and NetworkBondPort ports that are active") + """ # noqa: E501 + bonded: Optional[StrictBool] = Field(default=None, description="Bonded is true for NetworkPort ports in a bond and NetworkBondPort ports that are active") href: Optional[StrictStr] = None - mac: Optional[StrictStr] = Field(None, description="MAC address is set for NetworkPort ports") - __properties = ["bonded", "href", "mac"] + mac: Optional[StrictStr] = Field(default=None, description="MAC address is set for NetworkPort ports") + __properties: ClassVar[List[str]] = ["bonded", "href", "mac"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> PortData: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PortData from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> PortData: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PortData from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PortData.parse_obj(obj) + return cls.model_validate(obj) - _obj = PortData.parse_obj({ + _obj = cls.model_validate({ "bonded": obj.get("bonded"), "href": obj.get("href"), "mac": obj.get("mac") diff --git a/equinix_metal/equinix_metal/models/port_vlan_assignment.py b/equinix_metal/equinix_metal/models/port_vlan_assignment.py index 7cc8aaf7..a48a6fe0 100644 --- a/equinix_metal/equinix_metal/models/port_vlan_assignment.py +++ b/equinix_metal/equinix_metal/models/port_vlan_assignment.py @@ -19,14 +19,16 @@ import json from datetime import datetime -from typing import Optional -from pydantic import BaseModel, StrictBool, StrictInt, StrictStr, validator +from pydantic import BaseModel, ConfigDict, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.href import Href +from typing import Optional, Set +from typing_extensions import Self class PortVlanAssignment(BaseModel): """ PortVlanAssignment - """ + """ # noqa: E501 created_at: Optional[datetime] = None href: Optional[StrictStr] = None id: Optional[StrictStr] = None @@ -36,42 +38,57 @@ class PortVlanAssignment(BaseModel): updated_at: Optional[datetime] = None virtual_network: Optional[Href] = None vlan: Optional[StrictInt] = None - __properties = ["created_at", "href", "id", "native", "port", "state", "updated_at", "virtual_network", "vlan"] + __properties: ClassVar[List[str]] = ["created_at", "href", "id", "native", "port", "state", "updated_at", "virtual_network", "vlan"] - @validator('state') + @field_validator('state') def state_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('assigned', 'unassigning'): + if value not in set(['assigned', 'unassigning']): raise ValueError("must be one of enum values ('assigned', 'unassigning')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> PortVlanAssignment: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PortVlanAssignment from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of port if self.port: _dict['port'] = self.port.to_dict() @@ -81,23 +98,23 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> PortVlanAssignment: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PortVlanAssignment from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PortVlanAssignment.parse_obj(obj) + return cls.model_validate(obj) - _obj = PortVlanAssignment.parse_obj({ + _obj = cls.model_validate({ "created_at": obj.get("created_at"), "href": obj.get("href"), "id": obj.get("id"), "native": obj.get("native"), - "port": Href.from_dict(obj.get("port")) if obj.get("port") is not None else None, + "port": Href.from_dict(obj["port"]) if obj.get("port") is not None else None, "state": obj.get("state"), "updated_at": obj.get("updated_at"), - "virtual_network": Href.from_dict(obj.get("virtual_network")) if obj.get("virtual_network") is not None else None, + "virtual_network": Href.from_dict(obj["virtual_network"]) if obj.get("virtual_network") is not None else None, "vlan": obj.get("vlan") }) return _obj diff --git a/equinix_metal/equinix_metal/models/port_vlan_assignment_batch.py b/equinix_metal/equinix_metal/models/port_vlan_assignment_batch.py index 0824e471..3bba9eee 100644 --- a/equinix_metal/equinix_metal/models/port_vlan_assignment_batch.py +++ b/equinix_metal/equinix_metal/models/port_vlan_assignment_batch.py @@ -19,18 +19,20 @@ import json from datetime import datetime -from typing import List, Optional -from pydantic import BaseModel, StrictInt, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.href import Href from equinix_metal.models.port import Port from equinix_metal.models.port_vlan_assignment_batch_vlan_assignments_inner import PortVlanAssignmentBatchVlanAssignmentsInner +from typing import Optional, Set +from typing_extensions import Self class PortVlanAssignmentBatch(BaseModel): """ PortVlanAssignmentBatch - """ + """ # noqa: E501 created_at: Optional[datetime] = None - error_messages: Optional[conlist(StrictStr)] = None + error_messages: Optional[List[StrictStr]] = None href: Optional[StrictStr] = None id: Optional[StrictStr] = None port: Optional[Port] = None @@ -38,43 +40,58 @@ class PortVlanAssignmentBatch(BaseModel): quantity: Optional[StrictInt] = None state: Optional[StrictStr] = None updated_at: Optional[datetime] = None - vlan_assignments: Optional[conlist(PortVlanAssignmentBatchVlanAssignmentsInner)] = None - __properties = ["created_at", "error_messages", "href", "id", "port", "project", "quantity", "state", "updated_at", "vlan_assignments"] + vlan_assignments: Optional[List[PortVlanAssignmentBatchVlanAssignmentsInner]] = None + __properties: ClassVar[List[str]] = ["created_at", "error_messages", "href", "id", "port", "project", "quantity", "state", "updated_at", "vlan_assignments"] - @validator('state') + @field_validator('state') def state_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('queued', 'in_progress', 'completed', 'failed'): + if value not in set(['queued', 'in_progress', 'completed', 'failed']): raise ValueError("must be one of enum values ('queued', 'in_progress', 'completed', 'failed')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> PortVlanAssignmentBatch: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PortVlanAssignmentBatch from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of port if self.port: _dict['port'] = self.port.to_dict() @@ -91,25 +108,25 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> PortVlanAssignmentBatch: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PortVlanAssignmentBatch from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PortVlanAssignmentBatch.parse_obj(obj) + return cls.model_validate(obj) - _obj = PortVlanAssignmentBatch.parse_obj({ + _obj = cls.model_validate({ "created_at": obj.get("created_at"), "error_messages": obj.get("error_messages"), "href": obj.get("href"), "id": obj.get("id"), - "port": Port.from_dict(obj.get("port")) if obj.get("port") is not None else None, - "project": Href.from_dict(obj.get("project")) if obj.get("project") is not None else None, + "port": Port.from_dict(obj["port"]) if obj.get("port") is not None else None, + "project": Href.from_dict(obj["project"]) if obj.get("project") is not None else None, "quantity": obj.get("quantity"), "state": obj.get("state"), "updated_at": obj.get("updated_at"), - "vlan_assignments": [PortVlanAssignmentBatchVlanAssignmentsInner.from_dict(_item) for _item in obj.get("vlan_assignments")] if obj.get("vlan_assignments") is not None else None + "vlan_assignments": [PortVlanAssignmentBatchVlanAssignmentsInner.from_dict(_item) for _item in obj["vlan_assignments"]] if obj.get("vlan_assignments") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/port_vlan_assignment_batch_create_input.py b/equinix_metal/equinix_metal/models/port_vlan_assignment_batch_create_input.py index 6a2729e2..fc92efc5 100644 --- a/equinix_metal/equinix_metal/models/port_vlan_assignment_batch_create_input.py +++ b/equinix_metal/equinix_metal/models/port_vlan_assignment_batch_create_input.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.port_vlan_assignment_batch_create_input_vlan_assignments_inner import PortVlanAssignmentBatchCreateInputVlanAssignmentsInner +from typing import Optional, Set +from typing_extensions import Self class PortVlanAssignmentBatchCreateInput(BaseModel): """ PortVlanAssignmentBatchCreateInput - """ + """ # noqa: E501 href: Optional[StrictStr] = None - vlan_assignments: Optional[conlist(PortVlanAssignmentBatchCreateInputVlanAssignmentsInner)] = None - __properties = ["href", "vlan_assignments"] + vlan_assignments: Optional[List[PortVlanAssignmentBatchCreateInputVlanAssignmentsInner]] = None + __properties: ClassVar[List[str]] = ["href", "vlan_assignments"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> PortVlanAssignmentBatchCreateInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PortVlanAssignmentBatchCreateInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in vlan_assignments (list) _items = [] if self.vlan_assignments: @@ -65,17 +81,17 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> PortVlanAssignmentBatchCreateInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PortVlanAssignmentBatchCreateInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PortVlanAssignmentBatchCreateInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = PortVlanAssignmentBatchCreateInput.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "vlan_assignments": [PortVlanAssignmentBatchCreateInputVlanAssignmentsInner.from_dict(_item) for _item in obj.get("vlan_assignments")] if obj.get("vlan_assignments") is not None else None + "vlan_assignments": [PortVlanAssignmentBatchCreateInputVlanAssignmentsInner.from_dict(_item) for _item in obj["vlan_assignments"]] if obj.get("vlan_assignments") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/port_vlan_assignment_batch_create_input_vlan_assignments_inner.py b/equinix_metal/equinix_metal/models/port_vlan_assignment_batch_create_input_vlan_assignments_inner.py index 8b8eb213..c5ea21be 100644 --- a/equinix_metal/equinix_metal/models/port_vlan_assignment_batch_create_input_vlan_assignments_inner.py +++ b/equinix_metal/equinix_metal/models/port_vlan_assignment_batch_create_input_vlan_assignments_inner.py @@ -18,66 +18,82 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictBool, StrictStr, validator +from pydantic import BaseModel, ConfigDict, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class PortVlanAssignmentBatchCreateInputVlanAssignmentsInner(BaseModel): """ PortVlanAssignmentBatchCreateInputVlanAssignmentsInner - """ + """ # noqa: E501 href: Optional[StrictStr] = None native: Optional[StrictBool] = None state: Optional[StrictStr] = None vlan: Optional[StrictStr] = None - __properties = ["href", "native", "state", "vlan"] + __properties: ClassVar[List[str]] = ["href", "native", "state", "vlan"] - @validator('state') + @field_validator('state') def state_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('assigned', 'unassigned'): + if value not in set(['assigned', 'unassigned']): raise ValueError("must be one of enum values ('assigned', 'unassigned')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> PortVlanAssignmentBatchCreateInputVlanAssignmentsInner: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PortVlanAssignmentBatchCreateInputVlanAssignmentsInner from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> PortVlanAssignmentBatchCreateInputVlanAssignmentsInner: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PortVlanAssignmentBatchCreateInputVlanAssignmentsInner from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PortVlanAssignmentBatchCreateInputVlanAssignmentsInner.parse_obj(obj) + return cls.model_validate(obj) - _obj = PortVlanAssignmentBatchCreateInputVlanAssignmentsInner.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), "native": obj.get("native"), "state": obj.get("state"), diff --git a/equinix_metal/equinix_metal/models/port_vlan_assignment_batch_list.py b/equinix_metal/equinix_metal/models/port_vlan_assignment_batch_list.py index 818cda9b..970df34a 100644 --- a/equinix_metal/equinix_metal/models/port_vlan_assignment_batch_list.py +++ b/equinix_metal/equinix_metal/models/port_vlan_assignment_batch_list.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.port_vlan_assignment_batch import PortVlanAssignmentBatch +from typing import Optional, Set +from typing_extensions import Self class PortVlanAssignmentBatchList(BaseModel): """ PortVlanAssignmentBatchList - """ - batches: Optional[conlist(PortVlanAssignmentBatch)] = None + """ # noqa: E501 + batches: Optional[List[PortVlanAssignmentBatch]] = None href: Optional[StrictStr] = None - __properties = ["batches", "href"] + __properties: ClassVar[List[str]] = ["batches", "href"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> PortVlanAssignmentBatchList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PortVlanAssignmentBatchList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in batches (list) _items = [] if self.batches: @@ -65,16 +81,16 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> PortVlanAssignmentBatchList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PortVlanAssignmentBatchList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PortVlanAssignmentBatchList.parse_obj(obj) + return cls.model_validate(obj) - _obj = PortVlanAssignmentBatchList.parse_obj({ - "batches": [PortVlanAssignmentBatch.from_dict(_item) for _item in obj.get("batches")] if obj.get("batches") is not None else None, + _obj = cls.model_validate({ + "batches": [PortVlanAssignmentBatch.from_dict(_item) for _item in obj["batches"]] if obj.get("batches") is not None else None, "href": obj.get("href") }) return _obj diff --git a/equinix_metal/equinix_metal/models/port_vlan_assignment_batch_vlan_assignments_inner.py b/equinix_metal/equinix_metal/models/port_vlan_assignment_batch_vlan_assignments_inner.py index 7215503f..378c203b 100644 --- a/equinix_metal/equinix_metal/models/port_vlan_assignment_batch_vlan_assignments_inner.py +++ b/equinix_metal/equinix_metal/models/port_vlan_assignment_batch_vlan_assignments_inner.py @@ -18,67 +18,83 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictBool, StrictInt, StrictStr, validator +from pydantic import BaseModel, ConfigDict, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class PortVlanAssignmentBatchVlanAssignmentsInner(BaseModel): """ PortVlanAssignmentBatchVlanAssignmentsInner - """ + """ # noqa: E501 href: Optional[StrictStr] = None id: Optional[StrictStr] = None native: Optional[StrictBool] = None state: Optional[StrictStr] = None vlan: Optional[StrictInt] = None - __properties = ["href", "id", "native", "state", "vlan"] + __properties: ClassVar[List[str]] = ["href", "id", "native", "state", "vlan"] - @validator('state') + @field_validator('state') def state_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('assigned', 'unassigned'): + if value not in set(['assigned', 'unassigned']): raise ValueError("must be one of enum values ('assigned', 'unassigned')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> PortVlanAssignmentBatchVlanAssignmentsInner: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PortVlanAssignmentBatchVlanAssignmentsInner from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> PortVlanAssignmentBatchVlanAssignmentsInner: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PortVlanAssignmentBatchVlanAssignmentsInner from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PortVlanAssignmentBatchVlanAssignmentsInner.parse_obj(obj) + return cls.model_validate(obj) - _obj = PortVlanAssignmentBatchVlanAssignmentsInner.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), "id": obj.get("id"), "native": obj.get("native"), diff --git a/equinix_metal/equinix_metal/models/port_vlan_assignment_list.py b/equinix_metal/equinix_metal/models/port_vlan_assignment_list.py index afd6d79f..f10ffbd6 100644 --- a/equinix_metal/equinix_metal/models/port_vlan_assignment_list.py +++ b/equinix_metal/equinix_metal/models/port_vlan_assignment_list.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.port_vlan_assignment import PortVlanAssignment +from typing import Optional, Set +from typing_extensions import Self class PortVlanAssignmentList(BaseModel): """ PortVlanAssignmentList - """ + """ # noqa: E501 href: Optional[StrictStr] = None - vlan_assignments: Optional[conlist(PortVlanAssignment)] = None - __properties = ["href", "vlan_assignments"] + vlan_assignments: Optional[List[PortVlanAssignment]] = None + __properties: ClassVar[List[str]] = ["href", "vlan_assignments"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> PortVlanAssignmentList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PortVlanAssignmentList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in vlan_assignments (list) _items = [] if self.vlan_assignments: @@ -65,17 +81,17 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> PortVlanAssignmentList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PortVlanAssignmentList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PortVlanAssignmentList.parse_obj(obj) + return cls.model_validate(obj) - _obj = PortVlanAssignmentList.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "vlan_assignments": [PortVlanAssignment.from_dict(_item) for _item in obj.get("vlan_assignments")] if obj.get("vlan_assignments") is not None else None + "vlan_assignments": [PortVlanAssignment.from_dict(_item) for _item in obj["vlan_assignments"]] if obj.get("vlan_assignments") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/project.py b/equinix_metal/equinix_metal/models/project.py index b583f071..b8e5b8ec 100644 --- a/equinix_metal/equinix_metal/models/project.py +++ b/equinix_metal/equinix_metal/models/project.py @@ -19,70 +19,88 @@ import json from datetime import datetime -from typing import Any, Dict, List, Optional -from pydantic import BaseModel, Field, StrictBool, StrictStr, conlist, constr, validator +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated from equinix_metal.models.href import Href +from typing import Optional, Set +from typing_extensions import Self class Project(BaseModel): """ Project - """ + """ # noqa: E501 backend_transfer_enabled: Optional[StrictBool] = None bgp_config: Optional[Href] = None created_at: Optional[datetime] = None customdata: Optional[Dict[str, Any]] = None - devices: Optional[conlist(Href)] = None + devices: Optional[List[Href]] = None href: Optional[StrictStr] = None id: Optional[StrictStr] = None - invitations: Optional[conlist(Href)] = None + invitations: Optional[List[Href]] = None max_devices: Optional[Dict[str, Any]] = None - members: Optional[conlist(Href)] = None - memberships: Optional[conlist(Href)] = None - name: Optional[constr(strict=True, max_length=80, min_length=1)] = Field(None, description="The name of the project. Cannot contain characters encoded in greater than 3 bytes such as emojis.") + members: Optional[List[Href]] = None + memberships: Optional[List[Href]] = None + name: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=80)]] = Field(default=None, description="The name of the project. Cannot contain characters encoded in greater than 3 bytes such as emojis.") network_status: Optional[Dict[str, Any]] = None organization: Optional[Href] = None payment_method: Optional[Href] = None - ssh_keys: Optional[conlist(Href)] = None - tags: Optional[conlist(StrictStr)] = None - type: Optional[StrictStr] = Field(None, description="The type of the project. Projects of type `vmce` are part of an in development feature and not available to all customers.") + ssh_keys: Optional[List[Href]] = None + tags: Optional[List[StrictStr]] = None + type: Optional[StrictStr] = Field(default=None, description="The type of the project. Projects of type `vmce` are part of an in development feature and not available to all customers.") updated_at: Optional[datetime] = None - volumes: Optional[conlist(Href)] = None - __properties = ["backend_transfer_enabled", "bgp_config", "created_at", "customdata", "devices", "href", "id", "invitations", "max_devices", "members", "memberships", "name", "network_status", "organization", "payment_method", "ssh_keys", "tags", "type", "updated_at", "volumes"] + volumes: Optional[List[Href]] = None + __properties: ClassVar[List[str]] = ["backend_transfer_enabled", "bgp_config", "created_at", "customdata", "devices", "href", "id", "invitations", "max_devices", "members", "memberships", "name", "network_status", "organization", "payment_method", "ssh_keys", "tags", "type", "updated_at", "volumes"] - @validator('type') + @field_validator('type') def type_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('default', 'vmce'): + if value not in set(['default', 'vmce']): raise ValueError("must be one of enum values ('default', 'vmce')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> Project: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Project from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of bgp_config if self.bgp_config: _dict['bgp_config'] = self.bgp_config.to_dict() @@ -137,35 +155,35 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> Project: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Project from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Project.parse_obj(obj) + return cls.model_validate(obj) - _obj = Project.parse_obj({ + _obj = cls.model_validate({ "backend_transfer_enabled": obj.get("backend_transfer_enabled"), - "bgp_config": Href.from_dict(obj.get("bgp_config")) if obj.get("bgp_config") is not None else None, + "bgp_config": Href.from_dict(obj["bgp_config"]) if obj.get("bgp_config") is not None else None, "created_at": obj.get("created_at"), "customdata": obj.get("customdata"), - "devices": [Href.from_dict(_item) for _item in obj.get("devices")] if obj.get("devices") is not None else None, + "devices": [Href.from_dict(_item) for _item in obj["devices"]] if obj.get("devices") is not None else None, "href": obj.get("href"), "id": obj.get("id"), - "invitations": [Href.from_dict(_item) for _item in obj.get("invitations")] if obj.get("invitations") is not None else None, + "invitations": [Href.from_dict(_item) for _item in obj["invitations"]] if obj.get("invitations") is not None else None, "max_devices": obj.get("max_devices"), - "members": [Href.from_dict(_item) for _item in obj.get("members")] if obj.get("members") is not None else None, - "memberships": [Href.from_dict(_item) for _item in obj.get("memberships")] if obj.get("memberships") is not None else None, + "members": [Href.from_dict(_item) for _item in obj["members"]] if obj.get("members") is not None else None, + "memberships": [Href.from_dict(_item) for _item in obj["memberships"]] if obj.get("memberships") is not None else None, "name": obj.get("name"), "network_status": obj.get("network_status"), - "organization": Href.from_dict(obj.get("organization")) if obj.get("organization") is not None else None, - "payment_method": Href.from_dict(obj.get("payment_method")) if obj.get("payment_method") is not None else None, - "ssh_keys": [Href.from_dict(_item) for _item in obj.get("ssh_keys")] if obj.get("ssh_keys") is not None else None, + "organization": Href.from_dict(obj["organization"]) if obj.get("organization") is not None else None, + "payment_method": Href.from_dict(obj["payment_method"]) if obj.get("payment_method") is not None else None, + "ssh_keys": [Href.from_dict(_item) for _item in obj["ssh_keys"]] if obj.get("ssh_keys") is not None else None, "tags": obj.get("tags"), "type": obj.get("type"), "updated_at": obj.get("updated_at"), - "volumes": [Href.from_dict(_item) for _item in obj.get("volumes")] if obj.get("volumes") is not None else None + "volumes": [Href.from_dict(_item) for _item in obj["volumes"]] if obj.get("volumes") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/project_create_from_root_input.py b/equinix_metal/equinix_metal/models/project_create_from_root_input.py index bb290bf9..a432d515 100644 --- a/equinix_metal/equinix_metal/models/project_create_from_root_input.py +++ b/equinix_metal/equinix_metal/models/project_create_from_root_input.py @@ -18,69 +18,86 @@ import re # noqa: F401 import json - -from typing import Any, Dict, List, Optional -from pydantic import BaseModel, Field, StrictStr, conlist, constr, validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self class ProjectCreateFromRootInput(BaseModel): """ ProjectCreateFromRootInput - """ + """ # noqa: E501 customdata: Optional[Dict[str, Any]] = None href: Optional[StrictStr] = None - name: constr(strict=True, max_length=80, min_length=1) = Field(..., description="The name of the project. Cannot contain characters encoded in greater than 3 bytes such as emojis.") + name: Annotated[str, Field(min_length=1, strict=True, max_length=80)] = Field(description="The name of the project. Cannot contain characters encoded in greater than 3 bytes such as emojis.") organization_id: Optional[StrictStr] = None payment_method_id: Optional[StrictStr] = None - tags: Optional[conlist(StrictStr)] = None - type: Optional[StrictStr] = Field(None, description="The type of the project. If no type is specified the project type will automatically be `default` Projects of type 'vmce' are part of an in development feature and not available to all customers.") - __properties = ["customdata", "href", "name", "organization_id", "payment_method_id", "tags", "type"] + tags: Optional[List[StrictStr]] = None + type: Optional[StrictStr] = Field(default=None, description="The type of the project. If no type is specified the project type will automatically be `default` Projects of type 'vmce' are part of an in development feature and not available to all customers.") + __properties: ClassVar[List[str]] = ["customdata", "href", "name", "organization_id", "payment_method_id", "tags", "type"] - @validator('type') + @field_validator('type') def type_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('default', 'vmce'): + if value not in set(['default', 'vmce']): raise ValueError("must be one of enum values ('default', 'vmce')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> ProjectCreateFromRootInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ProjectCreateFromRootInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> ProjectCreateFromRootInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ProjectCreateFromRootInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ProjectCreateFromRootInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = ProjectCreateFromRootInput.parse_obj({ + _obj = cls.model_validate({ "customdata": obj.get("customdata"), "href": obj.get("href"), "name": obj.get("name"), diff --git a/equinix_metal/equinix_metal/models/project_create_input.py b/equinix_metal/equinix_metal/models/project_create_input.py index e7fd2967..3fd7ff78 100644 --- a/equinix_metal/equinix_metal/models/project_create_input.py +++ b/equinix_metal/equinix_metal/models/project_create_input.py @@ -18,68 +18,85 @@ import re # noqa: F401 import json - -from typing import Any, Dict, List, Optional -from pydantic import BaseModel, Field, StrictStr, conlist, constr, validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self class ProjectCreateInput(BaseModel): """ ProjectCreateInput - """ + """ # noqa: E501 customdata: Optional[Dict[str, Any]] = None href: Optional[StrictStr] = None - name: constr(strict=True, max_length=80, min_length=1) = Field(..., description="The name of the project. Cannot contain characters encoded in greater than 3 bytes such as emojis.") + name: Annotated[str, Field(min_length=1, strict=True, max_length=80)] = Field(description="The name of the project. Cannot contain characters encoded in greater than 3 bytes such as emojis.") payment_method_id: Optional[StrictStr] = None - tags: Optional[conlist(StrictStr)] = None - type: Optional[StrictStr] = Field(None, description="The type of the project. If no type is specified the project type will automatically be `default` Projects of type 'vmce' are part of an in development feature and not available to all customers.") - __properties = ["customdata", "href", "name", "payment_method_id", "tags", "type"] + tags: Optional[List[StrictStr]] = None + type: Optional[StrictStr] = Field(default=None, description="The type of the project. If no type is specified the project type will automatically be `default` Projects of type 'vmce' are part of an in development feature and not available to all customers.") + __properties: ClassVar[List[str]] = ["customdata", "href", "name", "payment_method_id", "tags", "type"] - @validator('type') + @field_validator('type') def type_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('default', 'vmce'): + if value not in set(['default', 'vmce']): raise ValueError("must be one of enum values ('default', 'vmce')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> ProjectCreateInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ProjectCreateInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> ProjectCreateInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ProjectCreateInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ProjectCreateInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = ProjectCreateInput.parse_obj({ + _obj = cls.model_validate({ "customdata": obj.get("customdata"), "href": obj.get("href"), "name": obj.get("name"), diff --git a/equinix_metal/equinix_metal/models/project_id_name.py b/equinix_metal/equinix_metal/models/project_id_name.py index f6cb02fb..8ce3fb7f 100644 --- a/equinix_metal/equinix_metal/models/project_id_name.py +++ b/equinix_metal/equinix_metal/models/project_id_name.py @@ -18,55 +18,71 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class ProjectIdName(BaseModel): """ ProjectIdName - """ + """ # noqa: E501 href: Optional[StrictStr] = None id: Optional[StrictStr] = None name: Optional[StrictStr] = None - __properties = ["href", "id", "name"] + __properties: ClassVar[List[str]] = ["href", "id", "name"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> ProjectIdName: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ProjectIdName from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> ProjectIdName: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ProjectIdName from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ProjectIdName.parse_obj(obj) + return cls.model_validate(obj) - _obj = ProjectIdName.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), "id": obj.get("id"), "name": obj.get("name") diff --git a/equinix_metal/equinix_metal/models/project_list.py b/equinix_metal/equinix_metal/models/project_list.py index 61594389..2a2d18bc 100644 --- a/equinix_metal/equinix_metal/models/project_list.py +++ b/equinix_metal/equinix_metal/models/project_list.py @@ -18,45 +18,61 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.meta import Meta from equinix_metal.models.project import Project +from typing import Optional, Set +from typing_extensions import Self class ProjectList(BaseModel): """ ProjectList - """ + """ # noqa: E501 href: Optional[StrictStr] = None meta: Optional[Meta] = None - projects: Optional[conlist(Project)] = None - __properties = ["href", "meta", "projects"] + projects: Optional[List[Project]] = None + __properties: ClassVar[List[str]] = ["href", "meta", "projects"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> ProjectList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ProjectList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of meta if self.meta: _dict['meta'] = self.meta.to_dict() @@ -70,18 +86,18 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ProjectList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ProjectList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ProjectList.parse_obj(obj) + return cls.model_validate(obj) - _obj = ProjectList.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "meta": Meta.from_dict(obj.get("meta")) if obj.get("meta") is not None else None, - "projects": [Project.from_dict(_item) for _item in obj.get("projects")] if obj.get("projects") is not None else None + "meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None, + "projects": [Project.from_dict(_item) for _item in obj["projects"]] if obj.get("projects") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/project_update_input.py b/equinix_metal/equinix_metal/models/project_update_input.py index 84b2c986..a6b96dcc 100644 --- a/equinix_metal/equinix_metal/models/project_update_input.py +++ b/equinix_metal/equinix_metal/models/project_update_input.py @@ -18,58 +18,75 @@ import re # noqa: F401 import json - -from typing import Any, Dict, List, Optional -from pydantic import BaseModel, Field, StrictBool, StrictStr, conlist, constr +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self class ProjectUpdateInput(BaseModel): """ ProjectUpdateInput - """ + """ # noqa: E501 backend_transfer_enabled: Optional[StrictBool] = None customdata: Optional[Dict[str, Any]] = None href: Optional[StrictStr] = None - name: Optional[constr(strict=True, max_length=80, min_length=1)] = Field(None, description="The name of the project. Cannot contain characters encoded in greater than 3 bytes such as emojis.") + name: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=80)]] = Field(default=None, description="The name of the project. Cannot contain characters encoded in greater than 3 bytes such as emojis.") payment_method_id: Optional[StrictStr] = None - tags: Optional[conlist(StrictStr)] = None - __properties = ["backend_transfer_enabled", "customdata", "href", "name", "payment_method_id", "tags"] + tags: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["backend_transfer_enabled", "customdata", "href", "name", "payment_method_id", "tags"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> ProjectUpdateInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ProjectUpdateInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> ProjectUpdateInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ProjectUpdateInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ProjectUpdateInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = ProjectUpdateInput.parse_obj({ + _obj = cls.model_validate({ "backend_transfer_enabled": obj.get("backend_transfer_enabled"), "customdata": obj.get("customdata"), "href": obj.get("href"), diff --git a/equinix_metal/equinix_metal/models/project_usage.py b/equinix_metal/equinix_metal/models/project_usage.py index b784cd46..1afcc54b 100644 --- a/equinix_metal/equinix_metal/models/project_usage.py +++ b/equinix_metal/equinix_metal/models/project_usage.py @@ -18,14 +18,15 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class ProjectUsage(BaseModel): """ ProjectUsage - """ + """ # noqa: E501 facility: Optional[StrictStr] = None href: Optional[StrictStr] = None name: Optional[StrictStr] = None @@ -36,44 +37,59 @@ class ProjectUsage(BaseModel): total: Optional[StrictStr] = None type: Optional[StrictStr] = None unit: Optional[StrictStr] = None - __properties = ["facility", "href", "name", "plan", "plan_version", "price", "quantity", "total", "type", "unit"] + __properties: ClassVar[List[str]] = ["facility", "href", "name", "plan", "plan_version", "price", "quantity", "total", "type", "unit"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> ProjectUsage: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ProjectUsage from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> ProjectUsage: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ProjectUsage from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ProjectUsage.parse_obj(obj) + return cls.model_validate(obj) - _obj = ProjectUsage.parse_obj({ + _obj = cls.model_validate({ "facility": obj.get("facility"), "href": obj.get("href"), "name": obj.get("name"), diff --git a/equinix_metal/equinix_metal/models/project_usage_list.py b/equinix_metal/equinix_metal/models/project_usage_list.py index 34eb8a80..66e4c87f 100644 --- a/equinix_metal/equinix_metal/models/project_usage_list.py +++ b/equinix_metal/equinix_metal/models/project_usage_list.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.project_usage import ProjectUsage +from typing import Optional, Set +from typing_extensions import Self class ProjectUsageList(BaseModel): """ ProjectUsageList - """ + """ # noqa: E501 href: Optional[StrictStr] = None - usages: Optional[conlist(ProjectUsage)] = None - __properties = ["href", "usages"] + usages: Optional[List[ProjectUsage]] = None + __properties: ClassVar[List[str]] = ["href", "usages"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> ProjectUsageList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ProjectUsageList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in usages (list) _items = [] if self.usages: @@ -65,17 +81,17 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ProjectUsageList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ProjectUsageList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ProjectUsageList.parse_obj(obj) + return cls.model_validate(obj) - _obj = ProjectUsageList.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "usages": [ProjectUsage.from_dict(_item) for _item in obj.get("usages")] if obj.get("usages") is not None else None + "usages": [ProjectUsage.from_dict(_item) for _item in obj["usages"]] if obj.get("usages") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/raid.py b/equinix_metal/equinix_metal/models/raid.py index eaab37fd..77c96d9f 100644 --- a/equinix_metal/equinix_metal/models/raid.py +++ b/equinix_metal/equinix_metal/models/raid.py @@ -18,56 +18,72 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class Raid(BaseModel): """ Raid - """ - devices: Optional[conlist(StrictStr)] = None + """ # noqa: E501 + devices: Optional[List[StrictStr]] = None href: Optional[StrictStr] = None level: Optional[StrictStr] = None name: Optional[StrictStr] = None - __properties = ["devices", "href", "level", "name"] + __properties: ClassVar[List[str]] = ["devices", "href", "level", "name"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> Raid: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Raid from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> Raid: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Raid from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Raid.parse_obj(obj) + return cls.model_validate(obj) - _obj = Raid.parse_obj({ + _obj = cls.model_validate({ "devices": obj.get("devices"), "href": obj.get("href"), "level": obj.get("level"), diff --git a/equinix_metal/equinix_metal/models/recovery_code_list.py b/equinix_metal/equinix_metal/models/recovery_code_list.py index e7881b64..4934d5fa 100644 --- a/equinix_metal/equinix_metal/models/recovery_code_list.py +++ b/equinix_metal/equinix_metal/models/recovery_code_list.py @@ -18,54 +18,70 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class RecoveryCodeList(BaseModel): """ RecoveryCodeList - """ + """ # noqa: E501 href: Optional[StrictStr] = None - recovery_codes: Optional[conlist(StrictStr)] = None - __properties = ["href", "recovery_codes"] + recovery_codes: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["href", "recovery_codes"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> RecoveryCodeList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of RecoveryCodeList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> RecoveryCodeList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of RecoveryCodeList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return RecoveryCodeList.parse_obj(obj) + return cls.model_validate(obj) - _obj = RecoveryCodeList.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), "recovery_codes": obj.get("recovery_codes") }) diff --git a/equinix_metal/equinix_metal/models/request_ip_reservation201_response.py b/equinix_metal/equinix_metal/models/request_ip_reservation201_response.py index c2e4cd40..cae1e2b1 100644 --- a/equinix_metal/equinix_metal/models/request_ip_reservation201_response.py +++ b/equinix_metal/equinix_metal/models/request_ip_reservation201_response.py @@ -14,17 +14,15 @@ from __future__ import annotations -from inspect import getfullargspec import json import pprint -import re # noqa: F401 - +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator from typing import Any, List, Optional -from pydantic import BaseModel, Field, StrictStr, ValidationError, validator from equinix_metal.models.ip_reservation import IPReservation from equinix_metal.models.vrf_ip_reservation import VrfIpReservation -from typing import Union, Any, List, TYPE_CHECKING from pydantic import StrictStr, Field +from typing import Union, List, Optional, Dict +from typing_extensions import Literal, Self REQUESTIPRESERVATION201RESPONSE_ONE_OF_SCHEMAS = ["IPReservation", "VrfIpReservation"] @@ -36,16 +34,16 @@ class RequestIPReservation201Response(BaseModel): oneof_schema_1_validator: Optional[IPReservation] = None # data type: VrfIpReservation oneof_schema_2_validator: Optional[VrfIpReservation] = None - if TYPE_CHECKING: - actual_instance: Union[IPReservation, VrfIpReservation] - else: - actual_instance: Any - one_of_schemas: List[str] = Field(REQUESTIPRESERVATION201RESPONSE_ONE_OF_SCHEMAS, const=True) + actual_instance: Optional[Union[IPReservation, VrfIpReservation]] = None + one_of_schemas: List[str] = Field(default=Literal["IPReservation", "VrfIpReservation"]) + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - validate_assignment = True - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: if args: if len(args) > 1: raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") @@ -55,9 +53,9 @@ def __init__(self, *args, **kwargs): else: super().__init__(**kwargs) - @validator('actual_instance') + @field_validator('actual_instance') def actual_instance_must_validate_oneof(cls, v): - instance = RequestIPReservation201Response.construct() + instance = RequestIPReservation201Response.model_construct() error_messages = [] match = 0 # validate data type: IPReservation @@ -80,13 +78,13 @@ def actual_instance_must_validate_oneof(cls, v): return v @classmethod - def from_dict(cls, obj: dict) -> RequestIPReservation201Response: + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: return cls.from_json(json.dumps(obj)) @classmethod - def from_json(cls, json_str: str) -> RequestIPReservation201Response: + def from_json(cls, json_str: str) -> Self: """Returns the object represented by the json string""" - instance = RequestIPReservation201Response.construct() + instance = cls.model_construct() error_messages = [] match = 0 @@ -117,19 +115,17 @@ def to_json(self) -> str: if self.actual_instance is None: return "null" - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): return self.actual_instance.to_json() else: return json.dumps(self.actual_instance) - def to_dict(self) -> dict: + def to_dict(self) -> Optional[Union[Dict[str, Any], IPReservation, VrfIpReservation]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None - to_dict = getattr(self.actual_instance, "to_dict", None) - if callable(to_dict): + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): return self.actual_instance.to_dict() else: # primitive type @@ -137,6 +133,6 @@ def to_dict(self) -> dict: def to_str(self) -> str: """Returns the string representation of the actual instance""" - return pprint.pformat(self.dict()) + return pprint.pformat(self.model_dump()) diff --git a/equinix_metal/equinix_metal/models/request_ip_reservation_request.py b/equinix_metal/equinix_metal/models/request_ip_reservation_request.py index d5273e3e..daccb002 100644 --- a/equinix_metal/equinix_metal/models/request_ip_reservation_request.py +++ b/equinix_metal/equinix_metal/models/request_ip_reservation_request.py @@ -14,17 +14,15 @@ from __future__ import annotations -from inspect import getfullargspec import json import pprint -import re # noqa: F401 - +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator from typing import Any, List, Optional -from pydantic import BaseModel, Field, StrictStr, ValidationError, validator from equinix_metal.models.ip_reservation_request_input import IPReservationRequestInput from equinix_metal.models.vrf_ip_reservation_create_input import VrfIpReservationCreateInput -from typing import Union, Any, List, TYPE_CHECKING from pydantic import StrictStr, Field +from typing import Union, List, Optional, Dict +from typing_extensions import Literal, Self REQUESTIPRESERVATIONREQUEST_ONE_OF_SCHEMAS = ["IPReservationRequestInput", "VrfIpReservationCreateInput"] @@ -36,16 +34,16 @@ class RequestIPReservationRequest(BaseModel): oneof_schema_1_validator: Optional[IPReservationRequestInput] = None # data type: VrfIpReservationCreateInput oneof_schema_2_validator: Optional[VrfIpReservationCreateInput] = None - if TYPE_CHECKING: - actual_instance: Union[IPReservationRequestInput, VrfIpReservationCreateInput] - else: - actual_instance: Any - one_of_schemas: List[str] = Field(REQUESTIPRESERVATIONREQUEST_ONE_OF_SCHEMAS, const=True) + actual_instance: Optional[Union[IPReservationRequestInput, VrfIpReservationCreateInput]] = None + one_of_schemas: List[str] = Field(default=Literal["IPReservationRequestInput", "VrfIpReservationCreateInput"]) + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - validate_assignment = True - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: if args: if len(args) > 1: raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") @@ -55,9 +53,9 @@ def __init__(self, *args, **kwargs): else: super().__init__(**kwargs) - @validator('actual_instance') + @field_validator('actual_instance') def actual_instance_must_validate_oneof(cls, v): - instance = RequestIPReservationRequest.construct() + instance = RequestIPReservationRequest.model_construct() error_messages = [] match = 0 # validate data type: IPReservationRequestInput @@ -80,13 +78,13 @@ def actual_instance_must_validate_oneof(cls, v): return v @classmethod - def from_dict(cls, obj: dict) -> RequestIPReservationRequest: + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: return cls.from_json(json.dumps(obj)) @classmethod - def from_json(cls, json_str: str) -> RequestIPReservationRequest: + def from_json(cls, json_str: str) -> Self: """Returns the object represented by the json string""" - instance = RequestIPReservationRequest.construct() + instance = cls.model_construct() error_messages = [] match = 0 @@ -117,19 +115,17 @@ def to_json(self) -> str: if self.actual_instance is None: return "null" - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): return self.actual_instance.to_json() else: return json.dumps(self.actual_instance) - def to_dict(self) -> dict: + def to_dict(self) -> Optional[Union[Dict[str, Any], IPReservationRequestInput, VrfIpReservationCreateInput]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None - to_dict = getattr(self.actual_instance, "to_dict", None) - if callable(to_dict): + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): return self.actual_instance.to_dict() else: # primitive type @@ -137,6 +133,6 @@ def to_dict(self) -> dict: def to_str(self) -> str: """Returns the string representation of the actual instance""" - return pprint.pformat(self.dict()) + return pprint.pformat(self.model_dump()) diff --git a/equinix_metal/equinix_metal/models/self_service_reservation_item_request.py b/equinix_metal/equinix_metal/models/self_service_reservation_item_request.py index 3a09a5a9..6e1fc960 100644 --- a/equinix_metal/equinix_metal/models/self_service_reservation_item_request.py +++ b/equinix_metal/equinix_metal/models/self_service_reservation_item_request.py @@ -18,58 +18,74 @@ import re # noqa: F401 import json - -from typing import Optional, Union -from pydantic import BaseModel, StrictFloat, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self class SelfServiceReservationItemRequest(BaseModel): """ SelfServiceReservationItemRequest - """ + """ # noqa: E501 amount: Optional[Union[StrictFloat, StrictInt]] = None href: Optional[StrictStr] = None metro_id: Optional[StrictStr] = None plan_id: Optional[StrictStr] = None quantity: Optional[StrictInt] = None term: Optional[StrictStr] = None - __properties = ["amount", "href", "metro_id", "plan_id", "quantity", "term"] + __properties: ClassVar[List[str]] = ["amount", "href", "metro_id", "plan_id", "quantity", "term"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> SelfServiceReservationItemRequest: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SelfServiceReservationItemRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> SelfServiceReservationItemRequest: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SelfServiceReservationItemRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SelfServiceReservationItemRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = SelfServiceReservationItemRequest.parse_obj({ + _obj = cls.model_validate({ "amount": obj.get("amount"), "href": obj.get("href"), "metro_id": obj.get("metro_id"), diff --git a/equinix_metal/equinix_metal/models/self_service_reservation_item_response.py b/equinix_metal/equinix_metal/models/self_service_reservation_item_response.py index ffa49a62..b1cc18cb 100644 --- a/equinix_metal/equinix_metal/models/self_service_reservation_item_response.py +++ b/equinix_metal/equinix_metal/models/self_service_reservation_item_response.py @@ -18,15 +18,16 @@ import re # noqa: F401 import json - -from typing import List, Optional, Union -from pydantic import BaseModel, StrictFloat, StrictInt, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union from equinix_metal.models.plan import Plan +from typing import Optional, Set +from typing_extensions import Self class SelfServiceReservationItemResponse(BaseModel): """ SelfServiceReservationItemResponse - """ + """ # noqa: E501 amount: Optional[Union[StrictFloat, StrictInt]] = None href: Optional[StrictStr] = None id: Optional[StrictStr] = None @@ -34,60 +35,75 @@ class SelfServiceReservationItemResponse(BaseModel): metro_id: Optional[StrictStr] = None metro_name: Optional[StrictStr] = None plan: Optional[Plan] = None - plan_categories: Optional[conlist(StrictStr)] = None + plan_categories: Optional[List[StrictStr]] = None plan_id: Optional[StrictStr] = None plan_name: Optional[StrictStr] = None plan_slug: Optional[StrictStr] = None quantity: Optional[StrictInt] = None term: Optional[StrictStr] = None - __properties = ["amount", "href", "id", "metro_code", "metro_id", "metro_name", "plan", "plan_categories", "plan_id", "plan_name", "plan_slug", "quantity", "term"] + __properties: ClassVar[List[str]] = ["amount", "href", "id", "metro_code", "metro_id", "metro_name", "plan", "plan_categories", "plan_id", "plan_name", "plan_slug", "quantity", "term"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> SelfServiceReservationItemResponse: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SelfServiceReservationItemResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of plan if self.plan: _dict['plan'] = self.plan.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> SelfServiceReservationItemResponse: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SelfServiceReservationItemResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SelfServiceReservationItemResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = SelfServiceReservationItemResponse.parse_obj({ + _obj = cls.model_validate({ "amount": obj.get("amount"), "href": obj.get("href"), "id": obj.get("id"), "metro_code": obj.get("metro_code"), "metro_id": obj.get("metro_id"), "metro_name": obj.get("metro_name"), - "plan": Plan.from_dict(obj.get("plan")) if obj.get("plan") is not None else None, + "plan": Plan.from_dict(obj["plan"]) if obj.get("plan") is not None else None, "plan_categories": obj.get("plan_categories"), "plan_id": obj.get("plan_id"), "plan_name": obj.get("plan_name"), diff --git a/equinix_metal/equinix_metal/models/self_service_reservation_list.py b/equinix_metal/equinix_metal/models/self_service_reservation_list.py index dfdae63d..75923239 100644 --- a/equinix_metal/equinix_metal/models/self_service_reservation_list.py +++ b/equinix_metal/equinix_metal/models/self_service_reservation_list.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.self_service_reservation_response import SelfServiceReservationResponse +from typing import Optional, Set +from typing_extensions import Self class SelfServiceReservationList(BaseModel): """ SelfServiceReservationList - """ + """ # noqa: E501 href: Optional[StrictStr] = None - reservations: Optional[conlist(SelfServiceReservationResponse)] = None - __properties = ["href", "reservations"] + reservations: Optional[List[SelfServiceReservationResponse]] = None + __properties: ClassVar[List[str]] = ["href", "reservations"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> SelfServiceReservationList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SelfServiceReservationList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in reservations (list) _items = [] if self.reservations: @@ -65,17 +81,17 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> SelfServiceReservationList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SelfServiceReservationList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SelfServiceReservationList.parse_obj(obj) + return cls.model_validate(obj) - _obj = SelfServiceReservationList.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "reservations": [SelfServiceReservationResponse.from_dict(_item) for _item in obj.get("reservations")] if obj.get("reservations") is not None else None + "reservations": [SelfServiceReservationResponse.from_dict(_item) for _item in obj["reservations"]] if obj.get("reservations") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/self_service_reservation_response.py b/equinix_metal/equinix_metal/models/self_service_reservation_response.py index 6b3f3a8e..c98d4dd2 100644 --- a/equinix_metal/equinix_metal/models/self_service_reservation_response.py +++ b/equinix_metal/equinix_metal/models/self_service_reservation_response.py @@ -19,18 +19,20 @@ import json from datetime import datetime -from typing import List, Optional -from pydantic import BaseModel, StrictInt, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.create_self_service_reservation_request_period import CreateSelfServiceReservationRequestPeriod from equinix_metal.models.self_service_reservation_item_response import SelfServiceReservationItemResponse +from typing import Optional, Set +from typing_extensions import Self class SelfServiceReservationResponse(BaseModel): """ SelfServiceReservationResponse - """ + """ # noqa: E501 created_at: Optional[datetime] = None href: Optional[StrictStr] = None - item: Optional[conlist(SelfServiceReservationItemResponse)] = None + item: Optional[List[SelfServiceReservationItemResponse]] = None notes: Optional[StrictStr] = None organization: Optional[StrictStr] = None organization_id: Optional[StrictStr] = None @@ -40,32 +42,47 @@ class SelfServiceReservationResponse(BaseModel): start_date: Optional[datetime] = None status: Optional[StrictStr] = None total_cost: Optional[StrictInt] = None - __properties = ["created_at", "href", "item", "notes", "organization", "organization_id", "period", "project", "project_id", "start_date", "status", "total_cost"] + __properties: ClassVar[List[str]] = ["created_at", "href", "item", "notes", "organization", "organization_id", "period", "project", "project_id", "start_date", "status", "total_cost"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> SelfServiceReservationResponse: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SelfServiceReservationResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in item (list) _items = [] if self.item: @@ -79,22 +96,22 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> SelfServiceReservationResponse: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SelfServiceReservationResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SelfServiceReservationResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = SelfServiceReservationResponse.parse_obj({ + _obj = cls.model_validate({ "created_at": obj.get("created_at"), "href": obj.get("href"), - "item": [SelfServiceReservationItemResponse.from_dict(_item) for _item in obj.get("item")] if obj.get("item") is not None else None, + "item": [SelfServiceReservationItemResponse.from_dict(_item) for _item in obj["item"]] if obj.get("item") is not None else None, "notes": obj.get("notes"), "organization": obj.get("organization"), "organization_id": obj.get("organization_id"), - "period": CreateSelfServiceReservationRequestPeriod.from_dict(obj.get("period")) if obj.get("period") is not None else None, + "period": CreateSelfServiceReservationRequestPeriod.from_dict(obj["period"]) if obj.get("period") is not None else None, "project": obj.get("project"), "project_id": obj.get("project_id"), "start_date": obj.get("start_date"), diff --git a/equinix_metal/equinix_metal/models/server_info.py b/equinix_metal/equinix_metal/models/server_info.py index 22ac7f71..b2a54014 100644 --- a/equinix_metal/equinix_metal/models/server_info.py +++ b/equinix_metal/equinix_metal/models/server_info.py @@ -18,57 +18,73 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class ServerInfo(BaseModel): """ ServerInfo - """ + """ # noqa: E501 facility: Optional[StrictStr] = None href: Optional[StrictStr] = None - metro: Optional[StrictStr] = Field(None, description="The metro ID or code to check the capacity in.") - plan: Optional[StrictStr] = Field(None, description="The plan ID or slug to check the capacity of.") - quantity: Optional[StrictStr] = Field(None, description="The number of servers to check the capacity of.") - __properties = ["facility", "href", "metro", "plan", "quantity"] + metro: Optional[StrictStr] = Field(default=None, description="The metro ID or code to check the capacity in.") + plan: Optional[StrictStr] = Field(default=None, description="The plan ID or slug to check the capacity of.") + quantity: Optional[StrictStr] = Field(default=None, description="The number of servers to check the capacity of.") + __properties: ClassVar[List[str]] = ["facility", "href", "metro", "plan", "quantity"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> ServerInfo: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ServerInfo from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> ServerInfo: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ServerInfo from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ServerInfo.parse_obj(obj) + return cls.model_validate(obj) - _obj = ServerInfo.parse_obj({ + _obj = cls.model_validate({ "facility": obj.get("facility"), "href": obj.get("href"), "metro": obj.get("metro"), diff --git a/equinix_metal/equinix_metal/models/shared_port_vc_vlan_create_input.py b/equinix_metal/equinix_metal/models/shared_port_vc_vlan_create_input.py index 1a544d7b..d95e2a3a 100644 --- a/equinix_metal/equinix_metal/models/shared_port_vc_vlan_create_input.py +++ b/equinix_metal/equinix_metal/models/shared_port_vc_vlan_create_input.py @@ -18,69 +18,85 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class SharedPortVCVlanCreateInput(BaseModel): """ SharedPortVCVlanCreateInput - """ - contact_email: Optional[StrictStr] = Field(None, description="The preferred email used for communication and notifications about the Equinix Fabric interconnection. Required when using a Project API key. Optional and defaults to the primary user email address when using a User API key.") + """ # noqa: E501 + contact_email: Optional[StrictStr] = Field(default=None, description="The preferred email used for communication and notifications about the Equinix Fabric interconnection. Required when using a Project API key. Optional and defaults to the primary user email address when using a User API key.") description: Optional[StrictStr] = None href: Optional[StrictStr] = None - metro: StrictStr = Field(..., description="A Metro ID or code. When creating Fabric VCs (Metal Billed), this is where interconnection will be originating from, as we pre-authorize the use of one of our shared ports as the origin of the interconnection using A-Side service tokens. We only allow local connections for Fabric VCs (Metal Billed), so the destination location must be the same as the origin. For Fabric VCs (Fabric Billed), or shared connections, this will be the destination of the interconnection. We allow remote connections for Fabric VCs (Fabric Billed), so the origin of the interconnection can be a different metro set here.") - name: StrictStr = Field(...) - project: StrictStr = Field(...) - speed: Optional[StrictStr] = Field(None, description="A interconnection speed, in bps, mbps, or gbps. For Fabric VCs, this represents the maximum speed of the interconnection. For Fabric VCs (Metal Billed), this can only be one of the following: ''50mbps'', ''200mbps'', ''500mbps'', ''1gbps'', ''2gbps'', ''5gbps'' or ''10gbps'', and is required for creation. For Fabric VCs (Fabric Billed), this field will always default to ''10gbps'' even if it is not provided. For example, ''500000000'', ''50m'', or' ''500mbps'' will all work as valid inputs.") - tags: Optional[conlist(StrictStr)] = None - type: StrictStr = Field(...) - vlans: conlist(StrictInt) = Field(..., description="A list of one or two metro-based VLANs that will be set on the virtual circuits of primary and/or secondary interconnections respectively when creating Fabric VCs. VLANs can also be set after the interconnection is created, but are required to fully activate the virtual circuits.") - __properties = ["contact_email", "description", "href", "metro", "name", "project", "speed", "tags", "type", "vlans"] - - @validator('type') + metro: StrictStr = Field(description="A Metro ID or code. When creating Fabric VCs (Metal Billed), this is where interconnection will be originating from, as we pre-authorize the use of one of our shared ports as the origin of the interconnection using A-Side service tokens. We only allow local connections for Fabric VCs (Metal Billed), so the destination location must be the same as the origin. For Fabric VCs (Fabric Billed), or shared connections, this will be the destination of the interconnection. We allow remote connections for Fabric VCs (Fabric Billed), so the origin of the interconnection can be a different metro set here.") + name: StrictStr + project: StrictStr + speed: Optional[StrictStr] = Field(default=None, description="A interconnection speed, in bps, mbps, or gbps. For Fabric VCs, this represents the maximum speed of the interconnection. For Fabric VCs (Metal Billed), this can only be one of the following: ''50mbps'', ''200mbps'', ''500mbps'', ''1gbps'', ''2gbps'', ''5gbps'' or ''10gbps'', and is required for creation. For Fabric VCs (Fabric Billed), this field will always default to ''10gbps'' even if it is not provided. For example, ''500000000'', ''50m'', or' ''500mbps'' will all work as valid inputs.") + tags: Optional[List[StrictStr]] = None + type: StrictStr + vlans: List[StrictInt] = Field(description="A list of one or two metro-based VLANs that will be set on the virtual circuits of primary and/or secondary interconnections respectively when creating Fabric VCs. VLANs can also be set after the interconnection is created, but are required to fully activate the virtual circuits.") + __properties: ClassVar[List[str]] = ["contact_email", "description", "href", "metro", "name", "project", "speed", "tags", "type", "vlans"] + + @field_validator('type') def type_validate_enum(cls, value): """Validates the enum""" - if value not in ('shared_port_vlan'): + if value not in set(['shared_port_vlan']): raise ValueError("must be one of enum values ('shared_port_vlan')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> SharedPortVCVlanCreateInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SharedPortVCVlanCreateInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> SharedPortVCVlanCreateInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SharedPortVCVlanCreateInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SharedPortVCVlanCreateInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = SharedPortVCVlanCreateInput.parse_obj({ + _obj = cls.model_validate({ "contact_email": obj.get("contact_email"), "description": obj.get("description"), "href": obj.get("href"), diff --git a/equinix_metal/equinix_metal/models/spot_market_prices_list.py b/equinix_metal/equinix_metal/models/spot_market_prices_list.py index 5ff894f8..465f972d 100644 --- a/equinix_metal/equinix_metal/models/spot_market_prices_list.py +++ b/equinix_metal/equinix_metal/models/spot_market_prices_list.py @@ -18,60 +18,76 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.spot_prices_report import SpotPricesReport +from typing import Optional, Set +from typing_extensions import Self class SpotMarketPricesList(BaseModel): """ SpotMarketPricesList - """ + """ # noqa: E501 href: Optional[StrictStr] = None spot_market_prices: Optional[SpotPricesReport] = None - __properties = ["href", "spot_market_prices"] + __properties: ClassVar[List[str]] = ["href", "spot_market_prices"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> SpotMarketPricesList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpotMarketPricesList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of spot_market_prices if self.spot_market_prices: _dict['spot_market_prices'] = self.spot_market_prices.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> SpotMarketPricesList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpotMarketPricesList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpotMarketPricesList.parse_obj(obj) + return cls.model_validate(obj) - _obj = SpotMarketPricesList.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "spot_market_prices": SpotPricesReport.from_dict(obj.get("spot_market_prices")) if obj.get("spot_market_prices") is not None else None + "spot_market_prices": SpotPricesReport.from_dict(obj["spot_market_prices"]) if obj.get("spot_market_prices") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/spot_market_prices_per_metro_list.py b/equinix_metal/equinix_metal/models/spot_market_prices_per_metro_list.py index b1d1ce8e..67ad005c 100644 --- a/equinix_metal/equinix_metal/models/spot_market_prices_per_metro_list.py +++ b/equinix_metal/equinix_metal/models/spot_market_prices_per_metro_list.py @@ -18,60 +18,76 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.spot_market_prices_per_metro_report import SpotMarketPricesPerMetroReport +from typing import Optional, Set +from typing_extensions import Self class SpotMarketPricesPerMetroList(BaseModel): """ SpotMarketPricesPerMetroList - """ + """ # noqa: E501 href: Optional[StrictStr] = None spot_market_prices: Optional[SpotMarketPricesPerMetroReport] = None - __properties = ["href", "spot_market_prices"] + __properties: ClassVar[List[str]] = ["href", "spot_market_prices"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> SpotMarketPricesPerMetroList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpotMarketPricesPerMetroList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of spot_market_prices if self.spot_market_prices: _dict['spot_market_prices'] = self.spot_market_prices.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> SpotMarketPricesPerMetroList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpotMarketPricesPerMetroList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpotMarketPricesPerMetroList.parse_obj(obj) + return cls.model_validate(obj) - _obj = SpotMarketPricesPerMetroList.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "spot_market_prices": SpotMarketPricesPerMetroReport.from_dict(obj.get("spot_market_prices")) if obj.get("spot_market_prices") is not None else None + "spot_market_prices": SpotMarketPricesPerMetroReport.from_dict(obj["spot_market_prices"]) if obj.get("spot_market_prices") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/spot_market_prices_per_metro_report.py b/equinix_metal/equinix_metal/models/spot_market_prices_per_metro_report.py index cfe3f9fa..fdb33d50 100644 --- a/equinix_metal/equinix_metal/models/spot_market_prices_per_metro_report.py +++ b/equinix_metal/equinix_metal/models/spot_market_prices_per_metro_report.py @@ -18,15 +18,16 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.spot_prices_per_facility import SpotPricesPerFacility +from typing import Optional, Set +from typing_extensions import Self class SpotMarketPricesPerMetroReport(BaseModel): """ SpotMarketPricesPerMetroReport - """ + """ # noqa: E501 am: Optional[SpotPricesPerFacility] = None ch: Optional[SpotPricesPerFacility] = None da: Optional[SpotPricesPerFacility] = None @@ -35,32 +36,47 @@ class SpotMarketPricesPerMetroReport(BaseModel): ny: Optional[SpotPricesPerFacility] = None sg: Optional[SpotPricesPerFacility] = None sv: Optional[SpotPricesPerFacility] = None - __properties = ["am", "ch", "da", "href", "la", "ny", "sg", "sv"] + __properties: ClassVar[List[str]] = ["am", "ch", "da", "href", "la", "ny", "sg", "sv"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> SpotMarketPricesPerMetroReport: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpotMarketPricesPerMetroReport from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of am if self.am: _dict['am'] = self.am.to_dict() @@ -85,23 +101,23 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> SpotMarketPricesPerMetroReport: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpotMarketPricesPerMetroReport from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpotMarketPricesPerMetroReport.parse_obj(obj) + return cls.model_validate(obj) - _obj = SpotMarketPricesPerMetroReport.parse_obj({ - "am": SpotPricesPerFacility.from_dict(obj.get("am")) if obj.get("am") is not None else None, - "ch": SpotPricesPerFacility.from_dict(obj.get("ch")) if obj.get("ch") is not None else None, - "da": SpotPricesPerFacility.from_dict(obj.get("da")) if obj.get("da") is not None else None, + _obj = cls.model_validate({ + "am": SpotPricesPerFacility.from_dict(obj["am"]) if obj.get("am") is not None else None, + "ch": SpotPricesPerFacility.from_dict(obj["ch"]) if obj.get("ch") is not None else None, + "da": SpotPricesPerFacility.from_dict(obj["da"]) if obj.get("da") is not None else None, "href": obj.get("href"), - "la": SpotPricesPerFacility.from_dict(obj.get("la")) if obj.get("la") is not None else None, - "ny": SpotPricesPerFacility.from_dict(obj.get("ny")) if obj.get("ny") is not None else None, - "sg": SpotPricesPerFacility.from_dict(obj.get("sg")) if obj.get("sg") is not None else None, - "sv": SpotPricesPerFacility.from_dict(obj.get("sv")) if obj.get("sv") is not None else None + "la": SpotPricesPerFacility.from_dict(obj["la"]) if obj.get("la") is not None else None, + "ny": SpotPricesPerFacility.from_dict(obj["ny"]) if obj.get("ny") is not None else None, + "sg": SpotPricesPerFacility.from_dict(obj["sg"]) if obj.get("sg") is not None else None, + "sv": SpotPricesPerFacility.from_dict(obj["sv"]) if obj.get("sv") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/spot_market_request.py b/equinix_metal/equinix_metal/models/spot_market_request.py index 59e6a311..7f78fa67 100644 --- a/equinix_metal/equinix_metal/models/spot_market_request.py +++ b/equinix_metal/equinix_metal/models/spot_market_request.py @@ -19,15 +19,17 @@ import json from datetime import datetime -from typing import Optional, Union -from pydantic import BaseModel, StrictFloat, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union from equinix_metal.models.href import Href from equinix_metal.models.spot_market_request_metro import SpotMarketRequestMetro +from typing import Optional, Set +from typing_extensions import Self class SpotMarketRequest(BaseModel): """ SpotMarketRequest - """ + """ # noqa: E501 created_at: Optional[datetime] = None devices_max: Optional[StrictInt] = None devices_min: Optional[StrictInt] = None @@ -39,32 +41,47 @@ class SpotMarketRequest(BaseModel): max_bid_price: Optional[Union[StrictFloat, StrictInt]] = None metro: Optional[SpotMarketRequestMetro] = None project: Optional[Href] = None - __properties = ["created_at", "devices_max", "devices_min", "end_at", "facilities", "href", "id", "instances", "max_bid_price", "metro", "project"] + __properties: ClassVar[List[str]] = ["created_at", "devices_max", "devices_min", "end_at", "facilities", "href", "id", "instances", "max_bid_price", "metro", "project"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> SpotMarketRequest: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpotMarketRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of facilities if self.facilities: _dict['facilities'] = self.facilities.to_dict() @@ -80,26 +97,26 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> SpotMarketRequest: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpotMarketRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpotMarketRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = SpotMarketRequest.parse_obj({ + _obj = cls.model_validate({ "created_at": obj.get("created_at"), "devices_max": obj.get("devices_max"), "devices_min": obj.get("devices_min"), "end_at": obj.get("end_at"), - "facilities": Href.from_dict(obj.get("facilities")) if obj.get("facilities") is not None else None, + "facilities": Href.from_dict(obj["facilities"]) if obj.get("facilities") is not None else None, "href": obj.get("href"), "id": obj.get("id"), - "instances": Href.from_dict(obj.get("instances")) if obj.get("instances") is not None else None, + "instances": Href.from_dict(obj["instances"]) if obj.get("instances") is not None else None, "max_bid_price": obj.get("max_bid_price"), - "metro": SpotMarketRequestMetro.from_dict(obj.get("metro")) if obj.get("metro") is not None else None, - "project": Href.from_dict(obj.get("project")) if obj.get("project") is not None else None + "metro": SpotMarketRequestMetro.from_dict(obj["metro"]) if obj.get("metro") is not None else None, + "project": Href.from_dict(obj["project"]) if obj.get("project") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/spot_market_request_create_input.py b/equinix_metal/equinix_metal/models/spot_market_request_create_input.py index 70158df7..85907fe7 100644 --- a/equinix_metal/equinix_metal/models/spot_market_request_create_input.py +++ b/equinix_metal/equinix_metal/models/spot_market_request_create_input.py @@ -19,69 +19,86 @@ import json from datetime import datetime -from typing import List, Optional, Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union from equinix_metal.models.spot_market_request_create_input_instance_parameters import SpotMarketRequestCreateInputInstanceParameters +from typing import Optional, Set +from typing_extensions import Self class SpotMarketRequestCreateInput(BaseModel): """ SpotMarketRequestCreateInput - """ + """ # noqa: E501 devices_max: Optional[StrictInt] = None devices_min: Optional[StrictInt] = None end_at: Optional[datetime] = None - facilities: Optional[conlist(StrictStr)] = None + facilities: Optional[List[StrictStr]] = None href: Optional[StrictStr] = None instance_parameters: Optional[SpotMarketRequestCreateInputInstanceParameters] = None max_bid_price: Optional[Union[StrictFloat, StrictInt]] = None - metro: Optional[StrictStr] = Field(None, description="The metro ID or code the spot market request will be created in.") - __properties = ["devices_max", "devices_min", "end_at", "facilities", "href", "instance_parameters", "max_bid_price", "metro"] + metro: Optional[StrictStr] = Field(default=None, description="The metro ID or code the spot market request will be created in.") + __properties: ClassVar[List[str]] = ["devices_max", "devices_min", "end_at", "facilities", "href", "instance_parameters", "max_bid_price", "metro"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> SpotMarketRequestCreateInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpotMarketRequestCreateInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of instance_parameters if self.instance_parameters: _dict['instance_parameters'] = self.instance_parameters.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> SpotMarketRequestCreateInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpotMarketRequestCreateInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpotMarketRequestCreateInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = SpotMarketRequestCreateInput.parse_obj({ + _obj = cls.model_validate({ "devices_max": obj.get("devices_max"), "devices_min": obj.get("devices_min"), "end_at": obj.get("end_at"), "facilities": obj.get("facilities"), "href": obj.get("href"), - "instance_parameters": SpotMarketRequestCreateInputInstanceParameters.from_dict(obj.get("instance_parameters")) if obj.get("instance_parameters") is not None else None, + "instance_parameters": SpotMarketRequestCreateInputInstanceParameters.from_dict(obj["instance_parameters"]) if obj.get("instance_parameters") is not None else None, "max_bid_price": obj.get("max_bid_price"), "metro": obj.get("metro") }) diff --git a/equinix_metal/equinix_metal/models/spot_market_request_create_input_instance_parameters.py b/equinix_metal/equinix_metal/models/spot_market_request_create_input_instance_parameters.py index 833f8217..6760a230 100644 --- a/equinix_metal/equinix_metal/models/spot_market_request_create_input_instance_parameters.py +++ b/equinix_metal/equinix_metal/models/spot_market_request_create_input_instance_parameters.py @@ -19,70 +19,87 @@ import json from datetime import datetime -from typing import Any, Dict, List, Optional -from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class SpotMarketRequestCreateInputInstanceParameters(BaseModel): """ SpotMarketRequestCreateInputInstanceParameters - """ + """ # noqa: E501 always_pxe: Optional[StrictBool] = None billing_cycle: Optional[StrictStr] = None customdata: Optional[Dict[str, Any]] = None description: Optional[StrictStr] = None - features: Optional[conlist(StrictStr)] = None + features: Optional[List[StrictStr]] = None hostname: Optional[StrictStr] = None - hostnames: Optional[conlist(StrictStr)] = None + hostnames: Optional[List[StrictStr]] = None href: Optional[StrictStr] = None - locked: Optional[StrictBool] = Field(None, description="Whether the device should be locked, preventing accidental deletion.") + locked: Optional[StrictBool] = Field(default=None, description="Whether the device should be locked, preventing accidental deletion.") no_ssh_keys: Optional[StrictBool] = None operating_system: Optional[StrictStr] = None plan: Optional[StrictStr] = None private_ipv4_subnet_size: Optional[StrictInt] = None - project_ssh_keys: Optional[conlist(StrictStr)] = None + project_ssh_keys: Optional[List[StrictStr]] = None public_ipv4_subnet_size: Optional[StrictInt] = None - tags: Optional[conlist(StrictStr)] = None + tags: Optional[List[StrictStr]] = None termination_time: Optional[datetime] = None - user_ssh_keys: Optional[conlist(StrictStr)] = Field(None, description="The UUIDs of users whose SSH keys should be included on the provisioned device.") + user_ssh_keys: Optional[List[StrictStr]] = Field(default=None, description="The UUIDs of users whose SSH keys should be included on the provisioned device.") userdata: Optional[StrictStr] = None - __properties = ["always_pxe", "billing_cycle", "customdata", "description", "features", "hostname", "hostnames", "href", "locked", "no_ssh_keys", "operating_system", "plan", "private_ipv4_subnet_size", "project_ssh_keys", "public_ipv4_subnet_size", "tags", "termination_time", "user_ssh_keys", "userdata"] + __properties: ClassVar[List[str]] = ["always_pxe", "billing_cycle", "customdata", "description", "features", "hostname", "hostnames", "href", "locked", "no_ssh_keys", "operating_system", "plan", "private_ipv4_subnet_size", "project_ssh_keys", "public_ipv4_subnet_size", "tags", "termination_time", "user_ssh_keys", "userdata"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> SpotMarketRequestCreateInputInstanceParameters: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpotMarketRequestCreateInputInstanceParameters from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> SpotMarketRequestCreateInputInstanceParameters: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpotMarketRequestCreateInputInstanceParameters from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpotMarketRequestCreateInputInstanceParameters.parse_obj(obj) + return cls.model_validate(obj) - _obj = SpotMarketRequestCreateInputInstanceParameters.parse_obj({ + _obj = cls.model_validate({ "always_pxe": obj.get("always_pxe"), "billing_cycle": obj.get("billing_cycle"), "customdata": obj.get("customdata"), diff --git a/equinix_metal/equinix_metal/models/spot_market_request_list.py b/equinix_metal/equinix_metal/models/spot_market_request_list.py index 6ad2bcb0..b28308b1 100644 --- a/equinix_metal/equinix_metal/models/spot_market_request_list.py +++ b/equinix_metal/equinix_metal/models/spot_market_request_list.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.spot_market_request import SpotMarketRequest +from typing import Optional, Set +from typing_extensions import Self class SpotMarketRequestList(BaseModel): """ SpotMarketRequestList - """ + """ # noqa: E501 href: Optional[StrictStr] = None - spot_market_requests: Optional[conlist(SpotMarketRequest)] = None - __properties = ["href", "spot_market_requests"] + spot_market_requests: Optional[List[SpotMarketRequest]] = None + __properties: ClassVar[List[str]] = ["href", "spot_market_requests"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> SpotMarketRequestList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpotMarketRequestList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in spot_market_requests (list) _items = [] if self.spot_market_requests: @@ -65,17 +81,17 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> SpotMarketRequestList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpotMarketRequestList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpotMarketRequestList.parse_obj(obj) + return cls.model_validate(obj) - _obj = SpotMarketRequestList.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "spot_market_requests": [SpotMarketRequest.from_dict(_item) for _item in obj.get("spot_market_requests")] if obj.get("spot_market_requests") is not None else None + "spot_market_requests": [SpotMarketRequest.from_dict(_item) for _item in obj["spot_market_requests"]] if obj.get("spot_market_requests") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/spot_market_request_metro.py b/equinix_metal/equinix_metal/models/spot_market_request_metro.py index c9b351c3..fbbb7606 100644 --- a/equinix_metal/equinix_metal/models/spot_market_request_metro.py +++ b/equinix_metal/equinix_metal/models/spot_market_request_metro.py @@ -18,57 +18,73 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class SpotMarketRequestMetro(BaseModel): """ SpotMarketRequestMetro - """ + """ # noqa: E501 code: Optional[StrictStr] = None country: Optional[StrictStr] = None href: Optional[StrictStr] = None id: Optional[StrictStr] = None name: Optional[StrictStr] = None - __properties = ["code", "country", "href", "id", "name"] + __properties: ClassVar[List[str]] = ["code", "country", "href", "id", "name"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> SpotMarketRequestMetro: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpotMarketRequestMetro from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> SpotMarketRequestMetro: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpotMarketRequestMetro from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpotMarketRequestMetro.parse_obj(obj) + return cls.model_validate(obj) - _obj = SpotMarketRequestMetro.parse_obj({ + _obj = cls.model_validate({ "code": obj.get("code"), "country": obj.get("country"), "href": obj.get("href"), diff --git a/equinix_metal/equinix_metal/models/spot_prices_datapoints.py b/equinix_metal/equinix_metal/models/spot_prices_datapoints.py index 52aca93b..a0a1eb0b 100644 --- a/equinix_metal/equinix_metal/models/spot_prices_datapoints.py +++ b/equinix_metal/equinix_metal/models/spot_prices_datapoints.py @@ -18,54 +18,70 @@ import re # noqa: F401 import json - -from typing import List, Optional, Union -from pydantic import BaseModel, StrictFloat, StrictInt, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self class SpotPricesDatapoints(BaseModel): """ SpotPricesDatapoints - """ - datapoints: Optional[conlist(conlist(Union[StrictFloat, StrictInt]))] = None + """ # noqa: E501 + datapoints: Optional[List[List[Union[StrictFloat, StrictInt]]]] = None href: Optional[StrictStr] = None - __properties = ["datapoints", "href"] + __properties: ClassVar[List[str]] = ["datapoints", "href"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> SpotPricesDatapoints: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpotPricesDatapoints from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> SpotPricesDatapoints: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpotPricesDatapoints from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpotPricesDatapoints.parse_obj(obj) + return cls.model_validate(obj) - _obj = SpotPricesDatapoints.parse_obj({ + _obj = cls.model_validate({ "datapoints": obj.get("datapoints"), "href": obj.get("href") }) diff --git a/equinix_metal/equinix_metal/models/spot_prices_history_report.py b/equinix_metal/equinix_metal/models/spot_prices_history_report.py index 01f75490..5b89ec66 100644 --- a/equinix_metal/equinix_metal/models/spot_prices_history_report.py +++ b/equinix_metal/equinix_metal/models/spot_prices_history_report.py @@ -18,60 +18,76 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.spot_prices_datapoints import SpotPricesDatapoints +from typing import Optional, Set +from typing_extensions import Self class SpotPricesHistoryReport(BaseModel): """ SpotPricesHistoryReport - """ + """ # noqa: E501 href: Optional[StrictStr] = None prices_history: Optional[SpotPricesDatapoints] = None - __properties = ["href", "prices_history"] + __properties: ClassVar[List[str]] = ["href", "prices_history"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> SpotPricesHistoryReport: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpotPricesHistoryReport from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of prices_history if self.prices_history: _dict['prices_history'] = self.prices_history.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> SpotPricesHistoryReport: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpotPricesHistoryReport from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpotPricesHistoryReport.parse_obj(obj) + return cls.model_validate(obj) - _obj = SpotPricesHistoryReport.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "prices_history": SpotPricesDatapoints.from_dict(obj.get("prices_history")) if obj.get("prices_history") is not None else None + "prices_history": SpotPricesDatapoints.from_dict(obj["prices_history"]) if obj.get("prices_history") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/spot_prices_per_baremetal.py b/equinix_metal/equinix_metal/models/spot_prices_per_baremetal.py index 6f137b95..cb8072a7 100644 --- a/equinix_metal/equinix_metal/models/spot_prices_per_baremetal.py +++ b/equinix_metal/equinix_metal/models/spot_prices_per_baremetal.py @@ -18,54 +18,70 @@ import re # noqa: F401 import json - -from typing import Optional, Union -from pydantic import BaseModel, StrictFloat, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self class SpotPricesPerBaremetal(BaseModel): """ SpotPricesPerBaremetal - """ + """ # noqa: E501 href: Optional[StrictStr] = None price: Optional[Union[StrictFloat, StrictInt]] = None - __properties = ["href", "price"] + __properties: ClassVar[List[str]] = ["href", "price"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> SpotPricesPerBaremetal: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpotPricesPerBaremetal from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> SpotPricesPerBaremetal: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpotPricesPerBaremetal from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpotPricesPerBaremetal.parse_obj(obj) + return cls.model_validate(obj) - _obj = SpotPricesPerBaremetal.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), "price": obj.get("price") }) diff --git a/equinix_metal/equinix_metal/models/spot_prices_per_facility.py b/equinix_metal/equinix_metal/models/spot_prices_per_facility.py index 305e22e7..c2b15a86 100644 --- a/equinix_metal/equinix_metal/models/spot_prices_per_facility.py +++ b/equinix_metal/equinix_metal/models/spot_prices_per_facility.py @@ -18,15 +18,16 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.spot_prices_per_baremetal import SpotPricesPerBaremetal +from typing import Optional, Set +from typing_extensions import Self class SpotPricesPerFacility(BaseModel): """ SpotPricesPerFacility - """ + """ # noqa: E501 baremetal_0: Optional[SpotPricesPerBaremetal] = None baremetal_1: Optional[SpotPricesPerBaremetal] = None baremetal_2: Optional[SpotPricesPerBaremetal] = None @@ -34,35 +35,50 @@ class SpotPricesPerFacility(BaseModel): baremetal_2a2: Optional[SpotPricesPerBaremetal] = None baremetal_3: Optional[SpotPricesPerBaremetal] = None baremetal_s: Optional[SpotPricesPerBaremetal] = None - c2_medium_x86: Optional[SpotPricesPerBaremetal] = Field(None, alias="c2.medium.x86") + c2_medium_x86: Optional[SpotPricesPerBaremetal] = Field(default=None, alias="c2.medium.x86") href: Optional[StrictStr] = None - m2_xlarge_x86: Optional[SpotPricesPerBaremetal] = Field(None, alias="m2.xlarge.x86") - __properties = ["baremetal_0", "baremetal_1", "baremetal_2", "baremetal_2a", "baremetal_2a2", "baremetal_3", "baremetal_s", "c2.medium.x86", "href", "m2.xlarge.x86"] + m2_xlarge_x86: Optional[SpotPricesPerBaremetal] = Field(default=None, alias="m2.xlarge.x86") + __properties: ClassVar[List[str]] = ["baremetal_0", "baremetal_1", "baremetal_2", "baremetal_2a", "baremetal_2a2", "baremetal_3", "baremetal_s", "c2.medium.x86", "href", "m2.xlarge.x86"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> SpotPricesPerFacility: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpotPricesPerFacility from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of baremetal_0 if self.baremetal_0: _dict['baremetal_0'] = self.baremetal_0.to_dict() @@ -93,25 +109,25 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> SpotPricesPerFacility: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpotPricesPerFacility from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpotPricesPerFacility.parse_obj(obj) - - _obj = SpotPricesPerFacility.parse_obj({ - "baremetal_0": SpotPricesPerBaremetal.from_dict(obj.get("baremetal_0")) if obj.get("baremetal_0") is not None else None, - "baremetal_1": SpotPricesPerBaremetal.from_dict(obj.get("baremetal_1")) if obj.get("baremetal_1") is not None else None, - "baremetal_2": SpotPricesPerBaremetal.from_dict(obj.get("baremetal_2")) if obj.get("baremetal_2") is not None else None, - "baremetal_2a": SpotPricesPerBaremetal.from_dict(obj.get("baremetal_2a")) if obj.get("baremetal_2a") is not None else None, - "baremetal_2a2": SpotPricesPerBaremetal.from_dict(obj.get("baremetal_2a2")) if obj.get("baremetal_2a2") is not None else None, - "baremetal_3": SpotPricesPerBaremetal.from_dict(obj.get("baremetal_3")) if obj.get("baremetal_3") is not None else None, - "baremetal_s": SpotPricesPerBaremetal.from_dict(obj.get("baremetal_s")) if obj.get("baremetal_s") is not None else None, - "c2_medium_x86": SpotPricesPerBaremetal.from_dict(obj.get("c2.medium.x86")) if obj.get("c2.medium.x86") is not None else None, + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "baremetal_0": SpotPricesPerBaremetal.from_dict(obj["baremetal_0"]) if obj.get("baremetal_0") is not None else None, + "baremetal_1": SpotPricesPerBaremetal.from_dict(obj["baremetal_1"]) if obj.get("baremetal_1") is not None else None, + "baremetal_2": SpotPricesPerBaremetal.from_dict(obj["baremetal_2"]) if obj.get("baremetal_2") is not None else None, + "baremetal_2a": SpotPricesPerBaremetal.from_dict(obj["baremetal_2a"]) if obj.get("baremetal_2a") is not None else None, + "baremetal_2a2": SpotPricesPerBaremetal.from_dict(obj["baremetal_2a2"]) if obj.get("baremetal_2a2") is not None else None, + "baremetal_3": SpotPricesPerBaremetal.from_dict(obj["baremetal_3"]) if obj.get("baremetal_3") is not None else None, + "baremetal_s": SpotPricesPerBaremetal.from_dict(obj["baremetal_s"]) if obj.get("baremetal_s") is not None else None, + "c2.medium.x86": SpotPricesPerBaremetal.from_dict(obj["c2.medium.x86"]) if obj.get("c2.medium.x86") is not None else None, "href": obj.get("href"), - "m2_xlarge_x86": SpotPricesPerBaremetal.from_dict(obj.get("m2.xlarge.x86")) if obj.get("m2.xlarge.x86") is not None else None + "m2.xlarge.x86": SpotPricesPerBaremetal.from_dict(obj["m2.xlarge.x86"]) if obj.get("m2.xlarge.x86") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/spot_prices_per_new_facility.py b/equinix_metal/equinix_metal/models/spot_prices_per_new_facility.py index d48120ab..20065772 100644 --- a/equinix_metal/equinix_metal/models/spot_prices_per_new_facility.py +++ b/equinix_metal/equinix_metal/models/spot_prices_per_new_facility.py @@ -18,59 +18,75 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.spot_prices_per_baremetal import SpotPricesPerBaremetal +from typing import Optional, Set +from typing_extensions import Self class SpotPricesPerNewFacility(BaseModel): """ SpotPricesPerNewFacility - """ + """ # noqa: E501 baremetal_1e: Optional[SpotPricesPerBaremetal] = None href: Optional[StrictStr] = None - __properties = ["baremetal_1e", "href"] + __properties: ClassVar[List[str]] = ["baremetal_1e", "href"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> SpotPricesPerNewFacility: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpotPricesPerNewFacility from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of baremetal_1e if self.baremetal_1e: _dict['baremetal_1e'] = self.baremetal_1e.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> SpotPricesPerNewFacility: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpotPricesPerNewFacility from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpotPricesPerNewFacility.parse_obj(obj) + return cls.model_validate(obj) - _obj = SpotPricesPerNewFacility.parse_obj({ - "baremetal_1e": SpotPricesPerBaremetal.from_dict(obj.get("baremetal_1e")) if obj.get("baremetal_1e") is not None else None, + _obj = cls.model_validate({ + "baremetal_1e": SpotPricesPerBaremetal.from_dict(obj["baremetal_1e"]) if obj.get("baremetal_1e") is not None else None, "href": obj.get("href") }) return _obj diff --git a/equinix_metal/equinix_metal/models/spot_prices_report.py b/equinix_metal/equinix_metal/models/spot_prices_report.py index 702748f1..c3a32834 100644 --- a/equinix_metal/equinix_metal/models/spot_prices_report.py +++ b/equinix_metal/equinix_metal/models/spot_prices_report.py @@ -18,16 +18,17 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.spot_prices_per_facility import SpotPricesPerFacility from equinix_metal.models.spot_prices_per_new_facility import SpotPricesPerNewFacility +from typing import Optional, Set +from typing_extensions import Self class SpotPricesReport(BaseModel): """ SpotPricesReport - """ + """ # noqa: E501 ams1: Optional[SpotPricesPerFacility] = None atl1: Optional[SpotPricesPerNewFacility] = None dfw1: Optional[SpotPricesPerNewFacility] = None @@ -43,32 +44,47 @@ class SpotPricesReport(BaseModel): sjc1: Optional[SpotPricesPerFacility] = None syd1: Optional[SpotPricesPerNewFacility] = None yyz1: Optional[SpotPricesPerNewFacility] = None - __properties = ["ams1", "atl1", "dfw1", "ewr1", "fra1", "href", "iad1", "lax1", "nrt1", "ord1", "sea1", "sin1", "sjc1", "syd1", "yyz1"] + __properties: ClassVar[List[str]] = ["ams1", "atl1", "dfw1", "ewr1", "fra1", "href", "iad1", "lax1", "nrt1", "ord1", "sea1", "sin1", "sjc1", "syd1", "yyz1"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> SpotPricesReport: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpotPricesReport from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of ams1 if self.ams1: _dict['ams1'] = self.ams1.to_dict() @@ -114,30 +130,30 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> SpotPricesReport: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpotPricesReport from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpotPricesReport.parse_obj(obj) - - _obj = SpotPricesReport.parse_obj({ - "ams1": SpotPricesPerFacility.from_dict(obj.get("ams1")) if obj.get("ams1") is not None else None, - "atl1": SpotPricesPerNewFacility.from_dict(obj.get("atl1")) if obj.get("atl1") is not None else None, - "dfw1": SpotPricesPerNewFacility.from_dict(obj.get("dfw1")) if obj.get("dfw1") is not None else None, - "ewr1": SpotPricesPerFacility.from_dict(obj.get("ewr1")) if obj.get("ewr1") is not None else None, - "fra1": SpotPricesPerNewFacility.from_dict(obj.get("fra1")) if obj.get("fra1") is not None else None, + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "ams1": SpotPricesPerFacility.from_dict(obj["ams1"]) if obj.get("ams1") is not None else None, + "atl1": SpotPricesPerNewFacility.from_dict(obj["atl1"]) if obj.get("atl1") is not None else None, + "dfw1": SpotPricesPerNewFacility.from_dict(obj["dfw1"]) if obj.get("dfw1") is not None else None, + "ewr1": SpotPricesPerFacility.from_dict(obj["ewr1"]) if obj.get("ewr1") is not None else None, + "fra1": SpotPricesPerNewFacility.from_dict(obj["fra1"]) if obj.get("fra1") is not None else None, "href": obj.get("href"), - "iad1": SpotPricesPerNewFacility.from_dict(obj.get("iad1")) if obj.get("iad1") is not None else None, - "lax1": SpotPricesPerNewFacility.from_dict(obj.get("lax1")) if obj.get("lax1") is not None else None, - "nrt1": SpotPricesPerFacility.from_dict(obj.get("nrt1")) if obj.get("nrt1") is not None else None, - "ord1": SpotPricesPerNewFacility.from_dict(obj.get("ord1")) if obj.get("ord1") is not None else None, - "sea1": SpotPricesPerNewFacility.from_dict(obj.get("sea1")) if obj.get("sea1") is not None else None, - "sin1": SpotPricesPerNewFacility.from_dict(obj.get("sin1")) if obj.get("sin1") is not None else None, - "sjc1": SpotPricesPerFacility.from_dict(obj.get("sjc1")) if obj.get("sjc1") is not None else None, - "syd1": SpotPricesPerNewFacility.from_dict(obj.get("syd1")) if obj.get("syd1") is not None else None, - "yyz1": SpotPricesPerNewFacility.from_dict(obj.get("yyz1")) if obj.get("yyz1") is not None else None + "iad1": SpotPricesPerNewFacility.from_dict(obj["iad1"]) if obj.get("iad1") is not None else None, + "lax1": SpotPricesPerNewFacility.from_dict(obj["lax1"]) if obj.get("lax1") is not None else None, + "nrt1": SpotPricesPerFacility.from_dict(obj["nrt1"]) if obj.get("nrt1") is not None else None, + "ord1": SpotPricesPerNewFacility.from_dict(obj["ord1"]) if obj.get("ord1") is not None else None, + "sea1": SpotPricesPerNewFacility.from_dict(obj["sea1"]) if obj.get("sea1") is not None else None, + "sin1": SpotPricesPerNewFacility.from_dict(obj["sin1"]) if obj.get("sin1") is not None else None, + "sjc1": SpotPricesPerFacility.from_dict(obj["sjc1"]) if obj.get("sjc1") is not None else None, + "syd1": SpotPricesPerNewFacility.from_dict(obj["syd1"]) if obj.get("syd1") is not None else None, + "yyz1": SpotPricesPerNewFacility.from_dict(obj["yyz1"]) if obj.get("yyz1") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/ssh_key.py b/equinix_metal/equinix_metal/models/ssh_key.py index 81cb19e0..38cd2012 100644 --- a/equinix_metal/equinix_metal/models/ssh_key.py +++ b/equinix_metal/equinix_metal/models/ssh_key.py @@ -19,14 +19,16 @@ import json from datetime import datetime -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.href import Href +from typing import Optional, Set +from typing_extensions import Self class SSHKey(BaseModel): """ SSHKey - """ + """ # noqa: E501 created_at: Optional[datetime] = None entity: Optional[Href] = None fingerprint: Optional[StrictStr] = None @@ -34,51 +36,66 @@ class SSHKey(BaseModel): id: Optional[StrictStr] = None key: Optional[StrictStr] = None label: Optional[StrictStr] = None - tags: Optional[conlist(StrictStr)] = None + tags: Optional[List[StrictStr]] = None updated_at: Optional[datetime] = None - __properties = ["created_at", "entity", "fingerprint", "href", "id", "key", "label", "tags", "updated_at"] + __properties: ClassVar[List[str]] = ["created_at", "entity", "fingerprint", "href", "id", "key", "label", "tags", "updated_at"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> SSHKey: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SSHKey from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of entity if self.entity: _dict['entity'] = self.entity.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> SSHKey: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SSHKey from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SSHKey.parse_obj(obj) + return cls.model_validate(obj) - _obj = SSHKey.parse_obj({ + _obj = cls.model_validate({ "created_at": obj.get("created_at"), - "entity": Href.from_dict(obj.get("entity")) if obj.get("entity") is not None else None, + "entity": Href.from_dict(obj["entity"]) if obj.get("entity") is not None else None, "fingerprint": obj.get("fingerprint"), "href": obj.get("href"), "id": obj.get("id"), diff --git a/equinix_metal/equinix_metal/models/ssh_key_create_input.py b/equinix_metal/equinix_metal/models/ssh_key_create_input.py index 4311a3e4..186c4cc5 100644 --- a/equinix_metal/equinix_metal/models/ssh_key_create_input.py +++ b/equinix_metal/equinix_metal/models/ssh_key_create_input.py @@ -18,57 +18,73 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class SSHKeyCreateInput(BaseModel): """ SSHKeyCreateInput - """ + """ # noqa: E501 href: Optional[StrictStr] = None - instances_ids: Optional[conlist(StrictStr)] = Field(None, description="List of instance UUIDs to associate SSH key with, when empty array is sent all instances belonging to entity will be included") + instances_ids: Optional[List[StrictStr]] = Field(default=None, description="List of instance UUIDs to associate SSH key with, when empty array is sent all instances belonging to entity will be included") key: Optional[StrictStr] = None label: Optional[StrictStr] = None - tags: Optional[conlist(StrictStr)] = None - __properties = ["href", "instances_ids", "key", "label", "tags"] + tags: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["href", "instances_ids", "key", "label", "tags"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> SSHKeyCreateInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SSHKeyCreateInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> SSHKeyCreateInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SSHKeyCreateInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SSHKeyCreateInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = SSHKeyCreateInput.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), "instances_ids": obj.get("instances_ids"), "key": obj.get("key"), diff --git a/equinix_metal/equinix_metal/models/ssh_key_input.py b/equinix_metal/equinix_metal/models/ssh_key_input.py index a61ace86..714e5719 100644 --- a/equinix_metal/equinix_metal/models/ssh_key_input.py +++ b/equinix_metal/equinix_metal/models/ssh_key_input.py @@ -18,56 +18,72 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class SSHKeyInput(BaseModel): """ SSHKeyInput - """ + """ # noqa: E501 href: Optional[StrictStr] = None key: Optional[StrictStr] = None label: Optional[StrictStr] = None - tags: Optional[conlist(StrictStr)] = None - __properties = ["href", "key", "label", "tags"] + tags: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["href", "key", "label", "tags"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> SSHKeyInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SSHKeyInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> SSHKeyInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SSHKeyInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SSHKeyInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = SSHKeyInput.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), "key": obj.get("key"), "label": obj.get("label"), diff --git a/equinix_metal/equinix_metal/models/ssh_key_list.py b/equinix_metal/equinix_metal/models/ssh_key_list.py index c42ed127..ad4de2fe 100644 --- a/equinix_metal/equinix_metal/models/ssh_key_list.py +++ b/equinix_metal/equinix_metal/models/ssh_key_list.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.ssh_key import SSHKey +from typing import Optional, Set +from typing_extensions import Self class SSHKeyList(BaseModel): """ SSHKeyList - """ + """ # noqa: E501 href: Optional[StrictStr] = None - ssh_keys: Optional[conlist(SSHKey)] = None - __properties = ["href", "ssh_keys"] + ssh_keys: Optional[List[SSHKey]] = None + __properties: ClassVar[List[str]] = ["href", "ssh_keys"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> SSHKeyList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SSHKeyList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in ssh_keys (list) _items = [] if self.ssh_keys: @@ -65,17 +81,17 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> SSHKeyList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SSHKeyList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SSHKeyList.parse_obj(obj) + return cls.model_validate(obj) - _obj = SSHKeyList.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "ssh_keys": [SSHKey.from_dict(_item) for _item in obj.get("ssh_keys")] if obj.get("ssh_keys") is not None else None + "ssh_keys": [SSHKey.from_dict(_item) for _item in obj["ssh_keys"]] if obj.get("ssh_keys") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/storage.py b/equinix_metal/equinix_metal/models/storage.py index d373e34d..2b91145f 100644 --- a/equinix_metal/equinix_metal/models/storage.py +++ b/equinix_metal/equinix_metal/models/storage.py @@ -18,47 +18,63 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.disk import Disk from equinix_metal.models.filesystem import Filesystem from equinix_metal.models.raid import Raid +from typing import Optional, Set +from typing_extensions import Self class Storage(BaseModel): """ Storage - """ - disks: Optional[conlist(Disk)] = None - filesystems: Optional[conlist(Filesystem)] = None + """ # noqa: E501 + disks: Optional[List[Disk]] = None + filesystems: Optional[List[Filesystem]] = None href: Optional[StrictStr] = None - raid: Optional[conlist(Raid)] = None - __properties = ["disks", "filesystems", "href", "raid"] + raid: Optional[List[Raid]] = None + __properties: ClassVar[List[str]] = ["disks", "filesystems", "href", "raid"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> Storage: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Storage from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in disks (list) _items = [] if self.disks: @@ -83,19 +99,19 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> Storage: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Storage from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Storage.parse_obj(obj) + return cls.model_validate(obj) - _obj = Storage.parse_obj({ - "disks": [Disk.from_dict(_item) for _item in obj.get("disks")] if obj.get("disks") is not None else None, - "filesystems": [Filesystem.from_dict(_item) for _item in obj.get("filesystems")] if obj.get("filesystems") is not None else None, + _obj = cls.model_validate({ + "disks": [Disk.from_dict(_item) for _item in obj["disks"]] if obj.get("disks") is not None else None, + "filesystems": [Filesystem.from_dict(_item) for _item in obj["filesystems"]] if obj.get("filesystems") is not None else None, "href": obj.get("href"), - "raid": [Raid.from_dict(_item) for _item in obj.get("raid")] if obj.get("raid") is not None else None + "raid": [Raid.from_dict(_item) for _item in obj["raid"]] if obj.get("raid") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/support_request_input.py b/equinix_metal/equinix_metal/models/support_request_input.py index 67ae69b9..08a935e3 100644 --- a/equinix_metal/equinix_metal/models/support_request_input.py +++ b/equinix_metal/equinix_metal/models/support_request_input.py @@ -18,68 +18,84 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr, validator +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class SupportRequestInput(BaseModel): """ SupportRequestInput - """ + """ # noqa: E501 device_id: Optional[StrictStr] = None href: Optional[StrictStr] = None - message: StrictStr = Field(...) + message: StrictStr priority: Optional[StrictStr] = None project_id: Optional[StrictStr] = None - subject: StrictStr = Field(...) - __properties = ["device_id", "href", "message", "priority", "project_id", "subject"] + subject: StrictStr + __properties: ClassVar[List[str]] = ["device_id", "href", "message", "priority", "project_id", "subject"] - @validator('priority') + @field_validator('priority') def priority_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('urgent', 'high', 'medium', 'low'): + if value not in set(['urgent', 'high', 'medium', 'low']): raise ValueError("must be one of enum values ('urgent', 'high', 'medium', 'low')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> SupportRequestInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SupportRequestInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> SupportRequestInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SupportRequestInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SupportRequestInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = SupportRequestInput.parse_obj({ + _obj = cls.model_validate({ "device_id": obj.get("device_id"), "href": obj.get("href"), "message": obj.get("message"), diff --git a/equinix_metal/equinix_metal/models/transfer_request.py b/equinix_metal/equinix_metal/models/transfer_request.py index 92c1742b..09fc3a31 100644 --- a/equinix_metal/equinix_metal/models/transfer_request.py +++ b/equinix_metal/equinix_metal/models/transfer_request.py @@ -19,46 +19,63 @@ import json from datetime import datetime -from typing import Optional -from pydantic import BaseModel, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.href import Href +from typing import Optional, Set +from typing_extensions import Self class TransferRequest(BaseModel): """ TransferRequest - """ + """ # noqa: E501 created_at: Optional[datetime] = None href: Optional[StrictStr] = None id: Optional[StrictStr] = None project: Optional[Href] = None target_organization: Optional[Href] = None updated_at: Optional[datetime] = None - __properties = ["created_at", "href", "id", "project", "target_organization", "updated_at"] + __properties: ClassVar[List[str]] = ["created_at", "href", "id", "project", "target_organization", "updated_at"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> TransferRequest: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of TransferRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of project if self.project: _dict['project'] = self.project.to_dict() @@ -68,20 +85,20 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> TransferRequest: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of TransferRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return TransferRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = TransferRequest.parse_obj({ + _obj = cls.model_validate({ "created_at": obj.get("created_at"), "href": obj.get("href"), "id": obj.get("id"), - "project": Href.from_dict(obj.get("project")) if obj.get("project") is not None else None, - "target_organization": Href.from_dict(obj.get("target_organization")) if obj.get("target_organization") is not None else None, + "project": Href.from_dict(obj["project"]) if obj.get("project") is not None else None, + "target_organization": Href.from_dict(obj["target_organization"]) if obj.get("target_organization") is not None else None, "updated_at": obj.get("updated_at") }) return _obj diff --git a/equinix_metal/equinix_metal/models/transfer_request_input.py b/equinix_metal/equinix_metal/models/transfer_request_input.py index 7f5a733d..92258ba3 100644 --- a/equinix_metal/equinix_metal/models/transfer_request_input.py +++ b/equinix_metal/equinix_metal/models/transfer_request_input.py @@ -18,54 +18,70 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class TransferRequestInput(BaseModel): """ TransferRequestInput - """ + """ # noqa: E501 href: Optional[StrictStr] = None target_organization_id: Optional[StrictStr] = None - __properties = ["href", "target_organization_id"] + __properties: ClassVar[List[str]] = ["href", "target_organization_id"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> TransferRequestInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of TransferRequestInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> TransferRequestInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of TransferRequestInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return TransferRequestInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = TransferRequestInput.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), "target_organization_id": obj.get("target_organization_id") }) diff --git a/equinix_metal/equinix_metal/models/transfer_request_list.py b/equinix_metal/equinix_metal/models/transfer_request_list.py index 40ba6b18..e21c3905 100644 --- a/equinix_metal/equinix_metal/models/transfer_request_list.py +++ b/equinix_metal/equinix_metal/models/transfer_request_list.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.transfer_request import TransferRequest +from typing import Optional, Set +from typing_extensions import Self class TransferRequestList(BaseModel): """ TransferRequestList - """ + """ # noqa: E501 href: Optional[StrictStr] = None - transfers: Optional[conlist(TransferRequest)] = None - __properties = ["href", "transfers"] + transfers: Optional[List[TransferRequest]] = None + __properties: ClassVar[List[str]] = ["href", "transfers"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> TransferRequestList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of TransferRequestList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in transfers (list) _items = [] if self.transfers: @@ -65,17 +81,17 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> TransferRequestList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of TransferRequestList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return TransferRequestList.parse_obj(obj) + return cls.model_validate(obj) - _obj = TransferRequestList.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "transfers": [TransferRequest.from_dict(_item) for _item in obj.get("transfers")] if obj.get("transfers") is not None else None + "transfers": [TransferRequest.from_dict(_item) for _item in obj["transfers"]] if obj.get("transfers") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/update_email_input.py b/equinix_metal/equinix_metal/models/update_email_input.py index 6d99a78c..3688b3d2 100644 --- a/equinix_metal/equinix_metal/models/update_email_input.py +++ b/equinix_metal/equinix_metal/models/update_email_input.py @@ -18,54 +18,70 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictBool, StrictStr +from pydantic import BaseModel, ConfigDict, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class UpdateEmailInput(BaseModel): """ UpdateEmailInput - """ + """ # noqa: E501 default: Optional[StrictBool] = None href: Optional[StrictStr] = None - __properties = ["default", "href"] + __properties: ClassVar[List[str]] = ["default", "href"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> UpdateEmailInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of UpdateEmailInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> UpdateEmailInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of UpdateEmailInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return UpdateEmailInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = UpdateEmailInput.parse_obj({ + _obj = cls.model_validate({ "default": obj.get("default"), "href": obj.get("href") }) diff --git a/equinix_metal/equinix_metal/models/user.py b/equinix_metal/equinix_metal/models/user.py index 42eb2a66..3a54604f 100644 --- a/equinix_metal/equinix_metal/models/user.py +++ b/equinix_metal/equinix_metal/models/user.py @@ -19,14 +19,16 @@ import json from datetime import datetime -from typing import Any, Dict, List, Optional -from pydantic import BaseModel, StrictInt, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.href import Href +from typing import Optional, Set +from typing_extensions import Self class User(BaseModel): """ User - """ + """ # noqa: E501 avatar_thumb_url: Optional[StrictStr] = None avatar_url: Optional[StrictStr] = None created_at: Optional[datetime] = None @@ -34,7 +36,7 @@ class User(BaseModel): default_organization_id: Optional[StrictStr] = None default_project_id: Optional[StrictStr] = None email: Optional[StrictStr] = None - emails: Optional[conlist(Href)] = None + emails: Optional[List[Href]] = None first_name: Optional[StrictStr] = None fraud_score: Optional[StrictStr] = None full_name: Optional[StrictStr] = None @@ -49,32 +51,47 @@ class User(BaseModel): timezone: Optional[StrictStr] = None two_factor_auth: Optional[StrictStr] = None updated_at: Optional[datetime] = None - __properties = ["avatar_thumb_url", "avatar_url", "created_at", "customdata", "default_organization_id", "default_project_id", "email", "emails", "first_name", "fraud_score", "full_name", "href", "id", "last_login_at", "last_name", "max_organizations", "max_projects", "phone_number", "short_id", "timezone", "two_factor_auth", "updated_at"] + __properties: ClassVar[List[str]] = ["avatar_thumb_url", "avatar_url", "created_at", "customdata", "default_organization_id", "default_project_id", "email", "emails", "first_name", "fraud_score", "full_name", "href", "id", "last_login_at", "last_name", "max_organizations", "max_projects", "phone_number", "short_id", "timezone", "two_factor_auth", "updated_at"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> User: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of User from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in emails (list) _items = [] if self.emails: @@ -85,15 +102,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> User: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of User from a dict""" if obj is None: return None if not isinstance(obj, dict): - return User.parse_obj(obj) + return cls.model_validate(obj) - _obj = User.parse_obj({ + _obj = cls.model_validate({ "avatar_thumb_url": obj.get("avatar_thumb_url"), "avatar_url": obj.get("avatar_url"), "created_at": obj.get("created_at"), @@ -101,7 +118,7 @@ def from_dict(cls, obj: dict) -> User: "default_organization_id": obj.get("default_organization_id"), "default_project_id": obj.get("default_project_id"), "email": obj.get("email"), - "emails": [Href.from_dict(_item) for _item in obj.get("emails")] if obj.get("emails") is not None else None, + "emails": [Href.from_dict(_item) for _item in obj["emails"]] if obj.get("emails") is not None else None, "first_name": obj.get("first_name"), "fraud_score": obj.get("fraud_score"), "full_name": obj.get("full_name"), diff --git a/equinix_metal/equinix_metal/models/user_create_input.py b/equinix_metal/equinix_metal/models/user_create_input.py index 7114ed52..bc42c2b6 100644 --- a/equinix_metal/equinix_metal/models/user_create_input.py +++ b/equinix_metal/equinix_metal/models/user_create_input.py @@ -19,23 +19,25 @@ import json from datetime import datetime -from typing import Any, Dict, List, Optional, Union -from pydantic import BaseModel, Field, StrictBytes, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictBytes, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union from equinix_metal.models.email_input import EmailInput +from typing import Optional, Set +from typing_extensions import Self class UserCreateInput(BaseModel): """ UserCreateInput - """ + """ # noqa: E501 avatar: Optional[Union[StrictBytes, StrictStr]] = None company_name: Optional[StrictStr] = None company_url: Optional[StrictStr] = None customdata: Optional[Dict[str, Any]] = None - emails: conlist(EmailInput) = Field(...) - first_name: StrictStr = Field(...) + emails: List[EmailInput] + first_name: StrictStr href: Optional[StrictStr] = None invitation_id: Optional[StrictStr] = None - last_name: StrictStr = Field(...) + last_name: StrictStr level: Optional[StrictStr] = None nonce: Optional[StrictStr] = None password: Optional[StrictStr] = None @@ -45,32 +47,47 @@ class UserCreateInput(BaseModel): title: Optional[StrictStr] = None two_factor_auth: Optional[StrictStr] = None verified_at: Optional[datetime] = None - __properties = ["avatar", "company_name", "company_url", "customdata", "emails", "first_name", "href", "invitation_id", "last_name", "level", "nonce", "password", "phone_number", "social_accounts", "timezone", "title", "two_factor_auth", "verified_at"] + __properties: ClassVar[List[str]] = ["avatar", "company_name", "company_url", "customdata", "emails", "first_name", "href", "invitation_id", "last_name", "level", "nonce", "password", "phone_number", "social_accounts", "timezone", "title", "two_factor_auth", "verified_at"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> UserCreateInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of UserCreateInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in emails (list) _items = [] if self.emails: @@ -81,20 +98,20 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> UserCreateInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of UserCreateInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return UserCreateInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = UserCreateInput.parse_obj({ + _obj = cls.model_validate({ "avatar": obj.get("avatar"), "company_name": obj.get("company_name"), "company_url": obj.get("company_url"), "customdata": obj.get("customdata"), - "emails": [EmailInput.from_dict(_item) for _item in obj.get("emails")] if obj.get("emails") is not None else None, + "emails": [EmailInput.from_dict(_item) for _item in obj["emails"]] if obj.get("emails") is not None else None, "first_name": obj.get("first_name"), "href": obj.get("href"), "invitation_id": obj.get("invitation_id"), diff --git a/equinix_metal/equinix_metal/models/user_limited.py b/equinix_metal/equinix_metal/models/user_limited.py index 01947d86..3ef8d9cd 100644 --- a/equinix_metal/equinix_metal/models/user_limited.py +++ b/equinix_metal/equinix_metal/models/user_limited.py @@ -18,57 +18,73 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class UserLimited(BaseModel): """ UserLimited - """ - avatar_thumb_url: Optional[StrictStr] = Field(None, description="Avatar thumbnail URL of the User") - avatar_url: Optional[StrictStr] = Field(None, description="Avatar URL of the User") - full_name: Optional[StrictStr] = Field(None, description="Full name of the User") - href: Optional[StrictStr] = Field(None, description="API URL uniquely representing the User") - id: StrictStr = Field(..., description="ID of the User") - __properties = ["avatar_thumb_url", "avatar_url", "full_name", "href", "id"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """ # noqa: E501 + avatar_thumb_url: Optional[StrictStr] = Field(default=None, description="Avatar thumbnail URL of the User") + avatar_url: Optional[StrictStr] = Field(default=None, description="Avatar URL of the User") + full_name: Optional[StrictStr] = Field(default=None, description="Full name of the User") + href: Optional[StrictStr] = Field(default=None, description="API URL uniquely representing the User") + id: StrictStr = Field(description="ID of the User") + __properties: ClassVar[List[str]] = ["avatar_thumb_url", "avatar_url", "full_name", "href", "id"] + + 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.dict(by_alias=True)) + 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) -> UserLimited: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of UserLimited from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> UserLimited: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of UserLimited from a dict""" if obj is None: return None if not isinstance(obj, dict): - return UserLimited.parse_obj(obj) + return cls.model_validate(obj) - _obj = UserLimited.parse_obj({ + _obj = cls.model_validate({ "avatar_thumb_url": obj.get("avatar_thumb_url"), "avatar_url": obj.get("avatar_url"), "full_name": obj.get("full_name"), diff --git a/equinix_metal/equinix_metal/models/user_list.py b/equinix_metal/equinix_metal/models/user_list.py index 5d52b1a0..dbecf4ac 100644 --- a/equinix_metal/equinix_metal/models/user_list.py +++ b/equinix_metal/equinix_metal/models/user_list.py @@ -18,45 +18,61 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.meta import Meta from equinix_metal.models.user import User +from typing import Optional, Set +from typing_extensions import Self class UserList(BaseModel): """ UserList - """ + """ # noqa: E501 href: Optional[StrictStr] = None meta: Optional[Meta] = None - users: Optional[conlist(User)] = None - __properties = ["href", "meta", "users"] + users: Optional[List[User]] = None + __properties: ClassVar[List[str]] = ["href", "meta", "users"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> UserList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of UserList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of meta if self.meta: _dict['meta'] = self.meta.to_dict() @@ -70,18 +86,18 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> UserList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of UserList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return UserList.parse_obj(obj) + return cls.model_validate(obj) - _obj = UserList.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "meta": Meta.from_dict(obj.get("meta")) if obj.get("meta") is not None else None, - "users": [User.from_dict(_item) for _item in obj.get("users")] if obj.get("users") is not None else None + "meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None, + "users": [User.from_dict(_item) for _item in obj["users"]] if obj.get("users") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/user_lite.py b/equinix_metal/equinix_metal/models/user_lite.py index 08cce5b3..99bc5672 100644 --- a/equinix_metal/equinix_metal/models/user_lite.py +++ b/equinix_metal/equinix_metal/models/user_lite.py @@ -19,61 +19,78 @@ import json from datetime import datetime -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class UserLite(BaseModel): """ UserLite - """ - avatar_thumb_url: Optional[StrictStr] = Field(None, description="Avatar thumbnail URL of the User") - created_at: Optional[datetime] = Field(None, description="When the user was created") - email: Optional[StrictStr] = Field(None, description="Primary email address of the User") - first_name: Optional[StrictStr] = Field(None, description="First name of the User") - full_name: Optional[StrictStr] = Field(None, description="Full name of the User") - href: Optional[StrictStr] = Field(None, description="API URL uniquely representing the User") - id: StrictStr = Field(..., description="ID of the User") - last_name: Optional[StrictStr] = Field(None, description="Last name of the User") - short_id: StrictStr = Field(..., description="Short ID of the User") - updated_at: Optional[datetime] = Field(None, description="When the user details were last updated") - __properties = ["avatar_thumb_url", "created_at", "email", "first_name", "full_name", "href", "id", "last_name", "short_id", "updated_at"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """ # noqa: E501 + avatar_thumb_url: Optional[StrictStr] = Field(default=None, description="Avatar thumbnail URL of the User") + created_at: Optional[datetime] = Field(default=None, description="When the user was created") + email: Optional[StrictStr] = Field(default=None, description="Primary email address of the User") + first_name: Optional[StrictStr] = Field(default=None, description="First name of the User") + full_name: Optional[StrictStr] = Field(default=None, description="Full name of the User") + href: Optional[StrictStr] = Field(default=None, description="API URL uniquely representing the User") + id: StrictStr = Field(description="ID of the User") + last_name: Optional[StrictStr] = Field(default=None, description="Last name of the User") + short_id: StrictStr = Field(description="Short ID of the User") + updated_at: Optional[datetime] = Field(default=None, description="When the user details were last updated") + __properties: ClassVar[List[str]] = ["avatar_thumb_url", "created_at", "email", "first_name", "full_name", "href", "id", "last_name", "short_id", "updated_at"] + + 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.dict(by_alias=True)) + 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) -> UserLite: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of UserLite from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> UserLite: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of UserLite from a dict""" if obj is None: return None if not isinstance(obj, dict): - return UserLite.parse_obj(obj) + return cls.model_validate(obj) - _obj = UserLite.parse_obj({ + _obj = cls.model_validate({ "avatar_thumb_url": obj.get("avatar_thumb_url"), "created_at": obj.get("created_at"), "email": obj.get("email"), diff --git a/equinix_metal/equinix_metal/models/user_update_input.py b/equinix_metal/equinix_metal/models/user_update_input.py index a126a25f..e016e8e4 100644 --- a/equinix_metal/equinix_metal/models/user_update_input.py +++ b/equinix_metal/equinix_metal/models/user_update_input.py @@ -18,14 +18,15 @@ import re # noqa: F401 import json - -from typing import Any, Dict, Optional -from pydantic import BaseModel, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class UserUpdateInput(BaseModel): """ UserUpdateInput - """ + """ # noqa: E501 customdata: Optional[Dict[str, Any]] = None first_name: Optional[StrictStr] = None href: Optional[StrictStr] = None @@ -33,44 +34,59 @@ class UserUpdateInput(BaseModel): password: Optional[StrictStr] = None phone_number: Optional[StrictStr] = None timezone: Optional[StrictStr] = None - __properties = ["customdata", "first_name", "href", "last_name", "password", "phone_number", "timezone"] + __properties: ClassVar[List[str]] = ["customdata", "first_name", "href", "last_name", "password", "phone_number", "timezone"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> UserUpdateInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of UserUpdateInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> UserUpdateInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of UserUpdateInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return UserUpdateInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = UserUpdateInput.parse_obj({ + _obj = cls.model_validate({ "customdata": obj.get("customdata"), "first_name": obj.get("first_name"), "href": obj.get("href"), diff --git a/equinix_metal/equinix_metal/models/userdata.py b/equinix_metal/equinix_metal/models/userdata.py index 28a3fa01..7f86cc30 100644 --- a/equinix_metal/equinix_metal/models/userdata.py +++ b/equinix_metal/equinix_metal/models/userdata.py @@ -18,54 +18,70 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class Userdata(BaseModel): """ Userdata - """ + """ # noqa: E501 href: Optional[StrictStr] = None userdata: Optional[StrictStr] = None - __properties = ["href", "userdata"] + __properties: ClassVar[List[str]] = ["href", "userdata"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> Userdata: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Userdata from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> Userdata: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Userdata from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Userdata.parse_obj(obj) + return cls.model_validate(obj) - _obj = Userdata.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), "userdata": obj.get("userdata") }) diff --git a/equinix_metal/equinix_metal/models/verify_email.py b/equinix_metal/equinix_metal/models/verify_email.py index 978e027c..7fbe46a6 100644 --- a/equinix_metal/equinix_metal/models/verify_email.py +++ b/equinix_metal/equinix_metal/models/verify_email.py @@ -18,54 +18,70 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class VerifyEmail(BaseModel): """ VerifyEmail - """ + """ # noqa: E501 href: Optional[StrictStr] = None - user_token: StrictStr = Field(..., description="User verification token") - __properties = ["href", "user_token"] + user_token: StrictStr = Field(description="User verification token") + __properties: ClassVar[List[str]] = ["href", "user_token"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> VerifyEmail: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of VerifyEmail from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> VerifyEmail: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of VerifyEmail from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VerifyEmail.parse_obj(obj) + return cls.model_validate(obj) - _obj = VerifyEmail.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), "user_token": obj.get("user_token") }) diff --git a/equinix_metal/equinix_metal/models/virtual_circuit.py b/equinix_metal/equinix_metal/models/virtual_circuit.py index 4f0c192f..750ae2c8 100644 --- a/equinix_metal/equinix_metal/models/virtual_circuit.py +++ b/equinix_metal/equinix_metal/models/virtual_circuit.py @@ -14,17 +14,15 @@ from __future__ import annotations -from inspect import getfullargspec import json import pprint -import re # noqa: F401 - +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator from typing import Any, List, Optional -from pydantic import BaseModel, Field, StrictStr, ValidationError, validator from equinix_metal.models.vlan_virtual_circuit import VlanVirtualCircuit from equinix_metal.models.vrf_virtual_circuit import VrfVirtualCircuit -from typing import Union, Any, List, TYPE_CHECKING from pydantic import StrictStr, Field +from typing import Union, List, Optional, Dict +from typing_extensions import Literal, Self VIRTUALCIRCUIT_ONE_OF_SCHEMAS = ["VlanVirtualCircuit", "VrfVirtualCircuit"] @@ -36,16 +34,16 @@ class VirtualCircuit(BaseModel): oneof_schema_1_validator: Optional[VlanVirtualCircuit] = None # data type: VrfVirtualCircuit oneof_schema_2_validator: Optional[VrfVirtualCircuit] = None - if TYPE_CHECKING: - actual_instance: Union[VlanVirtualCircuit, VrfVirtualCircuit] - else: - actual_instance: Any - one_of_schemas: List[str] = Field(VIRTUALCIRCUIT_ONE_OF_SCHEMAS, const=True) + actual_instance: Optional[Union[VlanVirtualCircuit, VrfVirtualCircuit]] = None + one_of_schemas: List[str] = Field(default=Literal["VlanVirtualCircuit", "VrfVirtualCircuit"]) + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - validate_assignment = True - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: if args: if len(args) > 1: raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") @@ -55,9 +53,9 @@ def __init__(self, *args, **kwargs): else: super().__init__(**kwargs) - @validator('actual_instance') + @field_validator('actual_instance') def actual_instance_must_validate_oneof(cls, v): - instance = VirtualCircuit.construct() + instance = VirtualCircuit.model_construct() error_messages = [] match = 0 # validate data type: VlanVirtualCircuit @@ -80,13 +78,13 @@ def actual_instance_must_validate_oneof(cls, v): return v @classmethod - def from_dict(cls, obj: dict) -> VirtualCircuit: + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: return cls.from_json(json.dumps(obj)) @classmethod - def from_json(cls, json_str: str) -> VirtualCircuit: + def from_json(cls, json_str: str) -> Self: """Returns the object represented by the json string""" - instance = VirtualCircuit.construct() + instance = cls.model_construct() error_messages = [] match = 0 @@ -117,19 +115,17 @@ def to_json(self) -> str: if self.actual_instance is None: return "null" - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): return self.actual_instance.to_json() else: return json.dumps(self.actual_instance) - def to_dict(self) -> dict: + def to_dict(self) -> Optional[Union[Dict[str, Any], VlanVirtualCircuit, VrfVirtualCircuit]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None - to_dict = getattr(self.actual_instance, "to_dict", None) - if callable(to_dict): + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): return self.actual_instance.to_dict() else: # primitive type @@ -137,6 +133,6 @@ def to_dict(self) -> dict: def to_str(self) -> str: """Returns the string representation of the actual instance""" - return pprint.pformat(self.dict()) + return pprint.pformat(self.model_dump()) diff --git a/equinix_metal/equinix_metal/models/virtual_circuit_create_input.py b/equinix_metal/equinix_metal/models/virtual_circuit_create_input.py index aca97981..15819767 100644 --- a/equinix_metal/equinix_metal/models/virtual_circuit_create_input.py +++ b/equinix_metal/equinix_metal/models/virtual_circuit_create_input.py @@ -14,17 +14,15 @@ from __future__ import annotations -from inspect import getfullargspec import json import pprint -import re # noqa: F401 - +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator from typing import Any, List, Optional -from pydantic import BaseModel, Field, StrictStr, ValidationError, validator from equinix_metal.models.vlan_virtual_circuit_create_input import VlanVirtualCircuitCreateInput from equinix_metal.models.vrf_virtual_circuit_create_input import VrfVirtualCircuitCreateInput -from typing import Union, Any, List, TYPE_CHECKING from pydantic import StrictStr, Field +from typing import Union, List, Optional, Dict +from typing_extensions import Literal, Self VIRTUALCIRCUITCREATEINPUT_ONE_OF_SCHEMAS = ["VlanVirtualCircuitCreateInput", "VrfVirtualCircuitCreateInput"] @@ -36,16 +34,16 @@ class VirtualCircuitCreateInput(BaseModel): oneof_schema_1_validator: Optional[VlanVirtualCircuitCreateInput] = None # data type: VrfVirtualCircuitCreateInput oneof_schema_2_validator: Optional[VrfVirtualCircuitCreateInput] = None - if TYPE_CHECKING: - actual_instance: Union[VlanVirtualCircuitCreateInput, VrfVirtualCircuitCreateInput] - else: - actual_instance: Any - one_of_schemas: List[str] = Field(VIRTUALCIRCUITCREATEINPUT_ONE_OF_SCHEMAS, const=True) + actual_instance: Optional[Union[VlanVirtualCircuitCreateInput, VrfVirtualCircuitCreateInput]] = None + one_of_schemas: List[str] = Field(default=Literal["VlanVirtualCircuitCreateInput", "VrfVirtualCircuitCreateInput"]) + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - validate_assignment = True - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: if args: if len(args) > 1: raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") @@ -55,9 +53,9 @@ def __init__(self, *args, **kwargs): else: super().__init__(**kwargs) - @validator('actual_instance') + @field_validator('actual_instance') def actual_instance_must_validate_oneof(cls, v): - instance = VirtualCircuitCreateInput.construct() + instance = VirtualCircuitCreateInput.model_construct() error_messages = [] match = 0 # validate data type: VlanVirtualCircuitCreateInput @@ -80,13 +78,13 @@ def actual_instance_must_validate_oneof(cls, v): return v @classmethod - def from_dict(cls, obj: dict) -> VirtualCircuitCreateInput: + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: return cls.from_json(json.dumps(obj)) @classmethod - def from_json(cls, json_str: str) -> VirtualCircuitCreateInput: + def from_json(cls, json_str: str) -> Self: """Returns the object represented by the json string""" - instance = VirtualCircuitCreateInput.construct() + instance = cls.model_construct() error_messages = [] match = 0 @@ -117,19 +115,17 @@ def to_json(self) -> str: if self.actual_instance is None: return "null" - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): return self.actual_instance.to_json() else: return json.dumps(self.actual_instance) - def to_dict(self) -> dict: + def to_dict(self) -> Optional[Union[Dict[str, Any], VlanVirtualCircuitCreateInput, VrfVirtualCircuitCreateInput]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None - to_dict = getattr(self.actual_instance, "to_dict", None) - if callable(to_dict): + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): return self.actual_instance.to_dict() else: # primitive type @@ -137,6 +133,6 @@ def to_dict(self) -> dict: def to_str(self) -> str: """Returns the string representation of the actual instance""" - return pprint.pformat(self.dict()) + return pprint.pformat(self.model_dump()) diff --git a/equinix_metal/equinix_metal/models/virtual_circuit_list.py b/equinix_metal/equinix_metal/models/virtual_circuit_list.py index f206a293..e30b993b 100644 --- a/equinix_metal/equinix_metal/models/virtual_circuit_list.py +++ b/equinix_metal/equinix_metal/models/virtual_circuit_list.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.virtual_circuit import VirtualCircuit +from typing import Optional, Set +from typing_extensions import Self class VirtualCircuitList(BaseModel): """ VirtualCircuitList - """ + """ # noqa: E501 href: Optional[StrictStr] = None - virtual_circuits: Optional[conlist(VirtualCircuit)] = None - __properties = ["href", "virtual_circuits"] + virtual_circuits: Optional[List[VirtualCircuit]] = None + __properties: ClassVar[List[str]] = ["href", "virtual_circuits"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> VirtualCircuitList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of VirtualCircuitList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in virtual_circuits (list) _items = [] if self.virtual_circuits: @@ -65,17 +81,17 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> VirtualCircuitList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of VirtualCircuitList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VirtualCircuitList.parse_obj(obj) + return cls.model_validate(obj) - _obj = VirtualCircuitList.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "virtual_circuits": [VirtualCircuit.from_dict(_item) for _item in obj.get("virtual_circuits")] if obj.get("virtual_circuits") is not None else None + "virtual_circuits": [VirtualCircuit.from_dict(_item) for _item in obj["virtual_circuits"]] if obj.get("virtual_circuits") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/virtual_circuit_update_input.py b/equinix_metal/equinix_metal/models/virtual_circuit_update_input.py index 4bcf0c61..2bc38334 100644 --- a/equinix_metal/equinix_metal/models/virtual_circuit_update_input.py +++ b/equinix_metal/equinix_metal/models/virtual_circuit_update_input.py @@ -14,17 +14,15 @@ from __future__ import annotations -from inspect import getfullargspec import json import pprint -import re # noqa: F401 - +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator from typing import Any, List, Optional -from pydantic import BaseModel, Field, StrictStr, ValidationError, validator from equinix_metal.models.vlan_virtual_circuit_update_input import VlanVirtualCircuitUpdateInput from equinix_metal.models.vrf_virtual_circuit_update_input import VrfVirtualCircuitUpdateInput -from typing import Union, Any, List, TYPE_CHECKING from pydantic import StrictStr, Field +from typing import Union, List, Optional, Dict +from typing_extensions import Literal, Self VIRTUALCIRCUITUPDATEINPUT_ONE_OF_SCHEMAS = ["VlanVirtualCircuitUpdateInput", "VrfVirtualCircuitUpdateInput"] @@ -36,16 +34,16 @@ class VirtualCircuitUpdateInput(BaseModel): oneof_schema_1_validator: Optional[VlanVirtualCircuitUpdateInput] = None # data type: VrfVirtualCircuitUpdateInput oneof_schema_2_validator: Optional[VrfVirtualCircuitUpdateInput] = None - if TYPE_CHECKING: - actual_instance: Union[VlanVirtualCircuitUpdateInput, VrfVirtualCircuitUpdateInput] - else: - actual_instance: Any - one_of_schemas: List[str] = Field(VIRTUALCIRCUITUPDATEINPUT_ONE_OF_SCHEMAS, const=True) + actual_instance: Optional[Union[VlanVirtualCircuitUpdateInput, VrfVirtualCircuitUpdateInput]] = None + one_of_schemas: List[str] = Field(default=Literal["VlanVirtualCircuitUpdateInput", "VrfVirtualCircuitUpdateInput"]) + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - validate_assignment = True - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: if args: if len(args) > 1: raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") @@ -55,9 +53,9 @@ def __init__(self, *args, **kwargs): else: super().__init__(**kwargs) - @validator('actual_instance') + @field_validator('actual_instance') def actual_instance_must_validate_oneof(cls, v): - instance = VirtualCircuitUpdateInput.construct() + instance = VirtualCircuitUpdateInput.model_construct() error_messages = [] match = 0 # validate data type: VlanVirtualCircuitUpdateInput @@ -80,13 +78,13 @@ def actual_instance_must_validate_oneof(cls, v): return v @classmethod - def from_dict(cls, obj: dict) -> VirtualCircuitUpdateInput: + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: return cls.from_json(json.dumps(obj)) @classmethod - def from_json(cls, json_str: str) -> VirtualCircuitUpdateInput: + def from_json(cls, json_str: str) -> Self: """Returns the object represented by the json string""" - instance = VirtualCircuitUpdateInput.construct() + instance = cls.model_construct() error_messages = [] match = 0 @@ -117,19 +115,17 @@ def to_json(self) -> str: if self.actual_instance is None: return "null" - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): return self.actual_instance.to_json() else: return json.dumps(self.actual_instance) - def to_dict(self) -> dict: + def to_dict(self) -> Optional[Union[Dict[str, Any], VlanVirtualCircuitUpdateInput, VrfVirtualCircuitUpdateInput]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None - to_dict = getattr(self.actual_instance, "to_dict", None) - if callable(to_dict): + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): return self.actual_instance.to_dict() else: # primitive type @@ -137,6 +133,6 @@ def to_dict(self) -> dict: def to_str(self) -> str: """Returns the string representation of the actual instance""" - return pprint.pformat(self.dict()) + return pprint.pformat(self.model_dump()) diff --git a/equinix_metal/equinix_metal/models/virtual_network.py b/equinix_metal/equinix_metal/models/virtual_network.py index 23441185..f7a9e8bc 100644 --- a/equinix_metal/equinix_metal/models/virtual_network.py +++ b/equinix_metal/equinix_metal/models/virtual_network.py @@ -18,54 +18,70 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.href import Href from equinix_metal.models.metal_gateway_lite import MetalGatewayLite +from typing import Optional, Set +from typing_extensions import Self class VirtualNetwork(BaseModel): """ VirtualNetwork - """ + """ # noqa: E501 assigned_to: Optional[Href] = None - assigned_to_virtual_circuit: Optional[StrictBool] = Field(None, description="True if the virtual network is attached to a virtual circuit. False if not.") + assigned_to_virtual_circuit: Optional[StrictBool] = Field(default=None, description="True if the virtual network is attached to a virtual circuit. False if not.") description: Optional[StrictStr] = None facility: Optional[Href] = None href: Optional[StrictStr] = None id: Optional[StrictStr] = None - instances: Optional[conlist(Href)] = Field(None, description="A list of instances with ports currently associated to this Virtual Network.") - metal_gateways: Optional[conlist(MetalGatewayLite)] = Field(None, description="A list of metal gateways currently associated to this Virtual Network.") + instances: Optional[List[Href]] = Field(default=None, description="A list of instances with ports currently associated to this Virtual Network.") + metal_gateways: Optional[List[MetalGatewayLite]] = Field(default=None, description="A list of metal gateways currently associated to this Virtual Network.") metro: Optional[Href] = None - metro_code: Optional[StrictStr] = Field(None, description="The Metro code of the metro in which this Virtual Network is defined.") - tags: Optional[conlist(StrictStr)] = None + metro_code: Optional[StrictStr] = Field(default=None, description="The Metro code of the metro in which this Virtual Network is defined.") + tags: Optional[List[StrictStr]] = None vxlan: Optional[StrictInt] = None - __properties = ["assigned_to", "assigned_to_virtual_circuit", "description", "facility", "href", "id", "instances", "metal_gateways", "metro", "metro_code", "tags", "vxlan"] + __properties: ClassVar[List[str]] = ["assigned_to", "assigned_to_virtual_circuit", "description", "facility", "href", "id", "instances", "metal_gateways", "metro", "metro_code", "tags", "vxlan"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> VirtualNetwork: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of VirtualNetwork from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of assigned_to if self.assigned_to: _dict['assigned_to'] = self.assigned_to.to_dict() @@ -92,24 +108,24 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> VirtualNetwork: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of VirtualNetwork from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VirtualNetwork.parse_obj(obj) + return cls.model_validate(obj) - _obj = VirtualNetwork.parse_obj({ - "assigned_to": Href.from_dict(obj.get("assigned_to")) if obj.get("assigned_to") is not None else None, + _obj = cls.model_validate({ + "assigned_to": Href.from_dict(obj["assigned_to"]) if obj.get("assigned_to") is not None else None, "assigned_to_virtual_circuit": obj.get("assigned_to_virtual_circuit"), "description": obj.get("description"), - "facility": Href.from_dict(obj.get("facility")) if obj.get("facility") is not None else None, + "facility": Href.from_dict(obj["facility"]) if obj.get("facility") is not None else None, "href": obj.get("href"), "id": obj.get("id"), - "instances": [Href.from_dict(_item) for _item in obj.get("instances")] if obj.get("instances") is not None else None, - "metal_gateways": [MetalGatewayLite.from_dict(_item) for _item in obj.get("metal_gateways")] if obj.get("metal_gateways") is not None else None, - "metro": Href.from_dict(obj.get("metro")) if obj.get("metro") is not None else None, + "instances": [Href.from_dict(_item) for _item in obj["instances"]] if obj.get("instances") is not None else None, + "metal_gateways": [MetalGatewayLite.from_dict(_item) for _item in obj["metal_gateways"]] if obj.get("metal_gateways") is not None else None, + "metro": Href.from_dict(obj["metro"]) if obj.get("metro") is not None else None, "metro_code": obj.get("metro_code"), "tags": obj.get("tags"), "vxlan": obj.get("vxlan") diff --git a/equinix_metal/equinix_metal/models/virtual_network_create_input.py b/equinix_metal/equinix_metal/models/virtual_network_create_input.py index 16093cfe..e2edb1a5 100644 --- a/equinix_metal/equinix_metal/models/virtual_network_create_input.py +++ b/equinix_metal/equinix_metal/models/virtual_network_create_input.py @@ -18,58 +18,74 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class VirtualNetworkCreateInput(BaseModel): """ VirtualNetworkCreateInput - """ + """ # noqa: E501 description: Optional[StrictStr] = None - facility: Optional[StrictStr] = Field(None, description="The UUID (or facility code) for the Facility in which to create this Virtual network.") + facility: Optional[StrictStr] = Field(default=None, description="The UUID (or facility code) for the Facility in which to create this Virtual network.") href: Optional[StrictStr] = None - metro: Optional[StrictStr] = Field(None, description="The UUID (or metro code) for the Metro in which to create this Virtual Network.") - tags: Optional[conlist(StrictStr)] = None - vxlan: Optional[StrictInt] = Field(None, description="VLAN ID between 2-3999. Must be unique for the project within the Metro in which this Virtual Network is being created. If no value is specified, the next-available VLAN ID in the range 1000-1999 will be automatically selected.") - __properties = ["description", "facility", "href", "metro", "tags", "vxlan"] + metro: Optional[StrictStr] = Field(default=None, description="The UUID (or metro code) for the Metro in which to create this Virtual Network.") + tags: Optional[List[StrictStr]] = None + vxlan: Optional[StrictInt] = Field(default=None, description="VLAN ID between 2-3999. Must be unique for the project within the Metro in which this Virtual Network is being created. If no value is specified, the next-available VLAN ID in the range 1000-1999 will be automatically selected.") + __properties: ClassVar[List[str]] = ["description", "facility", "href", "metro", "tags", "vxlan"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> VirtualNetworkCreateInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of VirtualNetworkCreateInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> VirtualNetworkCreateInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of VirtualNetworkCreateInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VirtualNetworkCreateInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = VirtualNetworkCreateInput.parse_obj({ + _obj = cls.model_validate({ "description": obj.get("description"), "facility": obj.get("facility"), "href": obj.get("href"), diff --git a/equinix_metal/equinix_metal/models/virtual_network_list.py b/equinix_metal/equinix_metal/models/virtual_network_list.py index 4cf4e789..fab6227b 100644 --- a/equinix_metal/equinix_metal/models/virtual_network_list.py +++ b/equinix_metal/equinix_metal/models/virtual_network_list.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.virtual_network import VirtualNetwork +from typing import Optional, Set +from typing_extensions import Self class VirtualNetworkList(BaseModel): """ VirtualNetworkList - """ + """ # noqa: E501 href: Optional[StrictStr] = None - virtual_networks: Optional[conlist(VirtualNetwork)] = None - __properties = ["href", "virtual_networks"] + virtual_networks: Optional[List[VirtualNetwork]] = None + __properties: ClassVar[List[str]] = ["href", "virtual_networks"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> VirtualNetworkList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of VirtualNetworkList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in virtual_networks (list) _items = [] if self.virtual_networks: @@ -65,17 +81,17 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> VirtualNetworkList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of VirtualNetworkList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VirtualNetworkList.parse_obj(obj) + return cls.model_validate(obj) - _obj = VirtualNetworkList.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "virtual_networks": [VirtualNetwork.from_dict(_item) for _item in obj.get("virtual_networks")] if obj.get("virtual_networks") is not None else None + "virtual_networks": [VirtualNetwork.from_dict(_item) for _item in obj["virtual_networks"]] if obj.get("virtual_networks") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/vlan_csp_connection_create_input.py b/equinix_metal/equinix_metal/models/vlan_csp_connection_create_input.py index ce11f2af..2b91d1e4 100644 --- a/equinix_metal/equinix_metal/models/vlan_csp_connection_create_input.py +++ b/equinix_metal/equinix_metal/models/vlan_csp_connection_create_input.py @@ -18,77 +18,93 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.vlan_csp_connection_create_input_fabric_provider import VlanCSPConnectionCreateInputFabricProvider +from typing import Optional, Set +from typing_extensions import Self class VlanCSPConnectionCreateInput(BaseModel): """ VlanCSPConnectionCreateInput - """ - contact_email: Optional[StrictStr] = Field(None, description="The preferred email used for communication and notifications about the Equinix Fabric interconnection. Required when using a Project API key. Optional and defaults to the primary user email address when using a User API key.") + """ # noqa: E501 + contact_email: Optional[StrictStr] = Field(default=None, description="The preferred email used for communication and notifications about the Equinix Fabric interconnection. Required when using a Project API key. Optional and defaults to the primary user email address when using a User API key.") description: Optional[StrictStr] = None - fabric_provider: VlanCSPConnectionCreateInputFabricProvider = Field(...) + fabric_provider: VlanCSPConnectionCreateInputFabricProvider href: Optional[StrictStr] = None - metro: StrictStr = Field(..., description="A Metro ID or code. When creating Fabric VCs (Metal Billed), this is where interconnection will be originating from, as we pre-authorize the use of one of our shared ports as the origin of the interconnection using A-Side service tokens. We only allow local connections for Fabric VCs (Metal Billed), so the destination location must be the same as the origin. For Fabric VCs (Fabric Billed), or shared connections, this will be the destination of the interconnection. We allow remote connections for Fabric VCs (Fabric Billed), so the origin of the interconnection can be a different metro set here.") - name: StrictStr = Field(...) - project: StrictStr = Field(...) - speed: Optional[StrictStr] = Field(None, description="A interconnection speed, in bps, mbps, or gbps. For Fabric VCs, this represents the maximum speed of the interconnection. For Fabric VCs (Metal Billed), this can only be one of the following: ''50mbps'', ''200mbps'', ''500mbps'', ''1gbps'', ''2gbps'', ''5gbps'' or ''10gbps'', and is required for creation. For Fabric VCs (Fabric Billed), this field will always default to ''10gbps'' even if it is not provided. For example, ''500000000'', ''50m'', or' ''500mbps'' will all work as valid inputs.") - tags: Optional[conlist(StrictStr)] = None - type: StrictStr = Field(...) - vlans: conlist(StrictInt) = Field(..., description="A list of one or two metro-based VLANs that will be set on the virtual circuits of primary and/or secondary interconnections respectively when creating Fabric VCs. VLANs can also be set after the interconnection is created, but are required to fully activate the virtual circuits.") - __properties = ["contact_email", "description", "fabric_provider", "href", "metro", "name", "project", "speed", "tags", "type", "vlans"] - - @validator('type') + metro: StrictStr = Field(description="A Metro ID or code. When creating Fabric VCs (Metal Billed), this is where interconnection will be originating from, as we pre-authorize the use of one of our shared ports as the origin of the interconnection using A-Side service tokens. We only allow local connections for Fabric VCs (Metal Billed), so the destination location must be the same as the origin. For Fabric VCs (Fabric Billed), or shared connections, this will be the destination of the interconnection. We allow remote connections for Fabric VCs (Fabric Billed), so the origin of the interconnection can be a different metro set here.") + name: StrictStr + project: StrictStr + speed: Optional[StrictStr] = Field(default=None, description="A interconnection speed, in bps, mbps, or gbps. For Fabric VCs, this represents the maximum speed of the interconnection. For Fabric VCs (Metal Billed), this can only be one of the following: ''50mbps'', ''200mbps'', ''500mbps'', ''1gbps'', ''2gbps'', ''5gbps'' or ''10gbps'', and is required for creation. For Fabric VCs (Fabric Billed), this field will always default to ''10gbps'' even if it is not provided. For example, ''500000000'', ''50m'', or' ''500mbps'' will all work as valid inputs.") + tags: Optional[List[StrictStr]] = None + type: StrictStr + vlans: List[StrictInt] = Field(description="A list of one or two metro-based VLANs that will be set on the virtual circuits of primary and/or secondary interconnections respectively when creating Fabric VCs. VLANs can also be set after the interconnection is created, but are required to fully activate the virtual circuits.") + __properties: ClassVar[List[str]] = ["contact_email", "description", "fabric_provider", "href", "metro", "name", "project", "speed", "tags", "type", "vlans"] + + @field_validator('type') def type_validate_enum(cls, value): """Validates the enum""" - if value not in ('shared_port_vlan_to_csp'): + if value not in set(['shared_port_vlan_to_csp']): raise ValueError("must be one of enum values ('shared_port_vlan_to_csp')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> VlanCSPConnectionCreateInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of VlanCSPConnectionCreateInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of fabric_provider if self.fabric_provider: _dict['fabric_provider'] = self.fabric_provider.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> VlanCSPConnectionCreateInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of VlanCSPConnectionCreateInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VlanCSPConnectionCreateInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = VlanCSPConnectionCreateInput.parse_obj({ + _obj = cls.model_validate({ "contact_email": obj.get("contact_email"), "description": obj.get("description"), - "fabric_provider": VlanCSPConnectionCreateInputFabricProvider.from_dict(obj.get("fabric_provider")) if obj.get("fabric_provider") is not None else None, + "fabric_provider": VlanCSPConnectionCreateInputFabricProvider.from_dict(obj["fabric_provider"]) if obj.get("fabric_provider") is not None else None, "href": obj.get("href"), "metro": obj.get("metro"), "name": obj.get("name"), diff --git a/equinix_metal/equinix_metal/models/vlan_csp_connection_create_input_fabric_provider.py b/equinix_metal/equinix_metal/models/vlan_csp_connection_create_input_fabric_provider.py index 6be2a0ad..0a04c9c9 100644 --- a/equinix_metal/equinix_metal/models/vlan_csp_connection_create_input_fabric_provider.py +++ b/equinix_metal/equinix_metal/models/vlan_csp_connection_create_input_fabric_provider.py @@ -14,16 +14,14 @@ from __future__ import annotations -from inspect import getfullargspec import json import pprint -import re # noqa: F401 - +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator from typing import Any, List, Optional -from pydantic import BaseModel, Field, StrictStr, ValidationError, validator from equinix_metal.models.aws_fabric_provider import AWSFabricProvider -from typing import Union, Any, List, TYPE_CHECKING from pydantic import StrictStr, Field +from typing import Union, List, Optional, Dict +from typing_extensions import Literal, Self VLANCSPCONNECTIONCREATEINPUTFABRICPROVIDER_ONE_OF_SCHEMAS = ["AWSFabricProvider"] @@ -33,16 +31,16 @@ class VlanCSPConnectionCreateInputFabricProvider(BaseModel): """ # data type: AWSFabricProvider oneof_schema_1_validator: Optional[AWSFabricProvider] = None - if TYPE_CHECKING: - actual_instance: Union[AWSFabricProvider] - else: - actual_instance: Any - one_of_schemas: List[str] = Field(VLANCSPCONNECTIONCREATEINPUTFABRICPROVIDER_ONE_OF_SCHEMAS, const=True) + actual_instance: Optional[Union[AWSFabricProvider]] = None + one_of_schemas: List[str] = Field(default=Literal["AWSFabricProvider"]) + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - validate_assignment = True - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: if args: if len(args) > 1: raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") @@ -52,9 +50,9 @@ def __init__(self, *args, **kwargs): else: super().__init__(**kwargs) - @validator('actual_instance') + @field_validator('actual_instance') def actual_instance_must_validate_oneof(cls, v): - instance = VlanCSPConnectionCreateInputFabricProvider.construct() + instance = VlanCSPConnectionCreateInputFabricProvider.model_construct() error_messages = [] match = 0 # validate data type: AWSFabricProvider @@ -72,13 +70,13 @@ def actual_instance_must_validate_oneof(cls, v): return v @classmethod - def from_dict(cls, obj: dict) -> VlanCSPConnectionCreateInputFabricProvider: + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: return cls.from_json(json.dumps(obj)) @classmethod - def from_json(cls, json_str: str) -> VlanCSPConnectionCreateInputFabricProvider: + def from_json(cls, json_str: str) -> Self: """Returns the object represented by the json string""" - instance = VlanCSPConnectionCreateInputFabricProvider.construct() + instance = cls.model_construct() error_messages = [] match = 0 @@ -103,19 +101,17 @@ def to_json(self) -> str: if self.actual_instance is None: return "null" - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): return self.actual_instance.to_json() else: return json.dumps(self.actual_instance) - def to_dict(self) -> dict: + def to_dict(self) -> Optional[Union[Dict[str, Any], AWSFabricProvider]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None - to_dict = getattr(self.actual_instance, "to_dict", None) - if callable(to_dict): + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): return self.actual_instance.to_dict() else: # primitive type @@ -123,6 +119,6 @@ def to_dict(self) -> dict: def to_str(self) -> str: """Returns the string representation of the actual instance""" - return pprint.pformat(self.dict()) + return pprint.pformat(self.model_dump()) diff --git a/equinix_metal/equinix_metal/models/vlan_fabric_vc_create_input.py b/equinix_metal/equinix_metal/models/vlan_fabric_vc_create_input.py index 8cc621ed..f9673626 100644 --- a/equinix_metal/equinix_metal/models/vlan_fabric_vc_create_input.py +++ b/equinix_metal/equinix_metal/models/vlan_fabric_vc_create_input.py @@ -18,78 +18,94 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class VlanFabricVcCreateInput(BaseModel): """ VlanFabricVcCreateInput - """ - contact_email: Optional[StrictStr] = Field(None, description="The preferred email used for communication and notifications about the Equinix Fabric interconnection. Required when using a Project API key. Optional and defaults to the primary user email address when using a User API key.") + """ # noqa: E501 + contact_email: Optional[StrictStr] = Field(default=None, description="The preferred email used for communication and notifications about the Equinix Fabric interconnection. Required when using a Project API key. Optional and defaults to the primary user email address when using a User API key.") description: Optional[StrictStr] = None href: Optional[StrictStr] = None - metro: StrictStr = Field(..., description="A Metro ID or code. When creating Fabric VCs (Metal Billed), this is where interconnection will be originating from, as we pre-authorize the use of one of our shared ports as the origin of the interconnection using A-Side service tokens. We only allow local connections for Fabric VCs (Metal Billed), so the destination location must be the same as the origin. For Fabric VCs (Fabric Billed), or shared connections, this will be the destination of the interconnection. We allow remote connections for Fabric VCs (Fabric Billed), so the origin of the interconnection can be a different metro set here.") - name: StrictStr = Field(...) + metro: StrictStr = Field(description="A Metro ID or code. When creating Fabric VCs (Metal Billed), this is where interconnection will be originating from, as we pre-authorize the use of one of our shared ports as the origin of the interconnection using A-Side service tokens. We only allow local connections for Fabric VCs (Metal Billed), so the destination location must be the same as the origin. For Fabric VCs (Fabric Billed), or shared connections, this will be the destination of the interconnection. We allow remote connections for Fabric VCs (Fabric Billed), so the origin of the interconnection can be a different metro set here.") + name: StrictStr project: Optional[StrictStr] = None - redundancy: StrictStr = Field(..., description="Either 'primary' or 'redundant'.") - service_token_type: StrictStr = Field(..., description="Either 'a_side' or 'z_side'. Setting this field to 'a_side' will create an interconnection with Fabric VCs (Metal Billed). Setting this field to 'z_side' will create an interconnection with Fabric VCs (Fabric Billed). This is required when the 'type' is 'shared', but this is not applicable when the 'type' is 'dedicated'. This parameter is included in the specification as a developer preview and is generally unavailable. Please contact our Support team for more details.") - speed: Optional[StrictStr] = Field(None, description="A interconnection speed, in bps, mbps, or gbps. For Fabric VCs, this represents the maximum speed of the interconnection. For Fabric VCs (Metal Billed), this can only be one of the following: ''50mbps'', ''200mbps'', ''500mbps'', ''1gbps'', ''2gbps'', ''5gbps'' or ''10gbps'', and is required for creation. For Fabric VCs (Fabric Billed), this field will always default to ''10gbps'' even if it is not provided. For example, ''500000000'', ''50m'', or' ''500mbps'' will all work as valid inputs.") - tags: Optional[conlist(StrictStr)] = None - type: StrictStr = Field(..., description="When requesting for a Fabric VC, the value of this field should be 'shared'.") - vlans: Optional[conlist(StrictInt)] = Field(None, description="A list of one or two metro-based VLANs that will be set on the virtual circuits of primary and/or secondary (if redundant) interconnections respectively when creating Fabric VCs. VLANs can also be set after the interconnection is created, but are required to fully activate the virtual circuits.") - __properties = ["contact_email", "description", "href", "metro", "name", "project", "redundancy", "service_token_type", "speed", "tags", "type", "vlans"] - - @validator('service_token_type') + redundancy: StrictStr = Field(description="Either 'primary' or 'redundant'.") + service_token_type: StrictStr = Field(description="Either 'a_side' or 'z_side'. Setting this field to 'a_side' will create an interconnection with Fabric VCs (Metal Billed). Setting this field to 'z_side' will create an interconnection with Fabric VCs (Fabric Billed). This is required when the 'type' is 'shared', but this is not applicable when the 'type' is 'dedicated'. This parameter is included in the specification as a developer preview and is generally unavailable. Please contact our Support team for more details.") + speed: Optional[StrictStr] = Field(default=None, description="A interconnection speed, in bps, mbps, or gbps. For Fabric VCs, this represents the maximum speed of the interconnection. For Fabric VCs (Metal Billed), this can only be one of the following: ''50mbps'', ''200mbps'', ''500mbps'', ''1gbps'', ''2gbps'', ''5gbps'' or ''10gbps'', and is required for creation. For Fabric VCs (Fabric Billed), this field will always default to ''10gbps'' even if it is not provided. For example, ''500000000'', ''50m'', or' ''500mbps'' will all work as valid inputs.") + tags: Optional[List[StrictStr]] = None + type: StrictStr = Field(description="When requesting for a Fabric VC, the value of this field should be 'shared'.") + vlans: Optional[List[StrictInt]] = Field(default=None, description="A list of one or two metro-based VLANs that will be set on the virtual circuits of primary and/or secondary (if redundant) interconnections respectively when creating Fabric VCs. VLANs can also be set after the interconnection is created, but are required to fully activate the virtual circuits.") + __properties: ClassVar[List[str]] = ["contact_email", "description", "href", "metro", "name", "project", "redundancy", "service_token_type", "speed", "tags", "type", "vlans"] + + @field_validator('service_token_type') def service_token_type_validate_enum(cls, value): """Validates the enum""" - if value not in ('a_side', 'z_side'): + if value not in set(['a_side', 'z_side']): raise ValueError("must be one of enum values ('a_side', 'z_side')") return value - @validator('type') + @field_validator('type') def type_validate_enum(cls, value): """Validates the enum""" - if value not in ('shared'): + if value not in set(['shared']): raise ValueError("must be one of enum values ('shared')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> VlanFabricVcCreateInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of VlanFabricVcCreateInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> VlanFabricVcCreateInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of VlanFabricVcCreateInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VlanFabricVcCreateInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = VlanFabricVcCreateInput.parse_obj({ + _obj = cls.model_validate({ "contact_email": obj.get("contact_email"), "description": obj.get("description"), "href": obj.get("href"), diff --git a/equinix_metal/equinix_metal/models/vlan_virtual_circuit.py b/equinix_metal/equinix_metal/models/vlan_virtual_circuit.py index 101cd8f5..38b16a11 100644 --- a/equinix_metal/equinix_metal/models/vlan_virtual_circuit.py +++ b/equinix_metal/equinix_metal/models/vlan_virtual_circuit.py @@ -19,16 +19,18 @@ import json from datetime import datetime -from typing import List, Optional -from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.href import Href +from typing import Optional, Set +from typing_extensions import Self class VlanVirtualCircuit(BaseModel): """ VlanVirtualCircuit - """ - bill: Optional[StrictBool] = Field(False, description="True if the Virtual Circuit is being billed. Currently, only Virtual Circuits of Fabric VCs (Metal Billed) will be billed. Usage will start the first time the Virtual Circuit becomes active, and will not stop until it is deleted from Metal.") - bill_type: Optional[StrictStr] = Field(None, description="Fabric Billed if the Virtual Circuit is billed by Fabric. Metal Billed if the Virtual Circuit is billed by Metal. Legacy Virtual Circuits will have a value of nil.") + """ # noqa: E501 + bill: Optional[StrictBool] = Field(default=False, description="True if the Virtual Circuit is being billed. Currently, only Virtual Circuits of Fabric VCs (Metal Billed) will be billed. Usage will start the first time the Virtual Circuit becomes active, and will not stop until it is deleted from Metal.") + bill_type: Optional[StrictStr] = Field(default=None, description="Fabric Billed if the Virtual Circuit is billed by Fabric. Metal Billed if the Virtual Circuit is billed by Metal. Legacy Virtual Circuits will have a value of nil.") created_at: Optional[datetime] = None description: Optional[StrictStr] = None href: Optional[StrictStr] = None @@ -37,69 +39,84 @@ class VlanVirtualCircuit(BaseModel): nni_vlan: Optional[StrictInt] = None port: Optional[Href] = None project: Optional[Href] = None - speed: Optional[StrictInt] = Field(None, description="For Virtual Circuits on shared and dedicated connections, this speed should match the one set on their Interconnection Ports. For Virtual Circuits on Fabric VCs (both Metal and Fabric Billed) that have found their corresponding Fabric connection, this is the actual speed of the interconnection that was configured when setting up the interconnection on the Fabric Portal. Details on Fabric VCs are included in the specification as a developer preview and is generally unavailable. Please contact our Support team for more details.") - status: Optional[StrictStr] = Field(None, description="The status of a Virtual Circuit is always 'pending' on creation. The status can turn to 'Waiting on Customer VLAN' if a Metro VLAN was not set yet on the Virtual Circuit and is the last step needed for full activation. For Dedicated interconnections, as long as the Dedicated Port has been associated to the Virtual Circuit and a NNI VNID has been set, it will turn to 'waiting_on_customer_vlan'. For Fabric VCs, it will only change to 'waiting_on_customer_vlan' once the corresponding Fabric connection has been found on the Fabric side. If the Fabric service token associated with the Virtual Circuit hasn't been redeemed on Fabric within the expiry time, it will change to an `expired` status. Once a Metro VLAN is set on the Virtual Circuit (which for Fabric VCs, can be set on creation of a Fabric VC) and the necessary set up is done, it will turn into 'Activating' status as it tries to activate the Virtual Circuit. Once the Virtual Circuit fully activates and is configured on the switch, it will turn to staus 'active'. For Fabric VCs (Metal Billed), we will start billing the moment the status of the Virtual Circuit turns to 'active'. If there are any changes to the VLAN after the Virtual Circuit is in an 'active' status, the status will show 'changing_vlan' if a new VLAN has been provided, or 'deactivating' if we are removing the VLAN. When a deletion request is issued for the Virtual Circuit, it will move to a 'deleting' status, and we will immediately unconfigure the switch for the Virtual Circuit and issue a deletion on any associated Fabric connections. Any associated Metro VLANs on the virtual circuit will also be unassociated after the switch has been successfully unconfigured. If there are any associated Fabric connections, we will only fully delete the Virtual Circuit once we have checked that the Fabric connection was fully deprovisioned on Fabric.") - tags: Optional[conlist(StrictStr)] = None + speed: Optional[StrictInt] = Field(default=None, description="For Virtual Circuits on shared and dedicated connections, this speed should match the one set on their Interconnection Ports. For Virtual Circuits on Fabric VCs (both Metal and Fabric Billed) that have found their corresponding Fabric connection, this is the actual speed of the interconnection that was configured when setting up the interconnection on the Fabric Portal. Details on Fabric VCs are included in the specification as a developer preview and is generally unavailable. Please contact our Support team for more details.") + status: Optional[StrictStr] = Field(default=None, description="The status of a Virtual Circuit is always 'pending' on creation. The status can turn to 'Waiting on Customer VLAN' if a Metro VLAN was not set yet on the Virtual Circuit and is the last step needed for full activation. For Dedicated interconnections, as long as the Dedicated Port has been associated to the Virtual Circuit and a NNI VNID has been set, it will turn to 'waiting_on_customer_vlan'. For Fabric VCs, it will only change to 'waiting_on_customer_vlan' once the corresponding Fabric connection has been found on the Fabric side. If the Fabric service token associated with the Virtual Circuit hasn't been redeemed on Fabric within the expiry time, it will change to an `expired` status. Once a Metro VLAN is set on the Virtual Circuit (which for Fabric VCs, can be set on creation of a Fabric VC) and the necessary set up is done, it will turn into 'Activating' status as it tries to activate the Virtual Circuit. Once the Virtual Circuit fully activates and is configured on the switch, it will turn to staus 'active'. For Fabric VCs (Metal Billed), we will start billing the moment the status of the Virtual Circuit turns to 'active'. If there are any changes to the VLAN after the Virtual Circuit is in an 'active' status, the status will show 'changing_vlan' if a new VLAN has been provided, or 'deactivating' if we are removing the VLAN. When a deletion request is issued for the Virtual Circuit, it will move to a 'deleting' status, and we will immediately unconfigure the switch for the Virtual Circuit and issue a deletion on any associated Fabric connections. Any associated Metro VLANs on the virtual circuit will also be unassociated after the switch has been successfully unconfigured. If there are any associated Fabric connections, we will only fully delete the Virtual Circuit once we have checked that the Fabric connection was fully deprovisioned on Fabric.") + tags: Optional[List[StrictStr]] = None type: Optional[StrictStr] = None updated_at: Optional[datetime] = None virtual_network: Optional[Href] = None vnid: Optional[StrictInt] = None - __properties = ["bill", "bill_type", "created_at", "description", "href", "id", "name", "nni_vlan", "port", "project", "speed", "status", "tags", "type", "updated_at", "virtual_network", "vnid"] + __properties: ClassVar[List[str]] = ["bill", "bill_type", "created_at", "description", "href", "id", "name", "nni_vlan", "port", "project", "speed", "status", "tags", "type", "updated_at", "virtual_network", "vnid"] - @validator('bill_type') + @field_validator('bill_type') def bill_type_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('metal_billed', 'fabric_billed'): + if value not in set(['metal_billed', 'fabric_billed']): raise ValueError("must be one of enum values ('metal_billed', 'fabric_billed')") return value - @validator('status') + @field_validator('status') def status_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('pending', 'waiting_on_customer_vlan', 'activating', 'changing_vlan', 'deactivating', 'deleting', 'active', 'expired', 'activation_failed', 'changing_vlan_failed', 'deactivation_failed', 'delete_failed'): + if value not in set(['pending', 'waiting_on_customer_vlan', 'activating', 'changing_vlan', 'deactivating', 'deleting', 'active', 'expired', 'activation_failed', 'changing_vlan_failed', 'deactivation_failed', 'delete_failed']): raise ValueError("must be one of enum values ('pending', 'waiting_on_customer_vlan', 'activating', 'changing_vlan', 'deactivating', 'deleting', 'active', 'expired', 'activation_failed', 'changing_vlan_failed', 'deactivation_failed', 'delete_failed')") return value - @validator('type') + @field_validator('type') def type_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('vlan', 'vrf'): - raise ValueError("must be one of enum values ('vlan', 'vrf')") + if value not in set(['vlan']): + raise ValueError("must be one of enum values ('vlan')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> VlanVirtualCircuit: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of VlanVirtualCircuit from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of port if self.port: _dict['port'] = self.port.to_dict() @@ -110,22 +127,22 @@ def to_dict(self): if self.virtual_network: _dict['virtual_network'] = self.virtual_network.to_dict() # set to None if bill_type (nullable) is None - # and __fields_set__ contains the field - if self.bill_type is None and "bill_type" in self.__fields_set__: + # and model_fields_set contains the field + if self.bill_type is None and "bill_type" in self.model_fields_set: _dict['bill_type'] = None return _dict @classmethod - def from_dict(cls, obj: dict) -> VlanVirtualCircuit: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of VlanVirtualCircuit from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VlanVirtualCircuit.parse_obj(obj) + return cls.model_validate(obj) - _obj = VlanVirtualCircuit.parse_obj({ + _obj = cls.model_validate({ "bill": obj.get("bill") if obj.get("bill") is not None else False, "bill_type": obj.get("bill_type"), "created_at": obj.get("created_at"), @@ -134,14 +151,14 @@ def from_dict(cls, obj: dict) -> VlanVirtualCircuit: "id": obj.get("id"), "name": obj.get("name"), "nni_vlan": obj.get("nni_vlan"), - "port": Href.from_dict(obj.get("port")) if obj.get("port") is not None else None, - "project": Href.from_dict(obj.get("project")) if obj.get("project") is not None else None, + "port": Href.from_dict(obj["port"]) if obj.get("port") is not None else None, + "project": Href.from_dict(obj["project"]) if obj.get("project") is not None else None, "speed": obj.get("speed"), "status": obj.get("status"), "tags": obj.get("tags"), "type": obj.get("type"), "updated_at": obj.get("updated_at"), - "virtual_network": Href.from_dict(obj.get("virtual_network")) if obj.get("virtual_network") is not None else None, + "virtual_network": Href.from_dict(obj["virtual_network"]) if obj.get("virtual_network") is not None else None, "vnid": obj.get("vnid") }) return _obj diff --git a/equinix_metal/equinix_metal/models/vlan_virtual_circuit_create_input.py b/equinix_metal/equinix_metal/models/vlan_virtual_circuit_create_input.py index 1c44becc..3df3d2cd 100644 --- a/equinix_metal/equinix_metal/models/vlan_virtual_circuit_create_input.py +++ b/equinix_metal/equinix_metal/models/vlan_virtual_circuit_create_input.py @@ -18,60 +18,77 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conint, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self class VlanVirtualCircuitCreateInput(BaseModel): """ VlanVirtualCircuitCreateInput - """ + """ # noqa: E501 description: Optional[StrictStr] = None href: Optional[StrictStr] = None name: Optional[StrictStr] = None - nni_vlan: Optional[conint(strict=True, le=4094, ge=2)] = None - project_id: StrictStr = Field(...) - speed: Optional[StrictStr] = Field(None, description="speed can be passed as integer number representing bps speed or string (e.g. '52m' or '100g' or '4 gbps')") - tags: Optional[conlist(StrictStr)] = None - vnid: Optional[StrictStr] = Field(None, description="A Virtual Network record UUID or the VNID of a Metro Virtual Network in your project (sent as integer).") - __properties = ["description", "href", "name", "nni_vlan", "project_id", "speed", "tags", "vnid"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + nni_vlan: Optional[Annotated[int, Field(le=4094, strict=True, ge=2)]] = None + project_id: StrictStr + speed: Optional[StrictStr] = Field(default=None, description="speed can be passed as integer number representing bps speed or string (e.g. '52m' or '100g' or '4 gbps')") + tags: Optional[List[StrictStr]] = None + vnid: Optional[StrictStr] = Field(default=None, description="A Virtual Network record UUID or the VNID of a Metro Virtual Network in your project (sent as integer).") + __properties: ClassVar[List[str]] = ["description", "href", "name", "nni_vlan", "project_id", "speed", "tags", "vnid"] + + 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.dict(by_alias=True)) + 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) -> VlanVirtualCircuitCreateInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of VlanVirtualCircuitCreateInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> VlanVirtualCircuitCreateInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of VlanVirtualCircuitCreateInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VlanVirtualCircuitCreateInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = VlanVirtualCircuitCreateInput.parse_obj({ + _obj = cls.model_validate({ "description": obj.get("description"), "href": obj.get("href"), "name": obj.get("name"), diff --git a/equinix_metal/equinix_metal/models/vlan_virtual_circuit_update_input.py b/equinix_metal/equinix_metal/models/vlan_virtual_circuit_update_input.py index 8bd19464..69ab39dc 100644 --- a/equinix_metal/equinix_metal/models/vlan_virtual_circuit_update_input.py +++ b/equinix_metal/equinix_metal/models/vlan_virtual_circuit_update_input.py @@ -18,58 +18,74 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class VlanVirtualCircuitUpdateInput(BaseModel): """ VlanVirtualCircuitUpdateInput - """ + """ # noqa: E501 description: Optional[StrictStr] = None href: Optional[StrictStr] = None name: Optional[StrictStr] = None - speed: Optional[StrictStr] = Field(None, description="Speed can be changed only if it is an interconnection on a Dedicated Port") - tags: Optional[conlist(StrictStr)] = None - vnid: Optional[StrictStr] = Field(None, description="A Virtual Network record UUID or the VNID of a Metro Virtual Network in your project.") - __properties = ["description", "href", "name", "speed", "tags", "vnid"] + speed: Optional[StrictStr] = Field(default=None, description="Speed can be changed only if it is an interconnection on a Dedicated Port") + tags: Optional[List[StrictStr]] = None + vnid: Optional[StrictStr] = Field(default=None, description="A Virtual Network record UUID or the VNID of a Metro Virtual Network in your project.") + __properties: ClassVar[List[str]] = ["description", "href", "name", "speed", "tags", "vnid"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> VlanVirtualCircuitUpdateInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of VlanVirtualCircuitUpdateInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> VlanVirtualCircuitUpdateInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of VlanVirtualCircuitUpdateInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VlanVirtualCircuitUpdateInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = VlanVirtualCircuitUpdateInput.parse_obj({ + _obj = cls.model_validate({ "description": obj.get("description"), "href": obj.get("href"), "name": obj.get("name"), diff --git a/equinix_metal/equinix_metal/models/vrf.py b/equinix_metal/equinix_metal/models/vrf.py index 0eed3cc9..94e87497 100644 --- a/equinix_metal/equinix_metal/models/vrf.py +++ b/equinix_metal/equinix_metal/models/vrf.py @@ -19,59 +19,76 @@ import json from datetime import datetime -from typing import List, Optional -from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.metro import Metro from equinix_metal.models.project import Project from equinix_metal.models.user import User +from typing import Optional, Set +from typing_extensions import Self class Vrf(BaseModel): """ Vrf - """ - bgp_dynamic_neighbors_bfd_enabled: Optional[StrictBool] = Field(None, description="Toggle BFD on dynamic bgp neighbors sessions") - bgp_dynamic_neighbors_enabled: Optional[StrictBool] = Field(None, description="Toggle to enable the dynamic bgp neighbors feature on the VRF") - bgp_dynamic_neighbors_export_route_map: Optional[StrictBool] = Field(None, description="Toggle to export the VRF route-map to the dynamic bgp neighbors") - bill: Optional[StrictBool] = Field(False, description="True if the VRF is being billed. Usage will start when the first VRF Virtual Circuit is active, and will only stop when the VRF has been deleted.") + """ # noqa: E501 + bgp_dynamic_neighbors_bfd_enabled: Optional[StrictBool] = Field(default=None, description="Toggle BFD on dynamic bgp neighbors sessions") + bgp_dynamic_neighbors_enabled: Optional[StrictBool] = Field(default=None, description="Toggle to enable the dynamic bgp neighbors feature on the VRF") + bgp_dynamic_neighbors_export_route_map: Optional[StrictBool] = Field(default=None, description="Toggle to export the VRF route-map to the dynamic bgp neighbors") + bill: Optional[StrictBool] = Field(default=False, description="True if the VRF is being billed. Usage will start when the first VRF Virtual Circuit is active, and will only stop when the VRF has been deleted.") created_at: Optional[datetime] = None created_by: Optional[User] = None - description: Optional[StrictStr] = Field(None, description="Optional field that can be set to describe the VRF") + description: Optional[StrictStr] = Field(default=None, description="Optional field that can be set to describe the VRF") href: Optional[StrictStr] = None id: Optional[StrictStr] = None - ip_ranges: Optional[conlist(StrictStr)] = Field(None, description="A list of CIDR network addresses. Like [\"10.0.0.0/16\", \"2001:d78::/56\"].") - local_asn: Optional[StrictInt] = Field(None, description="A 4-byte ASN associated with the VRF.") + ip_ranges: Optional[List[StrictStr]] = Field(default=None, description="A list of CIDR network addresses. Like [\"10.0.0.0/16\", \"2001:d78::/56\"].") + local_asn: Optional[StrictInt] = Field(default=None, description="A 4-byte ASN associated with the VRF.") metro: Optional[Metro] = None name: Optional[StrictStr] = None project: Optional[Project] = None - tags: Optional[conlist(StrictStr)] = None + tags: Optional[List[StrictStr]] = None updated_at: Optional[datetime] = None - virtual_circuits: Optional[conlist(VrfVirtualCircuit)] = Field(None, description="Virtual circuits that are in the VRF") - __properties = ["bgp_dynamic_neighbors_bfd_enabled", "bgp_dynamic_neighbors_enabled", "bgp_dynamic_neighbors_export_route_map", "bill", "created_at", "created_by", "description", "href", "id", "ip_ranges", "local_asn", "metro", "name", "project", "tags", "updated_at", "virtual_circuits"] + virtual_circuits: Optional[List[VrfVirtualCircuit]] = Field(default=None, description="Virtual circuits that are in the VRF") + __properties: ClassVar[List[str]] = ["bgp_dynamic_neighbors_bfd_enabled", "bgp_dynamic_neighbors_enabled", "bgp_dynamic_neighbors_export_route_map", "bill", "created_at", "created_by", "description", "href", "id", "ip_ranges", "local_asn", "metro", "name", "project", "tags", "updated_at", "virtual_circuits"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> Vrf: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Vrf from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of created_by if self.created_by: _dict['created_by'] = self.created_by.to_dict() @@ -91,35 +108,36 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> Vrf: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Vrf from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Vrf.parse_obj(obj) + return cls.model_validate(obj) - _obj = Vrf.parse_obj({ + _obj = cls.model_validate({ "bgp_dynamic_neighbors_bfd_enabled": obj.get("bgp_dynamic_neighbors_bfd_enabled"), "bgp_dynamic_neighbors_enabled": obj.get("bgp_dynamic_neighbors_enabled"), "bgp_dynamic_neighbors_export_route_map": obj.get("bgp_dynamic_neighbors_export_route_map"), "bill": obj.get("bill") if obj.get("bill") is not None else False, "created_at": obj.get("created_at"), - "created_by": User.from_dict(obj.get("created_by")) if obj.get("created_by") is not None else None, + "created_by": User.from_dict(obj["created_by"]) if obj.get("created_by") is not None else None, "description": obj.get("description"), "href": obj.get("href"), "id": obj.get("id"), "ip_ranges": obj.get("ip_ranges"), "local_asn": obj.get("local_asn"), - "metro": Metro.from_dict(obj.get("metro")) if obj.get("metro") is not None else None, + "metro": Metro.from_dict(obj["metro"]) if obj.get("metro") is not None else None, "name": obj.get("name"), - "project": Project.from_dict(obj.get("project")) if obj.get("project") is not None else None, + "project": Project.from_dict(obj["project"]) if obj.get("project") is not None else None, "tags": obj.get("tags"), "updated_at": obj.get("updated_at"), - "virtual_circuits": [VrfVirtualCircuit.from_dict(_item) for _item in obj.get("virtual_circuits")] if obj.get("virtual_circuits") is not None else None + "virtual_circuits": [VrfVirtualCircuit.from_dict(_item) for _item in obj["virtual_circuits"]] if obj.get("virtual_circuits") is not None else None }) return _obj from equinix_metal.models.vrf_virtual_circuit import VrfVirtualCircuit -Vrf.update_forward_refs() +# TODO: Rewrite to not use raise_errors +Vrf.model_rebuild(raise_errors=False) diff --git a/equinix_metal/equinix_metal/models/vrf_create_input.py b/equinix_metal/equinix_metal/models/vrf_create_input.py index 39358a82..54b12f89 100644 --- a/equinix_metal/equinix_metal/models/vrf_create_input.py +++ b/equinix_metal/equinix_metal/models/vrf_create_input.py @@ -18,62 +18,78 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class VrfCreateInput(BaseModel): """ VrfCreateInput - """ - bgp_dynamic_neighbors_bfd_enabled: Optional[StrictBool] = Field(None, description="Toggle BFD on dynamic bgp neighbors sessions") - bgp_dynamic_neighbors_enabled: Optional[StrictBool] = Field(None, description="Toggle to enable the dynamic bgp neighbors feature on the VRF") - bgp_dynamic_neighbors_export_route_map: Optional[StrictBool] = Field(None, description="Toggle to export the VRF route-map to the dynamic bgp neighbors") + """ # noqa: E501 + bgp_dynamic_neighbors_bfd_enabled: Optional[StrictBool] = Field(default=None, description="Toggle BFD on dynamic bgp neighbors sessions") + bgp_dynamic_neighbors_enabled: Optional[StrictBool] = Field(default=None, description="Toggle to enable the dynamic bgp neighbors feature on the VRF") + bgp_dynamic_neighbors_export_route_map: Optional[StrictBool] = Field(default=None, description="Toggle to export the VRF route-map to the dynamic bgp neighbors") description: Optional[StrictStr] = None href: Optional[StrictStr] = None - ip_ranges: Optional[conlist(StrictStr)] = Field(None, description="A list of CIDR network addresses. Like [\"10.0.0.0/16\", \"2001:d78::/56\"]. IPv4 blocks must be between /8 and /29 in size. IPv6 blocks must be between /56 and /64. A VRF\\'s IP ranges must be defined in order to create VRF IP Reservations, which can then be used for Metal Gateways or Virtual Circuits.") + ip_ranges: Optional[List[StrictStr]] = Field(default=None, description="A list of CIDR network addresses. Like [\"10.0.0.0/16\", \"2001:d78::/56\"]. IPv4 blocks must be between /8 and /29 in size. IPv6 blocks must be between /56 and /64. A VRF\\'s IP ranges must be defined in order to create VRF IP Reservations, which can then be used for Metal Gateways or Virtual Circuits.") local_asn: Optional[StrictInt] = None - metro: StrictStr = Field(..., description="The UUID (or metro code) for the Metro in which to create this VRF.") - name: StrictStr = Field(...) - tags: Optional[conlist(StrictStr)] = None - __properties = ["bgp_dynamic_neighbors_bfd_enabled", "bgp_dynamic_neighbors_enabled", "bgp_dynamic_neighbors_export_route_map", "description", "href", "ip_ranges", "local_asn", "metro", "name", "tags"] + metro: StrictStr = Field(description="The UUID (or metro code) for the Metro in which to create this VRF.") + name: StrictStr + tags: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["bgp_dynamic_neighbors_bfd_enabled", "bgp_dynamic_neighbors_enabled", "bgp_dynamic_neighbors_export_route_map", "description", "href", "ip_ranges", "local_asn", "metro", "name", "tags"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> VrfCreateInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of VrfCreateInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> VrfCreateInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of VrfCreateInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VrfCreateInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = VrfCreateInput.parse_obj({ + _obj = cls.model_validate({ "bgp_dynamic_neighbors_bfd_enabled": obj.get("bgp_dynamic_neighbors_bfd_enabled"), "bgp_dynamic_neighbors_enabled": obj.get("bgp_dynamic_neighbors_enabled"), "bgp_dynamic_neighbors_export_route_map": obj.get("bgp_dynamic_neighbors_export_route_map"), diff --git a/equinix_metal/equinix_metal/models/vrf_fabric_vc_create_input.py b/equinix_metal/equinix_metal/models/vrf_fabric_vc_create_input.py index 1b20f590..e4da6b00 100644 --- a/equinix_metal/equinix_metal/models/vrf_fabric_vc_create_input.py +++ b/equinix_metal/equinix_metal/models/vrf_fabric_vc_create_input.py @@ -18,78 +18,94 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class VrfFabricVcCreateInput(BaseModel): """ VrfFabricVcCreateInput - """ - contact_email: Optional[StrictStr] = Field(None, description="The preferred email used for communication and notifications about the Equinix Fabric interconnection. Required when using a Project API key. Optional and defaults to the primary user email address when using a User API key.") + """ # noqa: E501 + contact_email: Optional[StrictStr] = Field(default=None, description="The preferred email used for communication and notifications about the Equinix Fabric interconnection. Required when using a Project API key. Optional and defaults to the primary user email address when using a User API key.") description: Optional[StrictStr] = None href: Optional[StrictStr] = None - metro: StrictStr = Field(..., description="A Metro ID or code. When creating Fabric VCs (Metal Billed), this is where interconnection will be originating from, as we pre-authorize the use of one of our shared ports as the origin of the interconnection using A-Side service tokens. We only allow local connections for Fabric VCs (Metal Billed), so the destination location must be the same as the origin. For Fabric VCs (Fabric Billed), or shared connections, this will be the destination of the interconnection. We allow remote connections for Fabric VCs (Fabric Billed), so the origin of the interconnection can be a different metro set here.") - name: StrictStr = Field(...) + metro: StrictStr = Field(description="A Metro ID or code. When creating Fabric VCs (Metal Billed), this is where interconnection will be originating from, as we pre-authorize the use of one of our shared ports as the origin of the interconnection using A-Side service tokens. We only allow local connections for Fabric VCs (Metal Billed), so the destination location must be the same as the origin. For Fabric VCs (Fabric Billed), or shared connections, this will be the destination of the interconnection. We allow remote connections for Fabric VCs (Fabric Billed), so the origin of the interconnection can be a different metro set here.") + name: StrictStr project: Optional[StrictStr] = None - redundancy: StrictStr = Field(..., description="Either 'primary' or 'redundant'.") - service_token_type: StrictStr = Field(..., description="Either 'a_side' or 'z_side'. Setting this field to 'a_side' will create an interconnection with Fabric VCs (Metal Billed). Setting this field to 'z_side' will create an interconnection with Fabric VCs (Fabric Billed). This is required when the 'type' is 'shared', but this is not applicable when the 'type' is 'dedicated'. This parameter is included in the specification as a developer preview and is generally unavailable. Please contact our Support team for more details.") - speed: Optional[StrictStr] = Field(None, description="A interconnection speed, in bps, mbps, or gbps. For Fabric VCs, this represents the maximum speed of the interconnection. For Fabric VCs (Metal Billed), this can only be one of the following: ''50mbps'', ''200mbps'', ''500mbps'', ''1gbps'', ''2gbps'', ''5gbps'' or ''10gbps'', and is required for creation. For Fabric VCs (Fabric Billed), this field will always default to ''10gbps'' even if it is not provided. For example, ''500000000'', ''50m'', or' ''500mbps'' will all work as valid inputs.") - tags: Optional[conlist(StrictStr)] = None - type: StrictStr = Field(..., description="When requesting for a Fabric VC, the value of this field should be 'shared'.") - vrfs: conlist(StrictStr) = Field(..., description="This field holds a list of VRF UUIDs that will be set automatically on the virtual circuits of Fabric VCs on creation, and can hold up to two UUIDs. Two UUIDs are required when requesting redundant Fabric VCs. The first UUID will be set on the primary virtual circuit, while the second UUID will be set on the secondary. The two UUIDs can be the same if both the primary and secondary virtual circuits will be in the same VRF. This parameter is included in the specification as a developer preview and is generally unavailable. Please contact our Support team for more details.") - __properties = ["contact_email", "description", "href", "metro", "name", "project", "redundancy", "service_token_type", "speed", "tags", "type", "vrfs"] - - @validator('service_token_type') + redundancy: StrictStr = Field(description="Either 'primary' or 'redundant'.") + service_token_type: StrictStr = Field(description="Either 'a_side' or 'z_side'. Setting this field to 'a_side' will create an interconnection with Fabric VCs (Metal Billed). Setting this field to 'z_side' will create an interconnection with Fabric VCs (Fabric Billed). This is required when the 'type' is 'shared', but this is not applicable when the 'type' is 'dedicated'. This parameter is included in the specification as a developer preview and is generally unavailable. Please contact our Support team for more details.") + speed: Optional[StrictStr] = Field(default=None, description="A interconnection speed, in bps, mbps, or gbps. For Fabric VCs, this represents the maximum speed of the interconnection. For Fabric VCs (Metal Billed), this can only be one of the following: ''50mbps'', ''200mbps'', ''500mbps'', ''1gbps'', ''2gbps'', ''5gbps'' or ''10gbps'', and is required for creation. For Fabric VCs (Fabric Billed), this field will always default to ''10gbps'' even if it is not provided. For example, ''500000000'', ''50m'', or' ''500mbps'' will all work as valid inputs.") + tags: Optional[List[StrictStr]] = None + type: StrictStr = Field(description="When requesting for a Fabric VC, the value of this field should be 'shared'.") + vrfs: List[StrictStr] = Field(description="This field holds a list of VRF UUIDs that will be set automatically on the virtual circuits of Fabric VCs on creation, and can hold up to two UUIDs. Two UUIDs are required when requesting redundant Fabric VCs. The first UUID will be set on the primary virtual circuit, while the second UUID will be set on the secondary. The two UUIDs can be the same if both the primary and secondary virtual circuits will be in the same VRF. This parameter is included in the specification as a developer preview and is generally unavailable. Please contact our Support team for more details.") + __properties: ClassVar[List[str]] = ["contact_email", "description", "href", "metro", "name", "project", "redundancy", "service_token_type", "speed", "tags", "type", "vrfs"] + + @field_validator('service_token_type') def service_token_type_validate_enum(cls, value): """Validates the enum""" - if value not in ('a_side', 'z_side'): + if value not in set(['a_side', 'z_side']): raise ValueError("must be one of enum values ('a_side', 'z_side')") return value - @validator('type') + @field_validator('type') def type_validate_enum(cls, value): """Validates the enum""" - if value not in ('shared'): + if value not in set(['shared']): raise ValueError("must be one of enum values ('shared')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> VrfFabricVcCreateInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of VrfFabricVcCreateInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> VrfFabricVcCreateInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of VrfFabricVcCreateInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VrfFabricVcCreateInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = VrfFabricVcCreateInput.parse_obj({ + _obj = cls.model_validate({ "contact_email": obj.get("contact_email"), "description": obj.get("description"), "href": obj.get("href"), diff --git a/equinix_metal/equinix_metal/models/vrf_ip_reservation.py b/equinix_metal/equinix_metal/models/vrf_ip_reservation.py index 2644ab2a..57b624e5 100644 --- a/equinix_metal/equinix_metal/models/vrf_ip_reservation.py +++ b/equinix_metal/equinix_metal/models/vrf_ip_reservation.py @@ -19,18 +19,20 @@ import json from datetime import datetime -from typing import Any, Dict, List, Optional -from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.href import Href from equinix_metal.models.metal_gateway_lite import MetalGatewayLite from equinix_metal.models.metro import Metro from equinix_metal.models.project import Project from equinix_metal.models.vrf import Vrf +from typing import Optional, Set +from typing_extensions import Self class VrfIpReservation(BaseModel): """ VrfIpReservation - """ + """ # noqa: E501 address: Optional[StrictStr] = None address_family: Optional[StrictInt] = None bill: Optional[StrictBool] = None @@ -52,42 +54,57 @@ class VrfIpReservation(BaseModel): project_lite: Optional[Project] = None public: Optional[StrictBool] = None state: Optional[StrictStr] = None - tags: Optional[conlist(StrictStr)] = None - type: StrictStr = Field(...) - vrf: Vrf = Field(...) - __properties = ["address", "address_family", "bill", "cidr", "created_at", "created_by", "customdata", "details", "gateway", "href", "id", "manageable", "management", "metal_gateway", "metro", "netmask", "network", "project", "project_lite", "public", "state", "tags", "type", "vrf"] + tags: Optional[List[StrictStr]] = None + type: StrictStr + vrf: Vrf + __properties: ClassVar[List[str]] = ["address", "address_family", "bill", "cidr", "created_at", "created_by", "customdata", "details", "gateway", "href", "id", "manageable", "management", "metal_gateway", "metro", "netmask", "network", "project", "project_lite", "public", "state", "tags", "type", "vrf"] - @validator('type') + @field_validator('type') def type_validate_enum(cls, value): """Validates the enum""" - if value not in ('vrf'): + if value not in set(['vrf']): raise ValueError("must be one of enum values ('vrf')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> VrfIpReservation: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of VrfIpReservation from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of created_by if self.created_by: _dict['created_by'] = self.created_by.to_dict() @@ -109,21 +126,21 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> VrfIpReservation: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of VrfIpReservation from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VrfIpReservation.parse_obj(obj) + return cls.model_validate(obj) - _obj = VrfIpReservation.parse_obj({ + _obj = cls.model_validate({ "address": obj.get("address"), "address_family": obj.get("address_family"), "bill": obj.get("bill"), "cidr": obj.get("cidr"), "created_at": obj.get("created_at"), - "created_by": Href.from_dict(obj.get("created_by")) if obj.get("created_by") is not None else None, + "created_by": Href.from_dict(obj["created_by"]) if obj.get("created_by") is not None else None, "customdata": obj.get("customdata"), "details": obj.get("details"), "gateway": obj.get("gateway"), @@ -131,17 +148,17 @@ def from_dict(cls, obj: dict) -> VrfIpReservation: "id": obj.get("id"), "manageable": obj.get("manageable"), "management": obj.get("management"), - "metal_gateway": MetalGatewayLite.from_dict(obj.get("metal_gateway")) if obj.get("metal_gateway") is not None else None, - "metro": Metro.from_dict(obj.get("metro")) if obj.get("metro") is not None else None, + "metal_gateway": MetalGatewayLite.from_dict(obj["metal_gateway"]) if obj.get("metal_gateway") is not None else None, + "metro": Metro.from_dict(obj["metro"]) if obj.get("metro") is not None else None, "netmask": obj.get("netmask"), "network": obj.get("network"), - "project": Project.from_dict(obj.get("project")) if obj.get("project") is not None else None, - "project_lite": Project.from_dict(obj.get("project_lite")) if obj.get("project_lite") is not None else None, + "project": Project.from_dict(obj["project"]) if obj.get("project") is not None else None, + "project_lite": Project.from_dict(obj["project_lite"]) if obj.get("project_lite") is not None else None, "public": obj.get("public"), "state": obj.get("state"), "tags": obj.get("tags"), "type": obj.get("type"), - "vrf": Vrf.from_dict(obj.get("vrf")) if obj.get("vrf") is not None else None + "vrf": Vrf.from_dict(obj["vrf"]) if obj.get("vrf") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/vrf_ip_reservation_create_input.py b/equinix_metal/equinix_metal/models/vrf_ip_reservation_create_input.py index c7b2e1fc..3323c367 100644 --- a/equinix_metal/equinix_metal/models/vrf_ip_reservation_create_input.py +++ b/equinix_metal/equinix_metal/models/vrf_ip_reservation_create_input.py @@ -18,60 +18,76 @@ import re # noqa: F401 import json - -from typing import Any, Dict, List, Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class VrfIpReservationCreateInput(BaseModel): """ VrfIpReservationCreateInput - """ - cidr: StrictInt = Field(..., description="The size of the VRF IP Reservation's subnet") + """ # noqa: E501 + cidr: StrictInt = Field(description="The size of the VRF IP Reservation's subnet") customdata: Optional[Dict[str, Any]] = None details: Optional[StrictStr] = None href: Optional[StrictStr] = None - network: StrictStr = Field(..., description="The starting address for this VRF IP Reservation's subnet") - tags: Optional[conlist(StrictStr)] = None - type: StrictStr = Field(..., description="Must be set to 'vrf'") - vrf_id: StrictStr = Field(..., description="The ID of the VRF in which this VRF IP Reservation is created. The VRF must have an existing IP Range that contains the requested subnet. This field may be aliased as just 'vrf'.") - __properties = ["cidr", "customdata", "details", "href", "network", "tags", "type", "vrf_id"] + network: StrictStr = Field(description="The starting address for this VRF IP Reservation's subnet") + tags: Optional[List[StrictStr]] = None + type: StrictStr = Field(description="Must be set to 'vrf'") + vrf_id: StrictStr = Field(description="The ID of the VRF in which this VRF IP Reservation is created. The VRF must have an existing IP Range that contains the requested subnet. This field may be aliased as just 'vrf'.") + __properties: ClassVar[List[str]] = ["cidr", "customdata", "details", "href", "network", "tags", "type", "vrf_id"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> VrfIpReservationCreateInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of VrfIpReservationCreateInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> VrfIpReservationCreateInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of VrfIpReservationCreateInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VrfIpReservationCreateInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = VrfIpReservationCreateInput.parse_obj({ + _obj = cls.model_validate({ "cidr": obj.get("cidr"), "customdata": obj.get("customdata"), "details": obj.get("details"), diff --git a/equinix_metal/equinix_metal/models/vrf_ip_reservation_list.py b/equinix_metal/equinix_metal/models/vrf_ip_reservation_list.py index 88a80291..a41203cb 100644 --- a/equinix_metal/equinix_metal/models/vrf_ip_reservation_list.py +++ b/equinix_metal/equinix_metal/models/vrf_ip_reservation_list.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.vrf_ip_reservation import VrfIpReservation +from typing import Optional, Set +from typing_extensions import Self class VrfIpReservationList(BaseModel): """ VrfIpReservationList - """ + """ # noqa: E501 href: Optional[StrictStr] = None - ip_addresses: Optional[conlist(VrfIpReservation)] = None - __properties = ["href", "ip_addresses"] + ip_addresses: Optional[List[VrfIpReservation]] = None + __properties: ClassVar[List[str]] = ["href", "ip_addresses"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> VrfIpReservationList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of VrfIpReservationList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in ip_addresses (list) _items = [] if self.ip_addresses: @@ -65,17 +81,17 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> VrfIpReservationList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of VrfIpReservationList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VrfIpReservationList.parse_obj(obj) + return cls.model_validate(obj) - _obj = VrfIpReservationList.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "ip_addresses": [VrfIpReservation.from_dict(_item) for _item in obj.get("ip_addresses")] if obj.get("ip_addresses") is not None else None + "ip_addresses": [VrfIpReservation.from_dict(_item) for _item in obj["ip_addresses"]] if obj.get("ip_addresses") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/vrf_list.py b/equinix_metal/equinix_metal/models/vrf_list.py index 4027a005..378105ab 100644 --- a/equinix_metal/equinix_metal/models/vrf_list.py +++ b/equinix_metal/equinix_metal/models/vrf_list.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.vrf import Vrf +from typing import Optional, Set +from typing_extensions import Self class VrfList(BaseModel): """ VrfList - """ + """ # noqa: E501 href: Optional[StrictStr] = None - vrfs: Optional[conlist(Vrf)] = None - __properties = ["href", "vrfs"] + vrfs: Optional[List[Vrf]] = None + __properties: ClassVar[List[str]] = ["href", "vrfs"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> VrfList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of VrfList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of each item in vrfs (list) _items = [] if self.vrfs: @@ -65,17 +81,17 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> VrfList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of VrfList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VrfList.parse_obj(obj) + return cls.model_validate(obj) - _obj = VrfList.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "vrfs": [Vrf.from_dict(_item) for _item in obj.get("vrfs")] if obj.get("vrfs") is not None else None + "vrfs": [Vrf.from_dict(_item) for _item in obj["vrfs"]] if obj.get("vrfs") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/vrf_metal_gateway.py b/equinix_metal/equinix_metal/models/vrf_metal_gateway.py index 8ce9a417..f849f433 100644 --- a/equinix_metal/equinix_metal/models/vrf_metal_gateway.py +++ b/equinix_metal/equinix_metal/models/vrf_metal_gateway.py @@ -19,64 +19,81 @@ import json from datetime import datetime -from typing import Optional -from pydantic import BaseModel, Field, StrictStr, validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.href import Href from equinix_metal.models.project import Project from equinix_metal.models.virtual_network import VirtualNetwork from equinix_metal.models.vrf import Vrf from equinix_metal.models.vrf_ip_reservation import VrfIpReservation +from typing import Optional, Set +from typing_extensions import Self class VrfMetalGateway(BaseModel): """ VrfMetalGateway - """ + """ # noqa: E501 created_at: Optional[datetime] = None created_by: Optional[Href] = None href: Optional[StrictStr] = None id: Optional[StrictStr] = None ip_reservation: Optional[VrfIpReservation] = None project: Optional[Project] = None - state: Optional[StrictStr] = Field(None, description="The current state of the Metal Gateway. 'Ready' indicates the gateway record has been configured, but is currently not active on the network. 'Active' indicates the gateway has been configured on the network. 'Deleting' is a temporary state used to indicate that the gateway is in the process of being un-configured from the network, after which the gateway record will be deleted.") + state: Optional[StrictStr] = Field(default=None, description="The current state of the Metal Gateway. 'Ready' indicates the gateway record has been configured, but is currently not active on the network. 'Active' indicates the gateway has been configured on the network. 'Deleting' is a temporary state used to indicate that the gateway is in the process of being un-configured from the network, after which the gateway record will be deleted.") updated_at: Optional[datetime] = None virtual_network: Optional[VirtualNetwork] = None vrf: Optional[Vrf] = None - __properties = ["created_at", "created_by", "href", "id", "ip_reservation", "project", "state", "updated_at", "virtual_network", "vrf"] + __properties: ClassVar[List[str]] = ["created_at", "created_by", "href", "id", "ip_reservation", "project", "state", "updated_at", "virtual_network", "vrf"] - @validator('state') + @field_validator('state') def state_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('ready', 'active', 'deleting'): + if value not in set(['ready', 'active', 'deleting']): raise ValueError("must be one of enum values ('ready', 'active', 'deleting')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> VrfMetalGateway: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of VrfMetalGateway from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of created_by if self.created_by: _dict['created_by'] = self.created_by.to_dict() @@ -95,25 +112,25 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> VrfMetalGateway: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of VrfMetalGateway from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VrfMetalGateway.parse_obj(obj) + return cls.model_validate(obj) - _obj = VrfMetalGateway.parse_obj({ + _obj = cls.model_validate({ "created_at": obj.get("created_at"), - "created_by": Href.from_dict(obj.get("created_by")) if obj.get("created_by") is not None else None, + "created_by": Href.from_dict(obj["created_by"]) if obj.get("created_by") is not None else None, "href": obj.get("href"), "id": obj.get("id"), - "ip_reservation": VrfIpReservation.from_dict(obj.get("ip_reservation")) if obj.get("ip_reservation") is not None else None, - "project": Project.from_dict(obj.get("project")) if obj.get("project") is not None else None, + "ip_reservation": VrfIpReservation.from_dict(obj["ip_reservation"]) if obj.get("ip_reservation") is not None else None, + "project": Project.from_dict(obj["project"]) if obj.get("project") is not None else None, "state": obj.get("state"), "updated_at": obj.get("updated_at"), - "virtual_network": VirtualNetwork.from_dict(obj.get("virtual_network")) if obj.get("virtual_network") is not None else None, - "vrf": Vrf.from_dict(obj.get("vrf")) if obj.get("vrf") is not None else None + "virtual_network": VirtualNetwork.from_dict(obj["virtual_network"]) if obj.get("virtual_network") is not None else None, + "vrf": Vrf.from_dict(obj["vrf"]) if obj.get("vrf") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/vrf_metal_gateway_create_input.py b/equinix_metal/equinix_metal/models/vrf_metal_gateway_create_input.py index 1bced027..875e9b4f 100644 --- a/equinix_metal/equinix_metal/models/vrf_metal_gateway_create_input.py +++ b/equinix_metal/equinix_metal/models/vrf_metal_gateway_create_input.py @@ -18,55 +18,71 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class VrfMetalGatewayCreateInput(BaseModel): """ VrfMetalGatewayCreateInput - """ + """ # noqa: E501 href: Optional[StrictStr] = None - ip_reservation_id: StrictStr = Field(..., description="The UUID an a VRF IP Reservation that belongs to the same project as the one in which the Metal Gateway is to be created. Additionally, the VRF IP Reservation and the Virtual Network must reside in the same Metro.") - virtual_network_id: StrictStr = Field(..., description="THe UUID of a Metro Virtual Network that belongs to the same project as the one in which the Metal Gateway is to be created. Additionally, the Virtual Network and the VRF IP Reservation must reside in the same metro.") - __properties = ["href", "ip_reservation_id", "virtual_network_id"] + ip_reservation_id: StrictStr = Field(description="The UUID an a VRF IP Reservation that belongs to the same project as the one in which the Metal Gateway is to be created. Additionally, the VRF IP Reservation and the Virtual Network must reside in the same Metro.") + virtual_network_id: StrictStr = Field(description="THe UUID of a Metro Virtual Network that belongs to the same project as the one in which the Metal Gateway is to be created. Additionally, the Virtual Network and the VRF IP Reservation must reside in the same metro.") + __properties: ClassVar[List[str]] = ["href", "ip_reservation_id", "virtual_network_id"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> VrfMetalGatewayCreateInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of VrfMetalGatewayCreateInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> VrfMetalGatewayCreateInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of VrfMetalGatewayCreateInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VrfMetalGatewayCreateInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = VrfMetalGatewayCreateInput.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), "ip_reservation_id": obj.get("ip_reservation_id"), "virtual_network_id": obj.get("virtual_network_id") diff --git a/equinix_metal/equinix_metal/models/vrf_route.py b/equinix_metal/equinix_metal/models/vrf_route.py index a96b9ac5..1b3d8c25 100644 --- a/equinix_metal/equinix_metal/models/vrf_route.py +++ b/equinix_metal/equinix_metal/models/vrf_route.py @@ -19,80 +19,103 @@ import json from datetime import datetime -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.virtual_network import VirtualNetwork from equinix_metal.models.vrf import Vrf from equinix_metal.models.vrf_metal_gateway import VrfMetalGateway +from typing import Optional, Set +from typing_extensions import Self class VrfRoute(BaseModel): """ VrfRoute - """ + """ # noqa: E501 created_at: Optional[datetime] = None href: Optional[StrictStr] = None - id: Optional[StrictStr] = Field(None, description="The unique identifier for the newly-created resource") + id: Optional[StrictStr] = Field(default=None, description="The unique identifier for the newly-created resource") metal_gateway: Optional[VrfMetalGateway] = None - next_hop: Optional[StrictStr] = Field(None, description="The next-hop IPv4 address for the route") - prefix: Optional[StrictStr] = Field(None, description="The IPv4 prefix for the route, in CIDR-style notation") - status: Optional[StrictStr] = Field(None, description="The status of the route. Potential values are \"pending\", \"active\", \"deleting\", and \"error\", representing various lifecycle states of the route and whether or not it has been successfully configured on the network") - tags: Optional[conlist(StrictStr)] = None - type: Optional[StrictStr] = Field(None, description="VRF route type, like 'bgp', 'connected', and 'static'. Currently, only static routes are supported") + next_hop: Optional[StrictStr] = Field(default=None, description="The next-hop IPv4 address for the route") + prefix: Optional[StrictStr] = Field(default=None, description="The IPv4 prefix for the route, in CIDR-style notation") + status: Optional[StrictStr] = Field(default=None, description="The status of the route. Potential values are \"pending\", \"active\", \"deleting\", and \"error\", representing various lifecycle states of the route and whether or not it has been successfully configured on the network") + tags: Optional[List[StrictStr]] = None + type: Optional[StrictStr] = Field(default=None, description="VRF route type, like 'bgp', 'connected', and 'static'. Currently, only static routes are supported") updated_at: Optional[datetime] = None virtual_network: Optional[VirtualNetwork] = None vrf: Optional[Vrf] = None - __properties = ["created_at", "href", "id", "metal_gateway", "next_hop", "prefix", "status", "tags", "type", "updated_at", "virtual_network", "vrf"] + __properties: ClassVar[List[str]] = ["created_at", "href", "id", "metal_gateway", "next_hop", "prefix", "status", "tags", "type", "updated_at", "virtual_network", "vrf"] - @validator('status') + @field_validator('status') def status_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('pending', 'active', 'deleting', 'error'): + if value not in set(['pending', 'active', 'deleting', 'error']): raise ValueError("must be one of enum values ('pending', 'active', 'deleting', 'error')") return value - @validator('type') + @field_validator('type') def type_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('static'): + if value not in set(['static']): raise ValueError("must be one of enum values ('static')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> VrfRoute: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of VrfRoute from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - "created_at", - "href", - "id", - "status", - "type", - "updated_at", - }, - exclude_none=True) + 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. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "created_at", + "href", + "id", + "status", + "type", + "updated_at", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of metal_gateway if self.metal_gateway: _dict['metal_gateway'] = self.metal_gateway.to_dict() @@ -105,27 +128,27 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> VrfRoute: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of VrfRoute from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VrfRoute.parse_obj(obj) + return cls.model_validate(obj) - _obj = VrfRoute.parse_obj({ + _obj = cls.model_validate({ "created_at": obj.get("created_at"), "href": obj.get("href"), "id": obj.get("id"), - "metal_gateway": VrfMetalGateway.from_dict(obj.get("metal_gateway")) if obj.get("metal_gateway") is not None else None, + "metal_gateway": VrfMetalGateway.from_dict(obj["metal_gateway"]) if obj.get("metal_gateway") is not None else None, "next_hop": obj.get("next_hop"), "prefix": obj.get("prefix"), "status": obj.get("status"), "tags": obj.get("tags"), "type": obj.get("type"), "updated_at": obj.get("updated_at"), - "virtual_network": VirtualNetwork.from_dict(obj.get("virtual_network")) if obj.get("virtual_network") is not None else None, - "vrf": Vrf.from_dict(obj.get("vrf")) if obj.get("vrf") is not None else None + "virtual_network": VirtualNetwork.from_dict(obj["virtual_network"]) if obj.get("virtual_network") is not None else None, + "vrf": Vrf.from_dict(obj["vrf"]) if obj.get("vrf") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/vrf_route_create_input.py b/equinix_metal/equinix_metal/models/vrf_route_create_input.py index 2c428a4d..21e3032d 100644 --- a/equinix_metal/equinix_metal/models/vrf_route_create_input.py +++ b/equinix_metal/equinix_metal/models/vrf_route_create_input.py @@ -18,56 +18,72 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class VrfRouteCreateInput(BaseModel): """ VrfRouteCreateInput - """ + """ # noqa: E501 href: Optional[StrictStr] = None - next_hop: StrictStr = Field(..., description="The IPv4 address within the VRF of the host that will handle this route") - prefix: StrictStr = Field(..., description="The IPv4 prefix for the route, in CIDR-style notation. For a static default route, this will always be \"0.0.0.0/0\"") - tags: Optional[conlist(StrictStr)] = None - __properties = ["href", "next_hop", "prefix", "tags"] + next_hop: StrictStr = Field(description="The IPv4 address within the VRF of the host that will handle this route") + prefix: StrictStr = Field(description="The IPv4 prefix for the route, in CIDR-style notation. For a static default route, this will always be \"0.0.0.0/0\"") + tags: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["href", "next_hop", "prefix", "tags"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> VrfRouteCreateInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of VrfRouteCreateInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> VrfRouteCreateInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of VrfRouteCreateInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VrfRouteCreateInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = VrfRouteCreateInput.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), "next_hop": obj.get("next_hop"), "prefix": obj.get("prefix"), diff --git a/equinix_metal/equinix_metal/models/vrf_route_list.py b/equinix_metal/equinix_metal/models/vrf_route_list.py index 8dcef23e..c7fc887f 100644 --- a/equinix_metal/equinix_metal/models/vrf_route_list.py +++ b/equinix_metal/equinix_metal/models/vrf_route_list.py @@ -18,45 +18,61 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.meta import Meta from equinix_metal.models.vrf_route import VrfRoute +from typing import Optional, Set +from typing_extensions import Self class VrfRouteList(BaseModel): """ VrfRouteList - """ + """ # noqa: E501 href: Optional[StrictStr] = None meta: Optional[Meta] = None - routes: Optional[conlist(VrfRoute)] = None - __properties = ["href", "meta", "routes"] + routes: Optional[List[VrfRoute]] = None + __properties: ClassVar[List[str]] = ["href", "meta", "routes"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> VrfRouteList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of VrfRouteList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of meta if self.meta: _dict['meta'] = self.meta.to_dict() @@ -70,18 +86,18 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> VrfRouteList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of VrfRouteList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VrfRouteList.parse_obj(obj) + return cls.model_validate(obj) - _obj = VrfRouteList.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), - "meta": Meta.from_dict(obj.get("meta")) if obj.get("meta") is not None else None, - "routes": [VrfRoute.from_dict(_item) for _item in obj.get("routes")] if obj.get("routes") is not None else None + "meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None, + "routes": [VrfRoute.from_dict(_item) for _item in obj["routes"]] if obj.get("routes") is not None else None }) return _obj diff --git a/equinix_metal/equinix_metal/models/vrf_route_update_input.py b/equinix_metal/equinix_metal/models/vrf_route_update_input.py index 8d3a591c..af7ab426 100644 --- a/equinix_metal/equinix_metal/models/vrf_route_update_input.py +++ b/equinix_metal/equinix_metal/models/vrf_route_update_input.py @@ -18,56 +18,72 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class VrfRouteUpdateInput(BaseModel): """ VrfRouteUpdateInput - """ + """ # noqa: E501 href: Optional[StrictStr] = None - next_hop: Optional[StrictStr] = Field(None, description="The IPv4 address within the VRF of the host that will handle this route") - prefix: Optional[StrictStr] = Field(None, description="The IPv4 prefix for the route, in CIDR-style notation. For a static default route, this will always be \"0.0.0.0/0\"") - tags: Optional[conlist(StrictStr)] = None - __properties = ["href", "next_hop", "prefix", "tags"] + next_hop: Optional[StrictStr] = Field(default=None, description="The IPv4 address within the VRF of the host that will handle this route") + prefix: Optional[StrictStr] = Field(default=None, description="The IPv4 prefix for the route, in CIDR-style notation. For a static default route, this will always be \"0.0.0.0/0\"") + tags: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["href", "next_hop", "prefix", "tags"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> VrfRouteUpdateInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of VrfRouteUpdateInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> VrfRouteUpdateInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of VrfRouteUpdateInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VrfRouteUpdateInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = VrfRouteUpdateInput.parse_obj({ + _obj = cls.model_validate({ "href": obj.get("href"), "next_hop": obj.get("next_hop"), "prefix": obj.get("prefix"), diff --git a/equinix_metal/equinix_metal/models/vrf_update_input.py b/equinix_metal/equinix_metal/models/vrf_update_input.py index 1021dc9e..640c57d8 100644 --- a/equinix_metal/equinix_metal/models/vrf_update_input.py +++ b/equinix_metal/equinix_metal/models/vrf_update_input.py @@ -18,61 +18,77 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class VrfUpdateInput(BaseModel): """ VrfUpdateInput - """ - bgp_dynamic_neighbors_bfd_enabled: Optional[StrictBool] = Field(None, description="Toggle BFD on dynamic bgp neighbors sessions") - bgp_dynamic_neighbors_enabled: Optional[StrictBool] = Field(None, description="Toggle to enable the dynamic bgp neighbors feature on the VRF") - bgp_dynamic_neighbors_export_route_map: Optional[StrictBool] = Field(None, description="Toggle to export the VRF route-map to the dynamic bgp neighbors") + """ # noqa: E501 + bgp_dynamic_neighbors_bfd_enabled: Optional[StrictBool] = Field(default=None, description="Toggle BFD on dynamic bgp neighbors sessions") + bgp_dynamic_neighbors_enabled: Optional[StrictBool] = Field(default=None, description="Toggle to enable the dynamic bgp neighbors feature on the VRF") + bgp_dynamic_neighbors_export_route_map: Optional[StrictBool] = Field(default=None, description="Toggle to export the VRF route-map to the dynamic bgp neighbors") description: Optional[StrictStr] = None href: Optional[StrictStr] = None - ip_ranges: Optional[conlist(StrictStr)] = Field(None, description="A list of CIDR network addresses. Like [\"10.0.0.0/16\", \"2001:d78::/56\"]. IPv4 blocks must be between /8 and /29 in size. IPv6 blocks must be between /56 and /64. A VRF\\'s IP ranges must be defined in order to create VRF IP Reservations, which can then be used for Metal Gateways or Virtual Circuits. Adding a new CIDR address to the list will result in the creation of a new IP Range for this VRF. Removal of an existing CIDR address from the list will result in the deletion of an existing IP Range for this VRF. Deleting an IP Range will result in the deletion of any VRF IP Reservations contained within the IP Range, as well as the VRF IP Reservation\\'s associated Metal Gateways or Virtual Circuits. If you do not wish to add or remove IP Ranges, either include the full existing list of IP Ranges in the update request, or do not specify the `ip_ranges` field in the update request. Specifying a value of `[]` will remove all existing IP Ranges from the VRF.") - local_asn: Optional[StrictInt] = Field(None, description="The new `local_asn` value for the VRF. This field cannot be updated when there are active Interconnection Virtual Circuits associated to the VRF, or if any of the VLANs of the VRF's metal gateway has been assigned on an instance.") + ip_ranges: Optional[List[StrictStr]] = Field(default=None, description="A list of CIDR network addresses. Like [\"10.0.0.0/16\", \"2001:d78::/56\"]. IPv4 blocks must be between /8 and /29 in size. IPv6 blocks must be between /56 and /64. A VRF\\'s IP ranges must be defined in order to create VRF IP Reservations, which can then be used for Metal Gateways or Virtual Circuits. Adding a new CIDR address to the list will result in the creation of a new IP Range for this VRF. Removal of an existing CIDR address from the list will result in the deletion of an existing IP Range for this VRF. Deleting an IP Range will result in the deletion of any VRF IP Reservations contained within the IP Range, as well as the VRF IP Reservation\\'s associated Metal Gateways or Virtual Circuits. If you do not wish to add or remove IP Ranges, either include the full existing list of IP Ranges in the update request, or do not specify the `ip_ranges` field in the update request. Specifying a value of `[]` will remove all existing IP Ranges from the VRF.") + local_asn: Optional[StrictInt] = Field(default=None, description="The new `local_asn` value for the VRF. This field cannot be updated when there are active Interconnection Virtual Circuits associated to the VRF, or if any of the VLANs of the VRF's metal gateway has been assigned on an instance.") name: Optional[StrictStr] = None - tags: Optional[conlist(StrictStr)] = None - __properties = ["bgp_dynamic_neighbors_bfd_enabled", "bgp_dynamic_neighbors_enabled", "bgp_dynamic_neighbors_export_route_map", "description", "href", "ip_ranges", "local_asn", "name", "tags"] + tags: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["bgp_dynamic_neighbors_bfd_enabled", "bgp_dynamic_neighbors_enabled", "bgp_dynamic_neighbors_export_route_map", "description", "href", "ip_ranges", "local_asn", "name", "tags"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + 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) -> VrfUpdateInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of VrfUpdateInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> VrfUpdateInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of VrfUpdateInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VrfUpdateInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = VrfUpdateInput.parse_obj({ + _obj = cls.model_validate({ "bgp_dynamic_neighbors_bfd_enabled": obj.get("bgp_dynamic_neighbors_bfd_enabled"), "bgp_dynamic_neighbors_enabled": obj.get("bgp_dynamic_neighbors_enabled"), "bgp_dynamic_neighbors_export_route_map": obj.get("bgp_dynamic_neighbors_export_route_map"), diff --git a/equinix_metal/equinix_metal/models/vrf_virtual_circuit.py b/equinix_metal/equinix_metal/models/vrf_virtual_circuit.py index 5cf0027d..f57fc9c3 100644 --- a/equinix_metal/equinix_metal/models/vrf_virtual_circuit.py +++ b/equinix_metal/equinix_metal/models/vrf_virtual_circuit.py @@ -19,79 +19,96 @@ import json from datetime import datetime -from typing import List, Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional from equinix_metal.models.href import Href +from typing import Optional, Set +from typing_extensions import Self class VrfVirtualCircuit(BaseModel): """ VrfVirtualCircuit - """ + """ # noqa: E501 created_at: Optional[datetime] = None - customer_ip: Optional[StrictStr] = Field(None, description="An IP address from the subnet that will be used on the Customer side. This parameter is optional, but if supplied, we will use the other usable IP address in the subnet as the Metal IP. By default, the last usable IP address in the subnet will be used.") + customer_ip: Optional[StrictStr] = Field(default=None, description="An IP address from the subnet that will be used on the Customer side. This parameter is optional, but if supplied, we will use the other usable IP address in the subnet as the Metal IP. By default, the last usable IP address in the subnet will be used.") description: Optional[StrictStr] = None href: Optional[StrictStr] = None id: Optional[StrictStr] = None - md5: Optional[StrictStr] = Field(None, description="The MD5 password for the BGP peering in plaintext (not a checksum).") - metal_ip: Optional[StrictStr] = Field(None, description="An IP address from the subnet that will be used on the Metal side. This parameter is optional, but if supplied, we will use the other usable IP address in the subnet as the Customer IP. By default, the first usable IP address in the subnet will be used.") + md5: Optional[StrictStr] = Field(default=None, description="The MD5 password for the BGP peering in plaintext (not a checksum).") + metal_ip: Optional[StrictStr] = Field(default=None, description="An IP address from the subnet that will be used on the Metal side. This parameter is optional, but if supplied, we will use the other usable IP address in the subnet as the Customer IP. By default, the first usable IP address in the subnet will be used.") name: Optional[StrictStr] = None nni_vlan: Optional[StrictInt] = None - peer_asn: Optional[StrictInt] = Field(None, description="The peer ASN that will be used with the VRF on the Virtual Circuit.") + peer_asn: Optional[StrictInt] = Field(default=None, description="The peer ASN that will be used with the VRF on the Virtual Circuit.") port: Optional[Href] = None project: Optional[Href] = None - speed: Optional[StrictInt] = Field(None, description="integer representing bps speed") - status: Optional[StrictStr] = Field(None, description="The status changes of a VRF virtual circuit are generally the same as Virtual Circuits that aren't in a VRF. However, for VRF Virtual Circuits on Fabric VCs, the status will change to 'waiting_on_peering_details' once the Fabric service token associated with the virtual circuit has been redeemed on Fabric, and Metal has found the associated Fabric connection. At this point, users can update the subnet, MD5 password, customer IP and/or metal IP accordingly. For VRF Virtual Circuits on Dedicated Ports, we require all peering details to be set on creation of a VRF Virtual Circuit. The status will change to `changing_peering_details` whenever an active VRF Virtual Circuit has any of its peering details updated.") - subnet: Optional[StrictStr] = Field(None, description="The /30 or /31 subnet of one of the VRF IP Blocks that will be used with the VRF for the Virtual Circuit. This subnet does not have to be an existing VRF IP reservation, as we will create the VRF IP reservation on creation if it does not exist. The Metal IP and Customer IP must be IPs from this subnet. For /30 subnets, the network and broadcast IPs cannot be used as the Metal or Customer IP.") - tags: Optional[conlist(StrictStr)] = None + speed: Optional[StrictInt] = Field(default=None, description="integer representing bps speed") + status: Optional[StrictStr] = Field(default=None, description="The status changes of a VRF virtual circuit are generally the same as Virtual Circuits that aren't in a VRF. However, for VRF Virtual Circuits on Fabric VCs, the status will change to 'waiting_on_peering_details' once the Fabric service token associated with the virtual circuit has been redeemed on Fabric, and Metal has found the associated Fabric connection. At this point, users can update the subnet, MD5 password, customer IP and/or metal IP accordingly. For VRF Virtual Circuits on Dedicated Ports, we require all peering details to be set on creation of a VRF Virtual Circuit. The status will change to `changing_peering_details` whenever an active VRF Virtual Circuit has any of its peering details updated.") + subnet: Optional[StrictStr] = Field(default=None, description="The /30 or /31 subnet of one of the VRF IP Blocks that will be used with the VRF for the Virtual Circuit. This subnet does not have to be an existing VRF IP reservation, as we will create the VRF IP reservation on creation if it does not exist. The Metal IP and Customer IP must be IPs from this subnet. For /30 subnets, the network and broadcast IPs cannot be used as the Metal or Customer IP.") + tags: Optional[List[StrictStr]] = None type: Optional[StrictStr] = None updated_at: Optional[datetime] = None - vrf: Vrf = Field(...) - __properties = ["created_at", "customer_ip", "description", "href", "id", "md5", "metal_ip", "name", "nni_vlan", "peer_asn", "port", "project", "speed", "status", "subnet", "tags", "type", "updated_at", "vrf"] + vrf: Vrf + __properties: ClassVar[List[str]] = ["created_at", "customer_ip", "description", "href", "id", "md5", "metal_ip", "name", "nni_vlan", "peer_asn", "port", "project", "speed", "status", "subnet", "tags", "type", "updated_at", "vrf"] - @validator('status') + @field_validator('status') def status_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('pending', 'waiting_on_peering_details', 'activating', 'changing_peering_details', 'deactivating', 'deleting', 'active', 'expired', 'activation_failed', 'changing_peering_details_failed', 'deactivation_failed', 'delete_failed'): + if value not in set(['pending', 'waiting_on_peering_details', 'activating', 'changing_peering_details', 'deactivating', 'deleting', 'active', 'expired', 'activation_failed', 'changing_peering_details_failed', 'deactivation_failed', 'delete_failed']): raise ValueError("must be one of enum values ('pending', 'waiting_on_peering_details', 'activating', 'changing_peering_details', 'deactivating', 'deleting', 'active', 'expired', 'activation_failed', 'changing_peering_details_failed', 'deactivation_failed', 'delete_failed')") return value - @validator('type') + @field_validator('type') def type_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ('vrf'): + if value not in set(['vrf']): raise ValueError("must be one of enum values ('vrf')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> VrfVirtualCircuit: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of VrfVirtualCircuit from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # override the default output from pydantic by calling `to_dict()` of port if self.port: _dict['port'] = self.port.to_dict() @@ -104,15 +121,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> VrfVirtualCircuit: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of VrfVirtualCircuit from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VrfVirtualCircuit.parse_obj(obj) + return cls.model_validate(obj) - _obj = VrfVirtualCircuit.parse_obj({ + _obj = cls.model_validate({ "created_at": obj.get("created_at"), "customer_ip": obj.get("customer_ip"), "description": obj.get("description"), @@ -123,18 +140,19 @@ def from_dict(cls, obj: dict) -> VrfVirtualCircuit: "name": obj.get("name"), "nni_vlan": obj.get("nni_vlan"), "peer_asn": obj.get("peer_asn"), - "port": Href.from_dict(obj.get("port")) if obj.get("port") is not None else None, - "project": Href.from_dict(obj.get("project")) if obj.get("project") is not None else None, + "port": Href.from_dict(obj["port"]) if obj.get("port") is not None else None, + "project": Href.from_dict(obj["project"]) if obj.get("project") is not None else None, "speed": obj.get("speed"), "status": obj.get("status"), "subnet": obj.get("subnet"), "tags": obj.get("tags"), "type": obj.get("type"), "updated_at": obj.get("updated_at"), - "vrf": Vrf.from_dict(obj.get("vrf")) if obj.get("vrf") is not None else None + "vrf": Vrf.from_dict(obj["vrf"]) if obj.get("vrf") is not None else None }) return _obj from equinix_metal.models.vrf import Vrf -VrfVirtualCircuit.update_forward_refs() +# TODO: Rewrite to not use raise_errors +VrfVirtualCircuit.model_rebuild(raise_errors=False) diff --git a/equinix_metal/equinix_metal/models/vrf_virtual_circuit_create_input.py b/equinix_metal/equinix_metal/models/vrf_virtual_circuit_create_input.py index 845d3cf3..c830f994 100644 --- a/equinix_metal/equinix_metal/models/vrf_virtual_circuit_create_input.py +++ b/equinix_metal/equinix_metal/models/vrf_virtual_circuit_create_input.py @@ -18,30 +18,32 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, conint, conlist, constr, validator +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self class VrfVirtualCircuitCreateInput(BaseModel): """ VrfVirtualCircuitCreateInput - """ - customer_ip: Optional[StrictStr] = Field(None, description="An IP address from the subnet that will be used on the Customer side. This parameter is optional, but if supplied, we will use the other usable IP address in the subnet as the Metal IP. By default, the last usable IP address in the subnet will be used.") + """ # noqa: E501 + customer_ip: Optional[StrictStr] = Field(default=None, description="An IP address from the subnet that will be used on the Customer side. This parameter is optional, but if supplied, we will use the other usable IP address in the subnet as the Metal IP. By default, the last usable IP address in the subnet will be used.") description: Optional[StrictStr] = None href: Optional[StrictStr] = None - md5: Optional[constr(strict=True)] = Field(None, description="The plaintext BGP peering password shared by neighbors as an MD5 checksum: * must be 10-20 characters long * may not include punctuation * must be a combination of numbers and letters * must contain at least one lowercase, uppercase, and digit character ") - metal_ip: Optional[StrictStr] = Field(None, description="An IP address from the subnet that will be used on the Metal side. This parameter is optional, but if supplied, we will use the other usable IP address in the subnet as the Customer IP. By default, the first usable IP address in the subnet will be used.") + md5: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="The plaintext BGP peering password shared by neighbors as an MD5 checksum: * must be 10-20 characters long * may not include punctuation * must be a combination of numbers and letters * must contain at least one lowercase, uppercase, and digit character ") + metal_ip: Optional[StrictStr] = Field(default=None, description="An IP address from the subnet that will be used on the Metal side. This parameter is optional, but if supplied, we will use the other usable IP address in the subnet as the Customer IP. By default, the first usable IP address in the subnet will be used.") name: Optional[StrictStr] = None - nni_vlan: conint(strict=True, le=4094, ge=2) = Field(...) - peer_asn: StrictInt = Field(..., description="The peer ASN that will be used with the VRF on the Virtual Circuit.") - project_id: StrictStr = Field(...) - speed: Optional[StrictStr] = Field(None, description="speed can be passed as integer number representing bps speed or string (e.g. '52m' or '100g' or '4 gbps')") - subnet: StrictStr = Field(..., description="The /30 or /31 subnet of one of the VRF IP Blocks that will be used with the VRF for the Virtual Circuit. This subnet does not have to be an existing VRF IP reservation, as we will create the VRF IP reservation on creation if it does not exist. The Metal IP and Customer IP must be IPs from this subnet. For /30 subnets, the network and broadcast IPs cannot be used as the Metal or Customer IP. The subnet specified must be contained within an already-defined IP Range for the VRF.") - tags: Optional[conlist(StrictStr)] = None - vrf: StrictStr = Field(..., description="The UUID of the VRF that will be associated with the Virtual Circuit.") - __properties = ["customer_ip", "description", "href", "md5", "metal_ip", "name", "nni_vlan", "peer_asn", "project_id", "speed", "subnet", "tags", "vrf"] - - @validator('md5') + nni_vlan: Annotated[int, Field(le=4094, strict=True, ge=2)] + peer_asn: StrictInt = Field(description="The peer ASN that will be used with the VRF on the Virtual Circuit.") + project_id: StrictStr + speed: Optional[StrictStr] = Field(default=None, description="speed can be passed as integer number representing bps speed or string (e.g. '52m' or '100g' or '4 gbps')") + subnet: StrictStr = Field(description="The /30 or /31 subnet of one of the VRF IP Blocks that will be used with the VRF for the Virtual Circuit. This subnet does not have to be an existing VRF IP reservation, as we will create the VRF IP reservation on creation if it does not exist. The Metal IP and Customer IP must be IPs from this subnet. For /30 subnets, the network and broadcast IPs cannot be used as the Metal or Customer IP. The subnet specified must be contained within an already-defined IP Range for the VRF.") + tags: Optional[List[StrictStr]] = None + vrf: StrictStr = Field(description="The UUID of the VRF that will be associated with the Virtual Circuit.") + __properties: ClassVar[List[str]] = ["customer_ip", "description", "href", "md5", "metal_ip", "name", "nni_vlan", "peer_asn", "project_id", "speed", "subnet", "tags", "vrf"] + + @field_validator('md5') def md5_validate_regular_expression(cls, value): """Validates the regular expression""" if value is None: @@ -51,47 +53,62 @@ def md5_validate_regular_expression(cls, value): raise ValueError(r"must validate the regular expression /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{10,20}$/") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> VrfVirtualCircuitCreateInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of VrfVirtualCircuitCreateInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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, + ) # set to None if md5 (nullable) is None - # and __fields_set__ contains the field - if self.md5 is None and "md5" in self.__fields_set__: + # and model_fields_set contains the field + if self.md5 is None and "md5" in self.model_fields_set: _dict['md5'] = None return _dict @classmethod - def from_dict(cls, obj: dict) -> VrfVirtualCircuitCreateInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of VrfVirtualCircuitCreateInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VrfVirtualCircuitCreateInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = VrfVirtualCircuitCreateInput.parse_obj({ + _obj = cls.model_validate({ "customer_ip": obj.get("customer_ip"), "description": obj.get("description"), "href": obj.get("href"), diff --git a/equinix_metal/equinix_metal/models/vrf_virtual_circuit_update_input.py b/equinix_metal/equinix_metal/models/vrf_virtual_circuit_update_input.py index 76841fd4..73f9d4b0 100644 --- a/equinix_metal/equinix_metal/models/vrf_virtual_circuit_update_input.py +++ b/equinix_metal/equinix_metal/models/vrf_virtual_circuit_update_input.py @@ -18,27 +18,29 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist, constr, validator +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self class VrfVirtualCircuitUpdateInput(BaseModel): """ VrfVirtualCircuitUpdateInput - """ - customer_ip: Optional[StrictStr] = Field(None, description="An IP address from the subnet that will be used on the Customer side. This parameter is optional, but if supplied, we will use the other usable IP address in the subnet as the Metal IP. By default, the last usable IP address in the subnet will be used.") + """ # noqa: E501 + customer_ip: Optional[StrictStr] = Field(default=None, description="An IP address from the subnet that will be used on the Customer side. This parameter is optional, but if supplied, we will use the other usable IP address in the subnet as the Metal IP. By default, the last usable IP address in the subnet will be used.") description: Optional[StrictStr] = None href: Optional[StrictStr] = None - md5: Optional[constr(strict=True)] = Field(None, description="The plaintext BGP peering password shared by neighbors as an MD5 checksum: * must be 10-20 characters long * may not include punctuation * must be a combination of numbers and letters * must contain at least one lowercase, uppercase, and digit character ") - metal_ip: Optional[StrictStr] = Field(None, description="An IP address from the subnet that will be used on the Metal side. This parameter is optional, but if supplied, we will use the other usable IP address in the subnet as the Customer IP. By default, the first usable IP address in the subnet will be used.") + md5: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="The plaintext BGP peering password shared by neighbors as an MD5 checksum: * must be 10-20 characters long * may not include punctuation * must be a combination of numbers and letters * must contain at least one lowercase, uppercase, and digit character ") + metal_ip: Optional[StrictStr] = Field(default=None, description="An IP address from the subnet that will be used on the Metal side. This parameter is optional, but if supplied, we will use the other usable IP address in the subnet as the Customer IP. By default, the first usable IP address in the subnet will be used.") name: Optional[StrictStr] = None - peer_asn: Optional[StrictInt] = Field(None, description="The peer ASN that will be used with the VRF on the Virtual Circuit.") - speed: Optional[StrictStr] = Field(None, description="Speed can be changed only if it is an interconnection on a Dedicated Port") - subnet: Optional[StrictStr] = Field(None, description="The /30 or /31 subnet of one of the VRF IP Blocks that will be used with the VRF for the Virtual Circuit. This subnet does not have to be an existing VRF IP reservation, as we will create the VRF IP reservation on creation if it does not exist. The Metal IP and Customer IP must be IPs from this subnet. For /30 subnets, the network and broadcast IPs cannot be used as the Metal or Customer IP.") - tags: Optional[conlist(StrictStr)] = None - __properties = ["customer_ip", "description", "href", "md5", "metal_ip", "name", "peer_asn", "speed", "subnet", "tags"] + peer_asn: Optional[StrictInt] = Field(default=None, description="The peer ASN that will be used with the VRF on the Virtual Circuit.") + speed: Optional[StrictStr] = Field(default=None, description="Speed can be changed only if it is an interconnection on a Dedicated Port") + subnet: Optional[StrictStr] = Field(default=None, description="The /30 or /31 subnet of one of the VRF IP Blocks that will be used with the VRF for the Virtual Circuit. This subnet does not have to be an existing VRF IP reservation, as we will create the VRF IP reservation on creation if it does not exist. The Metal IP and Customer IP must be IPs from this subnet. For /30 subnets, the network and broadcast IPs cannot be used as the Metal or Customer IP.") + tags: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["customer_ip", "description", "href", "md5", "metal_ip", "name", "peer_asn", "speed", "subnet", "tags"] - @validator('md5') + @field_validator('md5') def md5_validate_regular_expression(cls, value): """Validates the regular expression""" if value is None: @@ -48,42 +50,57 @@ def md5_validate_regular_expression(cls, value): raise ValueError(r"must validate the regular expression /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{10,20}$/") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + 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.dict(by_alias=True)) + 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) -> VrfVirtualCircuitUpdateInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of VrfVirtualCircuitUpdateInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) + 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: dict) -> VrfVirtualCircuitUpdateInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of VrfVirtualCircuitUpdateInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VrfVirtualCircuitUpdateInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = VrfVirtualCircuitUpdateInput.parse_obj({ + _obj = cls.model_validate({ "customer_ip": obj.get("customer_ip"), "description": obj.get("description"), "href": obj.get("href"), diff --git a/equinix_metal/equinix_metal/rest.py b/equinix_metal/equinix_metal/rest.py index d28f9ed0..a3a825da 100644 --- a/equinix_metal/equinix_metal/rest.py +++ b/equinix_metal/equinix_metal/rest.py @@ -15,43 +15,55 @@ import io import json -import logging import re import ssl -from urllib.parse import urlencode, quote_plus import urllib3 -from equinix_metal.exceptions import ApiException, UnauthorizedException, ForbiddenException, NotFoundException, ServiceException, ApiValueError, BadRequestException +from equinix_metal.exceptions import ApiException, ApiValueError +SUPPORTED_SOCKS_PROXIES = {"socks5", "socks5h", "socks4", "socks4a"} +RESTResponseType = urllib3.HTTPResponse -logger = logging.getLogger(__name__) + +def is_socks_proxy_url(url): + if url is None: + return False + split_section = url.split("://") + if len(split_section) < 2: + return False + else: + return split_section[0].lower() in SUPPORTED_SOCKS_PROXIES class RESTResponse(io.IOBase): - def __init__(self, resp): - self.urllib3_response = resp + def __init__(self, resp) -> None: + self.response = resp self.status = resp.status self.reason = resp.reason - self.data = resp.data + self.data = None + + def read(self): + if self.data is None: + self.data = self.response.data + return self.data def getheaders(self): """Returns a dictionary of the response headers.""" - return self.urllib3_response.headers + return self.response.headers def getheader(self, name, default=None): """Returns a given response header.""" - return self.urllib3_response.headers.get(name, default) + return self.response.headers.get(name, default) -class RESTClientObject(object): +class RESTClientObject: - def __init__(self, configuration, pools_size=4, maxsize=None): + def __init__(self, configuration) -> None: # urllib3.PoolManager will pass all kw parameters to connectionpool # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501 - # maxsize is the number of requests to host that are allowed in parallel # noqa: E501 # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501 # cert_reqs @@ -60,74 +72,79 @@ def __init__(self, configuration, pools_size=4, maxsize=None): else: cert_reqs = ssl.CERT_NONE - addition_pool_args = {} + pool_args = { + "cert_reqs": cert_reqs, + "ca_certs": configuration.ssl_ca_cert, + "cert_file": configuration.cert_file, + "key_file": configuration.key_file, + } if configuration.assert_hostname is not None: - addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501 + pool_args['assert_hostname'] = ( + configuration.assert_hostname + ) if configuration.retries is not None: - addition_pool_args['retries'] = configuration.retries + pool_args['retries'] = configuration.retries if configuration.tls_server_name: - addition_pool_args['server_hostname'] = configuration.tls_server_name + pool_args['server_hostname'] = configuration.tls_server_name if configuration.socket_options is not None: - addition_pool_args['socket_options'] = configuration.socket_options + pool_args['socket_options'] = configuration.socket_options - if maxsize is None: - if configuration.connection_pool_maxsize is not None: - maxsize = configuration.connection_pool_maxsize - else: - maxsize = 4 + if configuration.connection_pool_maxsize is not None: + pool_args['maxsize'] = configuration.connection_pool_maxsize # https pool manager + self.pool_manager: urllib3.PoolManager + if configuration.proxy: - self.pool_manager = urllib3.ProxyManager( - num_pools=pools_size, - maxsize=maxsize, - cert_reqs=cert_reqs, - ca_certs=configuration.ssl_ca_cert, - cert_file=configuration.cert_file, - key_file=configuration.key_file, - proxy_url=configuration.proxy, - proxy_headers=configuration.proxy_headers, - **addition_pool_args - ) + if is_socks_proxy_url(configuration.proxy): + from urllib3.contrib.socks import SOCKSProxyManager + pool_args["proxy_url"] = configuration.proxy + pool_args["headers"] = configuration.proxy_headers + self.pool_manager = SOCKSProxyManager(**pool_args) + else: + pool_args["proxy_url"] = configuration.proxy + pool_args["proxy_headers"] = configuration.proxy_headers + self.pool_manager = urllib3.ProxyManager(**pool_args) else: - self.pool_manager = urllib3.PoolManager( - num_pools=pools_size, - maxsize=maxsize, - cert_reqs=cert_reqs, - ca_certs=configuration.ssl_ca_cert, - cert_file=configuration.cert_file, - key_file=configuration.key_file, - **addition_pool_args - ) - - def request(self, method, url, query_params=None, headers=None, - body=None, post_params=None, _preload_content=True, - _request_timeout=None): + self.pool_manager = urllib3.PoolManager(**pool_args) + + def request( + self, + method, + url, + headers=None, + body=None, + post_params=None, + _request_timeout=None + ): """Perform requests. :param method: http request method :param url: http request url - :param query_params: query parameters in the url :param headers: http request headers :param body: request json body, for `application/json` :param post_params: request post parameters, `application/x-www-form-urlencoded` and `multipart/form-data` - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. """ method = method.upper() - assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT', - 'PATCH', 'OPTIONS'] + assert method in [ + 'GET', + 'HEAD', + 'DELETE', + 'POST', + 'PUT', + 'PATCH', + 'OPTIONS' + ] if post_params and body: raise ApiValueError( @@ -136,63 +153,84 @@ def request(self, method, url, query_params=None, headers=None, post_params = post_params or {} headers = headers or {} - # url already contains the URL query string - # so reset query_params to empty dict - query_params = {} timeout = None if _request_timeout: - if isinstance(_request_timeout, (int,float)): # noqa: E501,F821 + if isinstance(_request_timeout, (int, float)): timeout = urllib3.Timeout(total=_request_timeout) - elif (isinstance(_request_timeout, tuple) and - len(_request_timeout) == 2): + elif ( + isinstance(_request_timeout, tuple) + and len(_request_timeout) == 2 + ): timeout = urllib3.Timeout( - connect=_request_timeout[0], read=_request_timeout[1]) + connect=_request_timeout[0], + read=_request_timeout[1] + ) try: # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: # no content type provided or payload is json - if not headers.get('Content-Type') or re.search('json', headers['Content-Type'], re.IGNORECASE): + content_type = headers.get('Content-Type') + if ( + not content_type + or re.search('json', content_type, re.IGNORECASE) + ): request_body = None if body is not None: request_body = json.dumps(body) r = self.pool_manager.request( - method, url, + method, + url, body=request_body, - preload_content=_preload_content, timeout=timeout, - headers=headers) - elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 + headers=headers, + preload_content=False + ) + elif content_type == 'application/x-www-form-urlencoded': r = self.pool_manager.request( - method, url, + method, + url, fields=post_params, encode_multipart=False, - preload_content=_preload_content, timeout=timeout, - headers=headers) - elif headers['Content-Type'] == 'multipart/form-data': + headers=headers, + preload_content=False + ) + elif content_type == 'multipart/form-data': # must del headers['Content-Type'], or the correct # Content-Type which generated by urllib3 will be # overwritten. del headers['Content-Type'] r = self.pool_manager.request( - method, url, + method, + url, fields=post_params, encode_multipart=True, - preload_content=_preload_content, timeout=timeout, - headers=headers) + headers=headers, + preload_content=False + ) # Pass a `string` parameter directly in the body to support - # other content types than Json when `body` argument is - # provided in serialized form + # other content types than JSON when `body` argument is + # provided in serialized form. elif isinstance(body, str) or isinstance(body, bytes): - request_body = body r = self.pool_manager.request( - method, url, + method, + url, + body=body, + timeout=timeout, + headers=headers, + preload_content=False + ) + elif headers['Content-Type'] == 'text/plain' and isinstance(body, bool): + request_body = "true" if body else "false" + r = self.pool_manager.request( + method, + url, body=request_body, - preload_content=_preload_content, + preload_content=False, timeout=timeout, headers=headers) else: @@ -203,102 +241,16 @@ def request(self, method, url, query_params=None, headers=None, raise ApiException(status=0, reason=msg) # For `GET`, `HEAD` else: - r = self.pool_manager.request(method, url, - fields={}, - preload_content=_preload_content, - timeout=timeout, - headers=headers) + r = self.pool_manager.request( + method, + url, + fields={}, + timeout=timeout, + headers=headers, + preload_content=False + ) except urllib3.exceptions.SSLError as e: - msg = "{0}\n{1}".format(type(e).__name__, str(e)) + msg = "\n".join([type(e).__name__, str(e)]) raise ApiException(status=0, reason=msg) - if _preload_content: - r = RESTResponse(r) - - # log response body - logger.debug("response body: %s", r.data) - - if not 200 <= r.status <= 299: - if r.status == 400: - raise BadRequestException(http_resp=r) - - if r.status == 401: - raise UnauthorizedException(http_resp=r) - - if r.status == 403: - raise ForbiddenException(http_resp=r) - - if r.status == 404: - raise NotFoundException(http_resp=r) - - if 500 <= r.status <= 599: - raise ServiceException(http_resp=r) - - raise ApiException(http_resp=r) - - return r - - def get_request(self, url, headers=None, query_params=None, _preload_content=True, - _request_timeout=None): - return self.request("GET", url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params) - - def head_request(self, url, headers=None, query_params=None, _preload_content=True, - _request_timeout=None): - return self.request("HEAD", url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params) - - def options_request(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None): - return self.request("OPTIONS", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - - def delete_request(self, url, headers=None, query_params=None, body=None, - _preload_content=True, _request_timeout=None): - return self.request("DELETE", url, - headers=headers, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - - def post_request(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None): - return self.request("POST", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - - def put_request(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None): - return self.request("PUT", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - - def patch_request(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None): - return self.request("PATCH", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + return RESTResponse(r) diff --git a/equinix_metal/pyproject.toml b/equinix_metal/pyproject.toml index 3076c634..13a465f5 100644 --- a/equinix_metal/pyproject.toml +++ b/equinix_metal/pyproject.toml @@ -14,13 +14,16 @@ python = "^3.7" urllib3 = ">= 1.25.3" python-dateutil = ">=2.8.2" -pydantic = "^1.10.5, <2" -aenum = ">=3.1.11" +pydantic = ">=2" +typing-extensions = ">=4.7.1" [tool.poetry.dev-dependencies] pytest = ">=7.2.1" tox = ">=3.9.0" flake8 = ">=4.0.0" +types-python-dateutil = ">=2.8.19.14" +mypy = "1.4.1" + [build-system] requires = ["setuptools"] @@ -28,3 +31,41 @@ build-backend = "setuptools.build_meta" [tool.pylint.'MESSAGES CONTROL'] extension-pkg-whitelist = "pydantic" + +[tool.mypy] +files = [ + "equinix_metal", + #"test", # auto-generated tests + "tests", # hand-written tests +] +# TODO: enable "strict" once all these individual checks are passing +# strict = true + +# List from: https://mypy.readthedocs.io/en/stable/existing_code.html#introduce-stricter-options +warn_unused_configs = true +warn_redundant_casts = true +warn_unused_ignores = true + +## Getting these passing should be easy +strict_equality = true +strict_concatenate = true + +## Strongly recommend enabling this one as soon as you can +check_untyped_defs = true + +## These shouldn't be too much additional work, but may be tricky to +## get passing if you use a lot of untyped libraries +disallow_subclassing_any = true +disallow_untyped_decorators = true +disallow_any_generics = true + +### These next few are various gradations of forcing use of type annotations +#disallow_untyped_calls = true +#disallow_incomplete_defs = true +#disallow_untyped_defs = true +# +### This one isn't too hard to get passing, but return on investment is lower +#no_implicit_reexport = true +# +### This one can be tricky to get passing if you use a lot of untyped libraries +#warn_return_any = true diff --git a/equinix_metal/requirements.txt b/equinix_metal/requirements.txt index 258c179c..cc85509e 100644 --- a/equinix_metal/requirements.txt +++ b/equinix_metal/requirements.txt @@ -1,5 +1,5 @@ python_dateutil >= 2.5.3 setuptools >= 21.0.0 urllib3 >= 1.25.3, < 2.1.0 -pydantic >= 1.10.5, < 2 -aenum >= 3.1.11 +pydantic >= 2 +typing-extensions >= 4.7.1 diff --git a/equinix_metal/setup.py b/equinix_metal/setup.py index 369336b9..b029c961 100644 --- a/equinix_metal/setup.py +++ b/equinix_metal/setup.py @@ -27,8 +27,8 @@ REQUIRES = [ "urllib3 >= 1.25.3, < 2.1.0", "python-dateutil", - "pydantic >= 1.10.5, < 2", - "aenum" + "pydantic >= 2", + "typing-extensions >= 4.7.1", ] setup( diff --git a/equinix_metal/test-requirements.txt b/equinix_metal/test-requirements.txt index 3a0d0b93..8e6d8cb1 100644 --- a/equinix_metal/test-requirements.txt +++ b/equinix_metal/test-requirements.txt @@ -1,3 +1,5 @@ pytest~=7.1.3 pytest-cov>=2.8.1 pytest-randomly>=3.12.0 +mypy>=1.4.1 +types-python-dateutil>=2.8.19 diff --git a/equinix_metal/test/test_activate_hardware_reservation_request.py b/equinix_metal/test/test_activate_hardware_reservation_request.py index 4e5df0a3..feeba73e 100644 --- a/equinix_metal/test/test_activate_hardware_reservation_request.py +++ b/equinix_metal/test/test_activate_hardware_reservation_request.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.activate_hardware_reservation_request import ActivateHardwareReservationRequest # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.activate_hardware_reservation_request import ActivateHardwareReservationRequest class TestActivateHardwareReservationRequest(unittest.TestCase): """ActivateHardwareReservationRequest unit test stubs""" @@ -29,20 +26,20 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> ActivateHardwareReservationRequest: """Test ActivateHardwareReservationRequest include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `ActivateHardwareReservationRequest` """ - model = equinix_metal.models.activate_hardware_reservation_request.ActivateHardwareReservationRequest() # noqa: E501 - if include_optional : + model = ActivateHardwareReservationRequest() + if include_optional: return ActivateHardwareReservationRequest( - description = '', + description = '', href = '' ) - else : + else: return ActivateHardwareReservationRequest( ) """ diff --git a/equinix_metal/test/test_address.py b/equinix_metal/test/test_address.py index 2f10af95..a8cc5818 100644 --- a/equinix_metal/test/test_address.py +++ b/equinix_metal/test/test_address.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.address import Address # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.address import Address class TestAddress(unittest.TestCase): """Address unit test stubs""" @@ -29,29 +26,29 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Address: """Test Address include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Address` """ - model = equinix_metal.models.address.Address() # noqa: E501 - if include_optional : + model = Address() + if include_optional: return Address( - address = '', - address2 = '', - city = '', + address = '', + address2 = '', + city = '', coordinates = equinix_metal.models.coordinates.Coordinates( href = '', latitude = '', - longitude = '', ), - country = '', - href = '', - state = '', + longitude = '', ), + country = '', + href = '', + state = '', zip_code = '' ) - else : + else: return Address( ) """ diff --git a/equinix_metal/test/test_attribute.py b/equinix_metal/test/test_attribute.py index beb45904..eb640412 100644 --- a/equinix_metal/test/test_attribute.py +++ b/equinix_metal/test/test_attribute.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.attribute import Attribute # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.attribute import Attribute class TestAttribute(unittest.TestCase): """Attribute unit test stubs""" @@ -29,28 +26,28 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Attribute: """Test Attribute include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Attribute` """ - model = equinix_metal.models.attribute.Attribute() # noqa: E501 - if include_optional : + model = Attribute() + if include_optional: return Attribute( - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), data = equinix_metal.models.attribute_data.AttributeData( href = '', latest = True, model = '', plan = '', - vendor = '', ), - href = '', - namespace = '', + vendor = '', ), + href = '', + namespace = '', updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f') ) - else : + else: return Attribute( ) """ diff --git a/equinix_metal/test/test_attribute_data.py b/equinix_metal/test/test_attribute_data.py index e1ceb64f..4136c64a 100644 --- a/equinix_metal/test/test_attribute_data.py +++ b/equinix_metal/test/test_attribute_data.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.attribute_data import AttributeData # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.attribute_data import AttributeData class TestAttributeData(unittest.TestCase): """AttributeData unit test stubs""" @@ -29,23 +26,23 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> AttributeData: """Test AttributeData include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `AttributeData` """ - model = equinix_metal.models.attribute_data.AttributeData() # noqa: E501 - if include_optional : + model = AttributeData() + if include_optional: return AttributeData( - href = '', - latest = True, - model = '', - plan = '', + href = '', + latest = True, + model = '', + plan = '', vendor = '' ) - else : + else: return AttributeData( ) """ diff --git a/equinix_metal/test/test_auth_token.py b/equinix_metal/test/test_auth_token.py index bd360261..ea050b7b 100644 --- a/equinix_metal/test/test_auth_token.py +++ b/equinix_metal/test/test_auth_token.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.auth_token import AuthToken # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.auth_token import AuthToken class TestAuthToken(unittest.TestCase): """AuthToken unit test stubs""" @@ -29,27 +26,27 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> AuthToken: """Test AuthToken include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `AuthToken` """ - model = equinix_metal.models.auth_token.AuthToken() # noqa: E501 - if include_optional : + model = AuthToken() + if include_optional: return AuthToken( - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - description = '', - href = '', - id = '', - project = None, - read_only = True, - token = '', - updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + description = '', + href = '', + id = '', + project = None, + read_only = True, + token = '', + updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), user = None ) - else : + else: return AuthToken( ) """ diff --git a/equinix_metal/test/test_auth_token_input.py b/equinix_metal/test/test_auth_token_input.py index b4e89bd3..522ef7f9 100644 --- a/equinix_metal/test/test_auth_token_input.py +++ b/equinix_metal/test/test_auth_token_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.auth_token_input import AuthTokenInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.auth_token_input import AuthTokenInput class TestAuthTokenInput(unittest.TestCase): """AuthTokenInput unit test stubs""" @@ -29,21 +26,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> AuthTokenInput: """Test AuthTokenInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `AuthTokenInput` """ - model = equinix_metal.models.auth_token_input.AuthTokenInput() # noqa: E501 - if include_optional : + model = AuthTokenInput() + if include_optional: return AuthTokenInput( - description = '', - href = '', + description = '', + href = '', read_only = True ) - else : + else: return AuthTokenInput( ) """ diff --git a/equinix_metal/test/test_auth_token_list.py b/equinix_metal/test/test_auth_token_list.py index 11cff84d..c752d6e4 100644 --- a/equinix_metal/test/test_auth_token_list.py +++ b/equinix_metal/test/test_auth_token_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.auth_token_list import AuthTokenList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.auth_token_list import AuthTokenList class TestAuthTokenList(unittest.TestCase): """AuthTokenList unit test stubs""" @@ -29,15 +26,15 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> AuthTokenList: """Test AuthTokenList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `AuthTokenList` """ - model = equinix_metal.models.auth_token_list.AuthTokenList() # noqa: E501 - if include_optional : + model = AuthTokenList() + if include_optional: return AuthTokenList( api_keys = [ equinix_metal.models.auth_token.AuthToken( @@ -50,10 +47,10 @@ def make_instance(self, include_optional): token = '', updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), user = null, ) - ], + ], href = '' ) - else : + else: return AuthTokenList( ) """ diff --git a/equinix_metal/test/test_auth_token_project.py b/equinix_metal/test/test_auth_token_project.py index d61cc024..4618ce2f 100644 --- a/equinix_metal/test/test_auth_token_project.py +++ b/equinix_metal/test/test_auth_token_project.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.auth_token_project import AuthTokenProject # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.auth_token_project import AuthTokenProject class TestAuthTokenProject(unittest.TestCase): """AuthTokenProject unit test stubs""" @@ -29,61 +26,61 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> AuthTokenProject: """Test AuthTokenProject include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `AuthTokenProject` """ - model = equinix_metal.models.auth_token_project.AuthTokenProject() # noqa: E501 - if include_optional : + model = AuthTokenProject() + if include_optional: return AuthTokenProject( - backend_transfer_enabled = True, + backend_transfer_enabled = True, bgp_config = equinix_metal.models.href.Href( - href = '', ), - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - customdata = equinix_metal.models.customdata.customdata(), + href = '', ), + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + customdata = equinix_metal.models.customdata.customdata(), devices = [ equinix_metal.models.href.Href( href = '', ) - ], - href = '', - id = '', + ], + href = '', + id = '', invitations = [ equinix_metal.models.href.Href( href = '', ) - ], - max_devices = equinix_metal.models.max_devices.max_devices(), + ], + max_devices = equinix_metal.models.max_devices.max_devices(), members = [ equinix_metal.models.href.Href( href = '', ) - ], + ], memberships = [ equinix_metal.models.href.Href( href = '', ) - ], - name = '0', - network_status = equinix_metal.models.network_status.network_status(), + ], + name = '0', + network_status = equinix_metal.models.network_status.network_status(), organization = equinix_metal.models.href.Href( - href = '', ), + href = '', ), payment_method = equinix_metal.models.href.Href( - href = '', ), + href = '', ), ssh_keys = [ equinix_metal.models.href.Href( href = '', ) - ], + ], tags = [ '' - ], - type = 'default', - updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + ], + type = 'default', + updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), volumes = [ equinix_metal.models.href.Href( href = '', ) ] ) - else : + else: return AuthTokenProject( ) """ diff --git a/equinix_metal/test/test_auth_token_user.py b/equinix_metal/test/test_auth_token_user.py index cb7c2983..0fd2d8fe 100644 --- a/equinix_metal/test/test_auth_token_user.py +++ b/equinix_metal/test/test_auth_token_user.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.auth_token_user import AuthTokenUser # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.auth_token_user import AuthTokenUser class TestAuthTokenUser(unittest.TestCase): """AuthTokenUser unit test stubs""" @@ -29,43 +26,43 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> AuthTokenUser: """Test AuthTokenUser include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `AuthTokenUser` """ - model = equinix_metal.models.auth_token_user.AuthTokenUser() # noqa: E501 - if include_optional : + model = AuthTokenUser() + if include_optional: return AuthTokenUser( - avatar_thumb_url = '', - avatar_url = '', - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - customdata = equinix_metal.models.customdata.customdata(), - default_organization_id = '', - default_project_id = '', - email = '', + avatar_thumb_url = '', + avatar_url = '', + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + customdata = equinix_metal.models.customdata.customdata(), + default_organization_id = '', + default_project_id = '', + email = '', emails = [ equinix_metal.models.href.Href( href = '', ) - ], - first_name = '', - fraud_score = '', - full_name = '', - href = '', - id = '', - last_login_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - last_name = '', - max_organizations = 56, - max_projects = 56, - phone_number = '', - short_id = '', - timezone = '', - two_factor_auth = '', + ], + first_name = '', + fraud_score = '', + full_name = '', + href = '', + id = '', + last_login_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + last_name = '', + max_organizations = 56, + max_projects = 56, + phone_number = '', + short_id = '', + timezone = '', + two_factor_auth = '', updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f') ) - else : + else: return AuthTokenUser( ) """ diff --git a/equinix_metal/test/test_authentication_api.py b/equinix_metal/test/test_authentication_api.py index ad180a3f..6b27a42b 100644 --- a/equinix_metal/test/test_authentication_api.py +++ b/equinix_metal/test/test_authentication_api.py @@ -15,59 +15,57 @@ import unittest -import equinix_metal -from equinix_metal.api.authentication_api import AuthenticationApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.authentication_api import AuthenticationApi class TestAuthenticationApi(unittest.TestCase): """AuthenticationApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.authentication_api.AuthenticationApi() # noqa: E501 + def setUp(self) -> None: + self.api = AuthenticationApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_create_api_key(self): + def test_create_api_key(self) -> None: """Test case for create_api_key - Create an API key # noqa: E501 + Create an API key """ pass - def test_create_project_api_key(self): + def test_create_project_api_key(self) -> None: """Test case for create_project_api_key - Create an API key for a project. # noqa: E501 + Create an API key for a project. """ pass - def test_delete_api_key(self): + def test_delete_api_key(self) -> None: """Test case for delete_api_key - Delete the API key # noqa: E501 + Delete the API key """ pass - def test_delete_user_api_key(self): + def test_delete_user_api_key(self) -> None: """Test case for delete_user_api_key - Delete the API key # noqa: E501 + Delete the API key """ pass - def test_find_api_keys(self): + def test_find_api_keys(self) -> None: """Test case for find_api_keys - Retrieve all user API keys # noqa: E501 + Retrieve all user API keys """ pass - def test_find_project_api_keys(self): + def test_find_project_api_keys(self) -> None: """Test case for find_project_api_keys - Retrieve all API keys for the project. # noqa: E501 + Retrieve all API keys for the project. """ pass diff --git a/equinix_metal/test/test_aws_fabric_provider.py b/equinix_metal/test/test_aws_fabric_provider.py index 85ce5f0f..563391ad 100644 --- a/equinix_metal/test/test_aws_fabric_provider.py +++ b/equinix_metal/test/test_aws_fabric_provider.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.aws_fabric_provider import AWSFabricProvider # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.aws_fabric_provider import AWSFabricProvider class TestAWSFabricProvider(unittest.TestCase): """AWSFabricProvider unit test stubs""" @@ -29,22 +26,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> AWSFabricProvider: """Test AWSFabricProvider include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `AWSFabricProvider` """ - model = equinix_metal.models.aws_fabric_provider.AWSFabricProvider() # noqa: E501 - if include_optional : + model = AWSFabricProvider() + if include_optional: return AWSFabricProvider( - account_id = '129312', - href = '', - location = 'us-west-1', + account_id = '129312', + href = '', + location = 'us-west-1', type = 'CSP_AWS' ) - else : + else: return AWSFabricProvider( account_id = '129312', type = 'CSP_AWS', diff --git a/equinix_metal/test/test_batch.py b/equinix_metal/test/test_batch.py index fdb6c225..6118178e 100644 --- a/equinix_metal/test/test_batch.py +++ b/equinix_metal/test/test_batch.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.batch import Batch # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.batch import Batch class TestBatch(unittest.TestCase): """Batch unit test stubs""" @@ -29,33 +26,33 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Batch: """Test Batch include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Batch` """ - model = equinix_metal.models.batch.Batch() # noqa: E501 - if include_optional : + model = Batch() + if include_optional: return Batch( - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), devices = [ equinix_metal.models.href.Href( href = '', ) - ], + ], error_messages = [ '' - ], - href = '', - id = '', + ], + href = '', + id = '', project = equinix_metal.models.href.Href( - href = '', ), - quantity = 56, - state = '', + href = '', ), + quantity = 56, + state = '', updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f') ) - else : + else: return Batch( ) """ diff --git a/equinix_metal/test/test_batches_api.py b/equinix_metal/test/test_batches_api.py index f3ed1628..73cb4098 100644 --- a/equinix_metal/test/test_batches_api.py +++ b/equinix_metal/test/test_batches_api.py @@ -15,45 +15,43 @@ import unittest -import equinix_metal -from equinix_metal.api.batches_api import BatchesApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.batches_api import BatchesApi class TestBatchesApi(unittest.TestCase): """BatchesApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.batches_api.BatchesApi() # noqa: E501 + def setUp(self) -> None: + self.api = BatchesApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_create_device_batch(self): + def test_create_device_batch(self) -> None: """Test case for create_device_batch - Create a devices batch # noqa: E501 + Create a devices batch """ pass - def test_delete_batch(self): + def test_delete_batch(self) -> None: """Test case for delete_batch - Delete the Batch # noqa: E501 + Delete the Batch """ pass - def test_find_batch_by_id(self): + def test_find_batch_by_id(self) -> None: """Test case for find_batch_by_id - Retrieve a Batch # noqa: E501 + Retrieve a Batch """ pass - def test_find_batches_by_project(self): + def test_find_batches_by_project(self) -> None: """Test case for find_batches_by_project - Retrieve all batches by project # noqa: E501 + Retrieve all batches by project """ pass diff --git a/equinix_metal/test/test_batches_list.py b/equinix_metal/test/test_batches_list.py index 2d8242c9..4f681611 100644 --- a/equinix_metal/test/test_batches_list.py +++ b/equinix_metal/test/test_batches_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.batches_list import BatchesList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.batches_list import BatchesList class TestBatchesList(unittest.TestCase): """BatchesList unit test stubs""" @@ -29,15 +26,15 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> BatchesList: """Test BatchesList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `BatchesList` """ - model = equinix_metal.models.batches_list.BatchesList() # noqa: E501 - if include_optional : + model = BatchesList() + if include_optional: return BatchesList( batches = [ equinix_metal.models.batch.Batch( @@ -56,10 +53,10 @@ def make_instance(self, include_optional): quantity = 56, state = '', updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), ) - ], + ], href = '' ) - else : + else: return BatchesList( ) """ diff --git a/equinix_metal/test/test_bgp_api.py b/equinix_metal/test/test_bgp_api.py index 0af8a9f4..b3a0d541 100644 --- a/equinix_metal/test/test_bgp_api.py +++ b/equinix_metal/test/test_bgp_api.py @@ -15,66 +15,64 @@ import unittest -import equinix_metal -from equinix_metal.api.bgp_api import BGPApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.bgp_api import BGPApi class TestBGPApi(unittest.TestCase): """BGPApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.bgp_api.BGPApi() # noqa: E501 + def setUp(self) -> None: + self.api = BGPApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_delete_bgp_session(self): + def test_delete_bgp_session(self) -> None: """Test case for delete_bgp_session - Delete the BGP session # noqa: E501 + Delete the BGP session """ pass - def test_find_bgp_config_by_project(self): + def test_find_bgp_config_by_project(self) -> None: """Test case for find_bgp_config_by_project - Retrieve a bgp config # noqa: E501 + Retrieve a bgp config """ pass - def test_find_bgp_session_by_id(self): + def test_find_bgp_session_by_id(self) -> None: """Test case for find_bgp_session_by_id - Retrieve a BGP session # noqa: E501 + Retrieve a BGP session """ pass - def test_find_global_bgp_ranges(self): + def test_find_global_bgp_ranges(self) -> None: """Test case for find_global_bgp_ranges - Retrieve all global bgp ranges # noqa: E501 + Retrieve all global bgp ranges """ pass - def test_find_project_bgp_sessions(self): + def test_find_project_bgp_sessions(self) -> None: """Test case for find_project_bgp_sessions - Retrieve all BGP sessions for project # noqa: E501 + Retrieve all BGP sessions for project """ pass - def test_request_bgp_config(self): + def test_request_bgp_config(self) -> None: """Test case for request_bgp_config - Requesting bgp config # noqa: E501 + Requesting bgp config """ pass - def test_update_bgp_session(self): + def test_update_bgp_session(self) -> None: """Test case for update_bgp_session - Update the BGP session # noqa: E501 + Update the BGP session """ pass diff --git a/equinix_metal/test/test_bgp_config.py b/equinix_metal/test/test_bgp_config.py index f74a8fed..5461720d 100644 --- a/equinix_metal/test/test_bgp_config.py +++ b/equinix_metal/test/test_bgp_config.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.bgp_config import BgpConfig # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.bgp_config import BgpConfig class TestBgpConfig(unittest.TestCase): """BgpConfig unit test stubs""" @@ -29,25 +26,25 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> BgpConfig: """Test BgpConfig include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `BgpConfig` """ - model = equinix_metal.models.bgp_config.BgpConfig() # noqa: E501 - if include_optional : + model = BgpConfig() + if include_optional: return BgpConfig( - asn = 65000, - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - deployment_type = 'local', - href = '', - id = '', - max_prefix = 56, - md5 = '', + asn = 65000, + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + deployment_type = 'local', + href = '', + id = '', + max_prefix = 56, + md5 = '', project = equinix_metal.models.href.Href( - href = '', ), + href = '', ), ranges = [ equinix_metal.models.global_bgp_range.GlobalBgpRange( address_family = 56, @@ -56,9 +53,9 @@ def make_instance(self, include_optional): project = equinix_metal.models.href.Href( href = '', ), range = '', ) - ], - requested_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - route_object = '', + ], + requested_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + route_object = '', sessions = [ equinix_metal.models.bgp_session.BgpSession( address_family = 'ipv4', @@ -73,10 +70,10 @@ def make_instance(self, include_optional): ], status = 'up,down', updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), ) - ], + ], status = 'requested' ) - else : + else: return BgpConfig( ) """ diff --git a/equinix_metal/test/test_bgp_config_request_input.py b/equinix_metal/test/test_bgp_config_request_input.py index 3e688cc3..3206540c 100644 --- a/equinix_metal/test/test_bgp_config_request_input.py +++ b/equinix_metal/test/test_bgp_config_request_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.bgp_config_request_input import BgpConfigRequestInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.bgp_config_request_input import BgpConfigRequestInput class TestBgpConfigRequestInput(unittest.TestCase): """BgpConfigRequestInput unit test stubs""" @@ -29,23 +26,23 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> BgpConfigRequestInput: """Test BgpConfigRequestInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `BgpConfigRequestInput` """ - model = equinix_metal.models.bgp_config_request_input.BgpConfigRequestInput() # noqa: E501 - if include_optional : + model = BgpConfigRequestInput() + if include_optional: return BgpConfigRequestInput( - asn = 65000, - deployment_type = 'local', - href = '', - md5 = 'jUR,rZ#UM/?R,Fp^l6$ARjeJk C>i H'qT\\{i H'qT\\{ BgpDynamicNeighbor: """Test BgpDynamicNeighbor include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `BgpDynamicNeighbor` """ - model = equinix_metal.models.bgp_dynamic_neighbor.BgpDynamicNeighbor() # noqa: E501 - if include_optional : + model = BgpDynamicNeighbor() + if include_optional: return BgpDynamicNeighbor( - bgp_neighbor_asn = 12345, - bgp_neighbor_range = '192.168.1.0/25', - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + bgp_neighbor_asn = 12345, + bgp_neighbor_range = '192.168.1.0/25', + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), created_by = equinix_metal.models.user_limited.UserLimited( avatar_thumb_url = '', avatar_url = '', full_name = '', href = '', - id = '', ), - href = '/bgp-dynamic-neighbors/aea82f16-57ec-412c-9523-b7f2b27635b2', - id = 'aea82f16-57ec-412c-9523-b7f2b27635b2', + id = '', ), + href = '/bgp-dynamic-neighbors/aea82f16-57ec-412c-9523-b7f2b27635b2', + id = 'aea82f16-57ec-412c-9523-b7f2b27635b2', metal_gateway = equinix_metal.models.vrf_metal_gateway.VrfMetalGateway( created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), created_by = equinix_metal.models.href.Href( @@ -209,14 +206,14 @@ def make_instance(self, include_optional): ], metro_code = '', vxlan = 56, ), - vrf = , ), - state = 'active', + vrf = , ), + state = 'active', tags = [ '' - ], + ], updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f') ) - else : + else: return BgpDynamicNeighbor( ) """ diff --git a/equinix_metal/test/test_bgp_dynamic_neighbor_create_input.py b/equinix_metal/test/test_bgp_dynamic_neighbor_create_input.py index 103565d3..7b9224a3 100644 --- a/equinix_metal/test/test_bgp_dynamic_neighbor_create_input.py +++ b/equinix_metal/test/test_bgp_dynamic_neighbor_create_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.bgp_dynamic_neighbor_create_input import BgpDynamicNeighborCreateInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.bgp_dynamic_neighbor_create_input import BgpDynamicNeighborCreateInput class TestBgpDynamicNeighborCreateInput(unittest.TestCase): """BgpDynamicNeighborCreateInput unit test stubs""" @@ -29,24 +26,24 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> BgpDynamicNeighborCreateInput: """Test BgpDynamicNeighborCreateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `BgpDynamicNeighborCreateInput` """ - model = equinix_metal.models.bgp_dynamic_neighbor_create_input.BgpDynamicNeighborCreateInput() # noqa: E501 - if include_optional : + model = BgpDynamicNeighborCreateInput() + if include_optional: return BgpDynamicNeighborCreateInput( - bgp_neighbor_asn = 12345, - bgp_neighbor_range = '192.168.1.0/25', - href = '', + bgp_neighbor_asn = 12345, + bgp_neighbor_range = '192.168.1.0/25', + href = '', tags = [ '' ] ) - else : + else: return BgpDynamicNeighborCreateInput( bgp_neighbor_asn = 12345, bgp_neighbor_range = '192.168.1.0/25', diff --git a/equinix_metal/test/test_bgp_dynamic_neighbor_list.py b/equinix_metal/test/test_bgp_dynamic_neighbor_list.py index 915e0cec..64689ddc 100644 --- a/equinix_metal/test/test_bgp_dynamic_neighbor_list.py +++ b/equinix_metal/test/test_bgp_dynamic_neighbor_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.bgp_dynamic_neighbor_list import BgpDynamicNeighborList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.bgp_dynamic_neighbor_list import BgpDynamicNeighborList class TestBgpDynamicNeighborList(unittest.TestCase): """BgpDynamicNeighborList unit test stubs""" @@ -29,15 +26,15 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> BgpDynamicNeighborList: """Test BgpDynamicNeighborList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `BgpDynamicNeighborList` """ - model = equinix_metal.models.bgp_dynamic_neighbor_list.BgpDynamicNeighborList() # noqa: E501 - if include_optional : + model = BgpDynamicNeighborList() + if include_optional: return BgpDynamicNeighborList( bgp_dynamic_neighbors = [ equinix_metal.models.bgp_dynamic_neighbor.BgpDynamicNeighbor( @@ -206,8 +203,8 @@ def make_instance(self, include_optional): state = 'active', tags = , updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), ) - ], - href = '', + ], + href = '', meta = equinix_metal.models.meta.Meta( current_page = 56, first = equinix_metal.models.href.Href( @@ -221,7 +218,7 @@ def make_instance(self, include_optional): self = , total = 56, ) ) - else : + else: return BgpDynamicNeighborList( ) """ diff --git a/equinix_metal/test/test_bgp_neighbor_data.py b/equinix_metal/test/test_bgp_neighbor_data.py index 964ea0d3..cfa0b116 100644 --- a/equinix_metal/test/test_bgp_neighbor_data.py +++ b/equinix_metal/test/test_bgp_neighbor_data.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.bgp_neighbor_data import BgpNeighborData # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.bgp_neighbor_data import BgpNeighborData class TestBgpNeighborData(unittest.TestCase): """BgpNeighborData unit test stubs""" @@ -29,29 +26,29 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> BgpNeighborData: """Test BgpNeighborData include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `BgpNeighborData` """ - model = equinix_metal.models.bgp_neighbor_data.BgpNeighborData() # noqa: E501 - if include_optional : + model = BgpNeighborData() + if include_optional: return BgpNeighborData( - address_family = 4, - customer_as = 65000, - customer_ip = '10.32.16.1 (IPv4) or 2604:1380:4111:2700::1 (IPv6)', - href = '', - md5_enabled = True, - md5_password = '', - multihop = True, - peer_as = 65530, - peer_ips = ["169.254.255.1","169.254.255.2"], - routes_in = [{"exact":true,"route":"10.32.16.0/31"}], + address_family = 4, + customer_as = 65000, + customer_ip = '10.32.16.1 (IPv4) or 2604:1380:4111:2700::1 (IPv6)', + href = '', + md5_enabled = True, + md5_password = '', + multihop = True, + peer_as = 65530, + peer_ips = ["169.254.255.1","169.254.255.2"], + routes_in = [{"exact":true,"route":"10.32.16.0/31"}], routes_out = [{"exact":true,"route":"0.0.0.0/0"}] ) - else : + else: return BgpNeighborData( ) """ diff --git a/equinix_metal/test/test_bgp_route.py b/equinix_metal/test/test_bgp_route.py index cfdda898..ef276be0 100644 --- a/equinix_metal/test/test_bgp_route.py +++ b/equinix_metal/test/test_bgp_route.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.bgp_route import BgpRoute # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.bgp_route import BgpRoute class TestBgpRoute(unittest.TestCase): """BgpRoute unit test stubs""" @@ -29,21 +26,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> BgpRoute: """Test BgpRoute include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `BgpRoute` """ - model = equinix_metal.models.bgp_route.BgpRoute() # noqa: E501 - if include_optional : + model = BgpRoute() + if include_optional: return BgpRoute( - exact = True, - href = '', + exact = True, + href = '', route = '10.32.16.0/31' ) - else : + else: return BgpRoute( ) """ diff --git a/equinix_metal/test/test_bgp_session.py b/equinix_metal/test/test_bgp_session.py index 210dc764..a2db68ef 100644 --- a/equinix_metal/test/test_bgp_session.py +++ b/equinix_metal/test/test_bgp_session.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.bgp_session import BgpSession # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.bgp_session import BgpSession class TestBgpSession(unittest.TestCase): """BgpSession unit test stubs""" @@ -29,30 +26,30 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> BgpSession: """Test BgpSession include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `BgpSession` """ - model = equinix_metal.models.bgp_session.BgpSession() # noqa: E501 - if include_optional : + model = BgpSession() + if include_optional: return BgpSession( - address_family = 'ipv4', - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - default_route = True, + address_family = 'ipv4', + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + default_route = True, device = equinix_metal.models.href.Href( - href = '', ), - href = '', - id = '', + href = '', ), + href = '', + id = '', learned_routes = [ '10.32.16.0/31' - ], - status = 'up,down', + ], + status = 'up,down', updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f') ) - else : + else: return BgpSession( address_family = 'ipv4', ) diff --git a/equinix_metal/test/test_bgp_session_input.py b/equinix_metal/test/test_bgp_session_input.py index 5b5e0bfb..5c9f1f4d 100644 --- a/equinix_metal/test/test_bgp_session_input.py +++ b/equinix_metal/test/test_bgp_session_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.bgp_session_input import BGPSessionInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.bgp_session_input import BGPSessionInput class TestBGPSessionInput(unittest.TestCase): """BGPSessionInput unit test stubs""" @@ -29,21 +26,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> BGPSessionInput: """Test BGPSessionInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `BGPSessionInput` """ - model = equinix_metal.models.bgp_session_input.BGPSessionInput() # noqa: E501 - if include_optional : + model = BGPSessionInput() + if include_optional: return BGPSessionInput( - address_family = 'ipv4', - default_route = True, + address_family = 'ipv4', + default_route = True, href = '' ) - else : + else: return BGPSessionInput( ) """ diff --git a/equinix_metal/test/test_bgp_session_list.py b/equinix_metal/test/test_bgp_session_list.py index 1c9b5e18..8c0c42a9 100644 --- a/equinix_metal/test/test_bgp_session_list.py +++ b/equinix_metal/test/test_bgp_session_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.bgp_session_list import BgpSessionList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.bgp_session_list import BgpSessionList class TestBgpSessionList(unittest.TestCase): """BgpSessionList unit test stubs""" @@ -29,15 +26,15 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> BgpSessionList: """Test BgpSessionList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `BgpSessionList` """ - model = equinix_metal.models.bgp_session_list.BgpSessionList() # noqa: E501 - if include_optional : + model = BgpSessionList() + if include_optional: return BgpSessionList( bgp_sessions = [ equinix_metal.models.bgp_session.BgpSession( @@ -53,10 +50,10 @@ def make_instance(self, include_optional): ], status = 'up,down', updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), ) - ], + ], href = '' ) - else : + else: return BgpSessionList( ) """ diff --git a/equinix_metal/test/test_bgp_session_neighbors.py b/equinix_metal/test/test_bgp_session_neighbors.py index bd3b0ef3..f5eb049e 100644 --- a/equinix_metal/test/test_bgp_session_neighbors.py +++ b/equinix_metal/test/test_bgp_session_neighbors.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.bgp_session_neighbors import BgpSessionNeighbors # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.bgp_session_neighbors import BgpSessionNeighbors class TestBgpSessionNeighbors(unittest.TestCase): """BgpSessionNeighbors unit test stubs""" @@ -29,15 +26,15 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> BgpSessionNeighbors: """Test BgpSessionNeighbors include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `BgpSessionNeighbors` """ - model = equinix_metal.models.bgp_session_neighbors.BgpSessionNeighbors() # noqa: E501 - if include_optional : + model = BgpSessionNeighbors() + if include_optional: return BgpSessionNeighbors( bgp_neighbors = [ equinix_metal.models.bgp_neighbor_data.BgpNeighborData( @@ -52,10 +49,10 @@ def make_instance(self, include_optional): peer_ips = ["169.254.255.1","169.254.255.2"], routes_in = [{"exact":true,"route":"10.32.16.0/31"}], routes_out = [{"exact":true,"route":"0.0.0.0/0"}], ) - ], + ], href = '' ) - else : + else: return BgpSessionNeighbors( ) """ diff --git a/equinix_metal/test/test_bond_port_data.py b/equinix_metal/test/test_bond_port_data.py index 8bbfd2d8..52ffd6ea 100644 --- a/equinix_metal/test/test_bond_port_data.py +++ b/equinix_metal/test/test_bond_port_data.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.bond_port_data import BondPortData # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.bond_port_data import BondPortData class TestBondPortData(unittest.TestCase): """BondPortData unit test stubs""" @@ -29,21 +26,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> BondPortData: """Test BondPortData include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `BondPortData` """ - model = equinix_metal.models.bond_port_data.BondPortData() # noqa: E501 - if include_optional : + model = BondPortData() + if include_optional: return BondPortData( - href = '', - id = '', + href = '', + id = '', name = '' ) - else : + else: return BondPortData( ) """ diff --git a/equinix_metal/test/test_capacity_api.py b/equinix_metal/test/test_capacity_api.py index 8b85f43f..6a5c004a 100644 --- a/equinix_metal/test/test_capacity_api.py +++ b/equinix_metal/test/test_capacity_api.py @@ -15,59 +15,57 @@ import unittest -import equinix_metal -from equinix_metal.api.capacity_api import CapacityApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.capacity_api import CapacityApi class TestCapacityApi(unittest.TestCase): """CapacityApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.capacity_api.CapacityApi() # noqa: E501 + def setUp(self) -> None: + self.api = CapacityApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_check_capacity_for_facility(self): + def test_check_capacity_for_facility(self) -> None: """Test case for check_capacity_for_facility - Check capacity # noqa: E501 + Check capacity """ pass - def test_check_capacity_for_metro(self): + def test_check_capacity_for_metro(self) -> None: """Test case for check_capacity_for_metro - Check capacity for a metro # noqa: E501 + Check capacity for a metro """ pass - def test_find_capacity_for_facility(self): + def test_find_capacity_for_facility(self) -> None: """Test case for find_capacity_for_facility - View capacity # noqa: E501 + View capacity """ pass - def test_find_capacity_for_metro(self): + def test_find_capacity_for_metro(self) -> None: """Test case for find_capacity_for_metro - View capacity for metros # noqa: E501 + View capacity for metros """ pass - def test_find_organization_capacity_per_facility(self): + def test_find_organization_capacity_per_facility(self) -> None: """Test case for find_organization_capacity_per_facility - View available hardware plans per Facility for given organization # noqa: E501 + View available hardware plans per Facility for given organization """ pass - def test_find_organization_capacity_per_metro(self): + def test_find_organization_capacity_per_metro(self) -> None: """Test case for find_organization_capacity_per_metro - View available hardware plans per Metro for given organization # noqa: E501 + View available hardware plans per Metro for given organization """ pass diff --git a/equinix_metal/test/test_capacity_check_per_facility_info.py b/equinix_metal/test/test_capacity_check_per_facility_info.py index 0ec3a050..c30e73d5 100644 --- a/equinix_metal/test/test_capacity_check_per_facility_info.py +++ b/equinix_metal/test/test_capacity_check_per_facility_info.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.capacity_check_per_facility_info import CapacityCheckPerFacilityInfo # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.capacity_check_per_facility_info import CapacityCheckPerFacilityInfo class TestCapacityCheckPerFacilityInfo(unittest.TestCase): """CapacityCheckPerFacilityInfo unit test stubs""" @@ -29,23 +26,23 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> CapacityCheckPerFacilityInfo: """Test CapacityCheckPerFacilityInfo include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `CapacityCheckPerFacilityInfo` """ - model = equinix_metal.models.capacity_check_per_facility_info.CapacityCheckPerFacilityInfo() # noqa: E501 - if include_optional : + model = CapacityCheckPerFacilityInfo() + if include_optional: return CapacityCheckPerFacilityInfo( - available = True, - facility = '', - href = '', - plan = '', + available = True, + facility = '', + href = '', + plan = '', quantity = '' ) - else : + else: return CapacityCheckPerFacilityInfo( ) """ diff --git a/equinix_metal/test/test_capacity_check_per_facility_list.py b/equinix_metal/test/test_capacity_check_per_facility_list.py index 6d582e9e..7de53840 100644 --- a/equinix_metal/test/test_capacity_check_per_facility_list.py +++ b/equinix_metal/test/test_capacity_check_per_facility_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.capacity_check_per_facility_list import CapacityCheckPerFacilityList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.capacity_check_per_facility_list import CapacityCheckPerFacilityList class TestCapacityCheckPerFacilityList(unittest.TestCase): """CapacityCheckPerFacilityList unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> CapacityCheckPerFacilityList: """Test CapacityCheckPerFacilityList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `CapacityCheckPerFacilityList` """ - model = equinix_metal.models.capacity_check_per_facility_list.CapacityCheckPerFacilityList() # noqa: E501 - if include_optional : + model = CapacityCheckPerFacilityList() + if include_optional: return CapacityCheckPerFacilityList( - href = '', + href = '', servers = [ equinix_metal.models.capacity_check_per_facility_info.CapacityCheckPerFacilityInfo( available = True, @@ -49,7 +46,7 @@ def make_instance(self, include_optional): quantity = '', ) ] ) - else : + else: return CapacityCheckPerFacilityList( ) """ diff --git a/equinix_metal/test/test_capacity_check_per_metro_info.py b/equinix_metal/test/test_capacity_check_per_metro_info.py index 5c5aef30..611157d2 100644 --- a/equinix_metal/test/test_capacity_check_per_metro_info.py +++ b/equinix_metal/test/test_capacity_check_per_metro_info.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.capacity_check_per_metro_info import CapacityCheckPerMetroInfo # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.capacity_check_per_metro_info import CapacityCheckPerMetroInfo class TestCapacityCheckPerMetroInfo(unittest.TestCase): """CapacityCheckPerMetroInfo unit test stubs""" @@ -29,23 +26,23 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> CapacityCheckPerMetroInfo: """Test CapacityCheckPerMetroInfo include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `CapacityCheckPerMetroInfo` """ - model = equinix_metal.models.capacity_check_per_metro_info.CapacityCheckPerMetroInfo() # noqa: E501 - if include_optional : + model = CapacityCheckPerMetroInfo() + if include_optional: return CapacityCheckPerMetroInfo( - available = True, - href = '', - metro = '', - plan = '', + available = True, + href = '', + metro = '', + plan = '', quantity = '' ) - else : + else: return CapacityCheckPerMetroInfo( ) """ diff --git a/equinix_metal/test/test_capacity_check_per_metro_list.py b/equinix_metal/test/test_capacity_check_per_metro_list.py index 07244f51..0be4d940 100644 --- a/equinix_metal/test/test_capacity_check_per_metro_list.py +++ b/equinix_metal/test/test_capacity_check_per_metro_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.capacity_check_per_metro_list import CapacityCheckPerMetroList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.capacity_check_per_metro_list import CapacityCheckPerMetroList class TestCapacityCheckPerMetroList(unittest.TestCase): """CapacityCheckPerMetroList unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> CapacityCheckPerMetroList: """Test CapacityCheckPerMetroList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `CapacityCheckPerMetroList` """ - model = equinix_metal.models.capacity_check_per_metro_list.CapacityCheckPerMetroList() # noqa: E501 - if include_optional : + model = CapacityCheckPerMetroList() + if include_optional: return CapacityCheckPerMetroList( - href = '', + href = '', servers = [ equinix_metal.models.capacity_check_per_metro_info.CapacityCheckPerMetroInfo( available = True, @@ -49,7 +46,7 @@ def make_instance(self, include_optional): quantity = '', ) ] ) - else : + else: return CapacityCheckPerMetroList( ) """ diff --git a/equinix_metal/test/test_capacity_input.py b/equinix_metal/test/test_capacity_input.py index f9849d53..02d983a0 100644 --- a/equinix_metal/test/test_capacity_input.py +++ b/equinix_metal/test/test_capacity_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.capacity_input import CapacityInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.capacity_input import CapacityInput class TestCapacityInput(unittest.TestCase): """CapacityInput unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> CapacityInput: """Test CapacityInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `CapacityInput` """ - model = equinix_metal.models.capacity_input.CapacityInput() # noqa: E501 - if include_optional : + model = CapacityInput() + if include_optional: return CapacityInput( - href = '', + href = '', servers = [ equinix_metal.models.server_info.ServerInfo( facility = '', @@ -49,7 +46,7 @@ def make_instance(self, include_optional): quantity = '', ) ] ) - else : + else: return CapacityInput( ) """ diff --git a/equinix_metal/test/test_capacity_level_per_baremetal.py b/equinix_metal/test/test_capacity_level_per_baremetal.py index 0a75cfea..644c031e 100644 --- a/equinix_metal/test/test_capacity_level_per_baremetal.py +++ b/equinix_metal/test/test_capacity_level_per_baremetal.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.capacity_level_per_baremetal import CapacityLevelPerBaremetal # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.capacity_level_per_baremetal import CapacityLevelPerBaremetal class TestCapacityLevelPerBaremetal(unittest.TestCase): """CapacityLevelPerBaremetal unit test stubs""" @@ -29,20 +26,20 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> CapacityLevelPerBaremetal: """Test CapacityLevelPerBaremetal include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `CapacityLevelPerBaremetal` """ - model = equinix_metal.models.capacity_level_per_baremetal.CapacityLevelPerBaremetal() # noqa: E501 - if include_optional : + model = CapacityLevelPerBaremetal() + if include_optional: return CapacityLevelPerBaremetal( - href = '', + href = '', level = '' ) - else : + else: return CapacityLevelPerBaremetal( ) """ diff --git a/equinix_metal/test/test_capacity_list.py b/equinix_metal/test/test_capacity_list.py index 8ba73ff8..ae69308a 100644 --- a/equinix_metal/test/test_capacity_list.py +++ b/equinix_metal/test/test_capacity_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.capacity_list import CapacityList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.capacity_list import CapacityList class TestCapacityList(unittest.TestCase): """CapacityList unit test stubs""" @@ -29,15 +26,15 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> CapacityList: """Test CapacityList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `CapacityList` """ - model = equinix_metal.models.capacity_list.CapacityList() # noqa: E501 - if include_optional : + model = CapacityList() + if include_optional: return CapacityList( capacity = { 'key' : { @@ -45,10 +42,10 @@ def make_instance(self, include_optional): href = '', level = '', ) } - }, + }, href = '' ) - else : + else: return CapacityList( ) """ diff --git a/equinix_metal/test/test_component.py b/equinix_metal/test/test_component.py index 33232ca3..e7c1289e 100644 --- a/equinix_metal/test/test_component.py +++ b/equinix_metal/test/test_component.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.component import Component # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.component import Component class TestComponent(unittest.TestCase): """Component unit test stubs""" @@ -29,32 +26,32 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Component: """Test Component include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Component` """ - model = equinix_metal.models.component.Component() # noqa: E501 - if include_optional : + model = Component() + if include_optional: return Component( - checksum = '', - component = 'bmc', - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - filename = '', - href = '', + checksum = '', + component = 'bmc', + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + filename = '', + href = '', model = [ 'romed8hm3' - ], - repository_url = '', - updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - upstream_url = '', - uuid = '0516463a-47ee-4809-9a66-ece8c740eed9', - vendor = 'equinix', + ], + repository_url = '', + updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + upstream_url = '', + uuid = '0516463a-47ee-4809-9a66-ece8c740eed9', + vendor = 'equinix', version = '1.5.0' ) - else : + else: return Component( ) """ diff --git a/equinix_metal/test/test_console_log_details_api.py b/equinix_metal/test/test_console_log_details_api.py index 4436c13a..84cb225f 100644 --- a/equinix_metal/test/test_console_log_details_api.py +++ b/equinix_metal/test/test_console_log_details_api.py @@ -15,21 +15,19 @@ import unittest -import equinix_metal -from equinix_metal.api.console_log_details_api import ConsoleLogDetailsApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.console_log_details_api import ConsoleLogDetailsApi class TestConsoleLogDetailsApi(unittest.TestCase): """ConsoleLogDetailsApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.console_log_details_api.ConsoleLogDetailsApi() # noqa: E501 + def setUp(self) -> None: + self.api = ConsoleLogDetailsApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_capture_screenshot(self): + def test_capture_screenshot(self) -> None: """Test case for capture_screenshot """ diff --git a/equinix_metal/test/test_coordinates.py b/equinix_metal/test/test_coordinates.py index 2a5942ad..fc7e6505 100644 --- a/equinix_metal/test/test_coordinates.py +++ b/equinix_metal/test/test_coordinates.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.coordinates import Coordinates # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.coordinates import Coordinates class TestCoordinates(unittest.TestCase): """Coordinates unit test stubs""" @@ -29,21 +26,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Coordinates: """Test Coordinates include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Coordinates` """ - model = equinix_metal.models.coordinates.Coordinates() # noqa: E501 - if include_optional : + model = Coordinates() + if include_optional: return Coordinates( - href = '', - latitude = '', + href = '', + latitude = '', longitude = '' ) - else : + else: return Coordinates( ) """ diff --git a/equinix_metal/test/test_create_device_request.py b/equinix_metal/test/test_create_device_request.py index 53d324b8..941b53e0 100644 --- a/equinix_metal/test/test_create_device_request.py +++ b/equinix_metal/test/test_create_device_request.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.create_device_request import CreateDeviceRequest # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.create_device_request import CreateDeviceRequest class TestCreateDeviceRequest(unittest.TestCase): """CreateDeviceRequest unit test stubs""" @@ -29,27 +26,27 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> CreateDeviceRequest: """Test CreateDeviceRequest include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `CreateDeviceRequest` """ - model = equinix_metal.models.create_device_request.CreateDeviceRequest() # noqa: E501 - if include_optional : + model = CreateDeviceRequest() + if include_optional: return CreateDeviceRequest( - href = '', - metro = 'sv', - always_pxe = True, - billing_cycle = 'hourly', - customdata = { }, - description = '', + href = '', + metro = 'sv', + always_pxe = True, + billing_cycle = 'hourly', + customdata = { }, + description = '', features = [ '' - ], - hardware_reservation_id = 'next-available', - hostname = '', + ], + hardware_reservation_id = 'next-available', + hostname = '', ip_addresses = [ equinix_metal.models.ip_address.IPAddress( address_family = 4, @@ -59,20 +56,20 @@ def make_instance(self, include_optional): '' ], public = False, ) - ], - ipxe_script_url = '', - locked = True, - network_frozen = True, - no_ssh_keys = True, - operating_system = '', - plan = 'c3.large.x86', - private_ipv4_subnet_size = 56, + ], + ipxe_script_url = '', + locked = True, + network_frozen = True, + no_ssh_keys = True, + operating_system = '', + plan = 'c3.large.x86', + private_ipv4_subnet_size = 56, project_ssh_keys = [ '' - ], - public_ipv4_subnet_size = 56, - spot_instance = True, - spot_price_max = 1.23, + ], + public_ipv4_subnet_size = 56, + spot_instance = True, + spot_price_max = 1.23, ssh_keys = [ equinix_metal.models.ssh_key_input.SSHKeyInput( href = '', @@ -81,7 +78,7 @@ def make_instance(self, include_optional): tags = [ '' ], ) - ], + ], storage = equinix_metal.models.storage.Storage( disks = [ equinix_metal.models.disk.Disk( @@ -117,18 +114,18 @@ def make_instance(self, include_optional): href = '', level = '', name = '', ) - ], ), + ], ), tags = [ '' - ], - termination_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + ], + termination_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), user_ssh_keys = [ '' - ], - userdata = '', + ], + userdata = '', facility = None ) - else : + else: return CreateDeviceRequest( metro = 'sv', operating_system = '', diff --git a/equinix_metal/test/test_create_email_input.py b/equinix_metal/test/test_create_email_input.py index 6f376afb..3556952c 100644 --- a/equinix_metal/test/test_create_email_input.py +++ b/equinix_metal/test/test_create_email_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.create_email_input import CreateEmailInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.create_email_input import CreateEmailInput class TestCreateEmailInput(unittest.TestCase): """CreateEmailInput unit test stubs""" @@ -29,20 +26,20 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> CreateEmailInput: """Test CreateEmailInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `CreateEmailInput` """ - model = equinix_metal.models.create_email_input.CreateEmailInput() # noqa: E501 - if include_optional : + model = CreateEmailInput() + if include_optional: return CreateEmailInput( - address = '', + address = '', href = '' ) - else : + else: return CreateEmailInput( address = '', ) diff --git a/equinix_metal/test/test_create_metal_gateway_request.py b/equinix_metal/test/test_create_metal_gateway_request.py index d728c3eb..2260a12e 100644 --- a/equinix_metal/test/test_create_metal_gateway_request.py +++ b/equinix_metal/test/test_create_metal_gateway_request.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.create_metal_gateway_request import CreateMetalGatewayRequest # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.create_metal_gateway_request import CreateMetalGatewayRequest class TestCreateMetalGatewayRequest(unittest.TestCase): """CreateMetalGatewayRequest unit test stubs""" @@ -29,22 +26,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> CreateMetalGatewayRequest: """Test CreateMetalGatewayRequest include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `CreateMetalGatewayRequest` """ - model = equinix_metal.models.create_metal_gateway_request.CreateMetalGatewayRequest() # noqa: E501 - if include_optional : + model = CreateMetalGatewayRequest() + if include_optional: return CreateMetalGatewayRequest( - href = '', - ip_reservation_id = '', - private_ipv4_subnet_size = 56, + href = '', + ip_reservation_id = '', + private_ipv4_subnet_size = 56, virtual_network_id = '' ) - else : + else: return CreateMetalGatewayRequest( ip_reservation_id = '', virtual_network_id = '', diff --git a/equinix_metal/test/test_create_organization_interconnection_request.py b/equinix_metal/test/test_create_organization_interconnection_request.py index 3f9d9bba..216f1c1d 100644 --- a/equinix_metal/test/test_create_organization_interconnection_request.py +++ b/equinix_metal/test/test_create_organization_interconnection_request.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.create_organization_interconnection_request import CreateOrganizationInterconnectionRequest # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.create_organization_interconnection_request import CreateOrganizationInterconnectionRequest class TestCreateOrganizationInterconnectionRequest(unittest.TestCase): """CreateOrganizationInterconnectionRequest unit test stubs""" @@ -29,39 +26,39 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> CreateOrganizationInterconnectionRequest: """Test CreateOrganizationInterconnectionRequest include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `CreateOrganizationInterconnectionRequest` """ - model = equinix_metal.models.create_organization_interconnection_request.CreateOrganizationInterconnectionRequest() # noqa: E501 - if include_optional : + model = CreateOrganizationInterconnectionRequest() + if include_optional: return CreateOrganizationInterconnectionRequest( - billing_account_name = '', - contact_email = '', - description = '', - href = '', - metro = '', - mode = 'standard', - name = '', - project = '', - redundancy = '', - speed = '10000000000', + billing_account_name = '', + contact_email = '', + description = '', + href = '', + metro = '', + mode = 'standard', + name = '', + project = '', + redundancy = '', + speed = '10000000000', tags = [ '' - ], - type = 'dedicated', - use_case = '', - service_token_type = 'a_side', - vlans = [1000,1001], + ], + type = 'dedicated', + use_case = '', + service_token_type = 'a_side', + vlans = [1000, 1001], vrfs = [ '' - ], + ], fabric_provider = None ) - else : + else: return CreateOrganizationInterconnectionRequest( metro = '', name = '', @@ -69,7 +66,7 @@ def make_instance(self, include_optional): redundancy = '', type = 'dedicated', service_token_type = 'a_side', - vlans = [1000,1001], + vlans = [1000, 1001], vrfs = [ '' ], diff --git a/equinix_metal/test/test_create_self_service_reservation_request.py b/equinix_metal/test/test_create_self_service_reservation_request.py index cb0ff467..76066ad6 100644 --- a/equinix_metal/test/test_create_self_service_reservation_request.py +++ b/equinix_metal/test/test_create_self_service_reservation_request.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.create_self_service_reservation_request import CreateSelfServiceReservationRequest # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.create_self_service_reservation_request import CreateSelfServiceReservationRequest class TestCreateSelfServiceReservationRequest(unittest.TestCase): """CreateSelfServiceReservationRequest unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> CreateSelfServiceReservationRequest: """Test CreateSelfServiceReservationRequest include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `CreateSelfServiceReservationRequest` """ - model = equinix_metal.models.create_self_service_reservation_request.CreateSelfServiceReservationRequest() # noqa: E501 - if include_optional : + model = CreateSelfServiceReservationRequest() + if include_optional: return CreateSelfServiceReservationRequest( - href = '', + href = '', item = [ equinix_metal.models.self_service_reservation_item_request.SelfServiceReservationItemRequest( amount = 1.337, @@ -48,15 +45,15 @@ def make_instance(self, include_optional): plan_id = '', quantity = 56, term = '', ) - ], - notes = '', + ], + notes = '', period = equinix_metal.models.create_self_service_reservation_request_period.CreateSelfServiceReservationRequest_period( count = 12, href = '', - unit = 'monthly', ), + unit = 'monthly', ), start_date = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f') ) - else : + else: return CreateSelfServiceReservationRequest( ) """ diff --git a/equinix_metal/test/test_create_self_service_reservation_request_period.py b/equinix_metal/test/test_create_self_service_reservation_request_period.py index 32fbd905..959a61ef 100644 --- a/equinix_metal/test/test_create_self_service_reservation_request_period.py +++ b/equinix_metal/test/test_create_self_service_reservation_request_period.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.create_self_service_reservation_request_period import CreateSelfServiceReservationRequestPeriod # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.create_self_service_reservation_request_period import CreateSelfServiceReservationRequestPeriod class TestCreateSelfServiceReservationRequestPeriod(unittest.TestCase): """CreateSelfServiceReservationRequestPeriod unit test stubs""" @@ -29,21 +26,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> CreateSelfServiceReservationRequestPeriod: """Test CreateSelfServiceReservationRequestPeriod include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `CreateSelfServiceReservationRequestPeriod` """ - model = equinix_metal.models.create_self_service_reservation_request_period.CreateSelfServiceReservationRequestPeriod() # noqa: E501 - if include_optional : + model = CreateSelfServiceReservationRequestPeriod() + if include_optional: return CreateSelfServiceReservationRequestPeriod( - count = 12, - href = '', + count = 12, + href = '', unit = 'monthly' ) - else : + else: return CreateSelfServiceReservationRequestPeriod( ) """ diff --git a/equinix_metal/test/test_dedicated_port_create_input.py b/equinix_metal/test/test_dedicated_port_create_input.py index c11b1795..7a5867b1 100644 --- a/equinix_metal/test/test_dedicated_port_create_input.py +++ b/equinix_metal/test/test_dedicated_port_create_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.dedicated_port_create_input import DedicatedPortCreateInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.dedicated_port_create_input import DedicatedPortCreateInput class TestDedicatedPortCreateInput(unittest.TestCase): """DedicatedPortCreateInput unit test stubs""" @@ -29,33 +26,33 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> DedicatedPortCreateInput: """Test DedicatedPortCreateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `DedicatedPortCreateInput` """ - model = equinix_metal.models.dedicated_port_create_input.DedicatedPortCreateInput() # noqa: E501 - if include_optional : + model = DedicatedPortCreateInput() + if include_optional: return DedicatedPortCreateInput( - billing_account_name = '', - contact_email = '', - description = '', - href = '', - metro = '', - mode = 'standard', - name = '', - project = '', - redundancy = '', - speed = '10000000000', + billing_account_name = '', + contact_email = '', + description = '', + href = '', + metro = '', + mode = 'standard', + name = '', + project = '', + redundancy = '', + speed = '10000000000', tags = [ '' - ], - type = 'dedicated', + ], + type = 'dedicated', use_case = '' ) - else : + else: return DedicatedPortCreateInput( metro = '', name = '', diff --git a/equinix_metal/test/test_device.py b/equinix_metal/test/test_device.py index 98d6d2d4..9065e26b 100644 --- a/equinix_metal/test/test_device.py +++ b/equinix_metal/test/test_device.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.device import Device # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.device import Device class TestDevice(unittest.TestCase): """Device unit test stubs""" @@ -29,29 +26,29 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Device: """Test Device include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Device` """ - model = equinix_metal.models.device.Device() # noqa: E501 - if include_optional : + model = Device() + if include_optional: return Device( actions = [ equinix_metal.models.device_actions_inner.Device_actions_inner( href = '', name = '', type = '', ) - ], - always_pxe = True, - billing_cycle = '', - bonding_mode = 56, - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - created_by = None, - customdata = { }, - description = '', + ], + always_pxe = True, + billing_cycle = '', + bonding_mode = 56, + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + created_by = None, + customdata = { }, + description = '', facility = equinix_metal.models.facility.Facility( address = equinix_metal.models.address.Address( address2 = '', @@ -70,8 +67,8 @@ def make_instance(self, include_optional): id = '', ip_ranges = ["2604:1380::/36","147.75.192.0/21"], metro = null, - name = '', ), - firmware_set_id = '', + name = '', ), + firmware_set_id = '', hardware_reservation = equinix_metal.models.hardware_reservation.HardwareReservation( created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), custom_rate = 1050.5, @@ -406,11 +403,11 @@ class = 'm3.large.x86', short_id = '', spare = True, switch_uuid = '', - termination_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), ), - hostname = '', - href = '', - id = '', - image_url = '', + termination_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), ), + hostname = '', + href = '', + id = '', + image_url = '', ip_addresses = [ equinix_metal.models.ip_assignment.IPAssignment( address = '', @@ -437,12 +434,12 @@ class = 'm3.large.x86', network = '', ), public = True, state = 'pending', ) - ], - ipxe_script_url = '', - iqn = '', - locked = True, - metro = None, - network_frozen = True, + ], + ipxe_script_url = '', + iqn = '', + locked = True, + metro = None, + network_frozen = True, network_ports = [ equinix_metal.models.port.Port( bond = equinix_metal.models.bond_port_data.BondPortData( @@ -490,7 +487,7 @@ class = 'm3.large.x86', virtual_networks = [ ], ) - ], + ], operating_system = equinix_metal.models.operating_system.OperatingSystem( default_operating_system = True, distro = '', @@ -505,7 +502,7 @@ class = 'm3.large.x86', '' ], slug = '', - version = '', ), + version = '', ), plan = equinix_metal.models.plan.Plan( available_in = [ equinix_metal.models.plan_available_in_inner.Plan_available_in_inner( @@ -563,7 +560,7 @@ class = 'm3.large.x86', href = '', type = '', ) ], ), - type = 'standard', ), + type = 'standard', ), project = equinix_metal.models.project.Project( backend_transfer_enabled = True, bgp_config = equinix_metal.models.href.Href( @@ -600,8 +597,8 @@ class = 'm3.large.x86', updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), volumes = [ - ], ), - project_lite = None, + ], ), + project_lite = None, provisioning_events = [ equinix_metal.models.event.Event( body = '', @@ -617,18 +614,18 @@ class = 'm3.large.x86', ], state = '', type = '', ) - ], - provisioning_percentage = 1.337, - root_password = '', - short_id = '', - sos = '', - spot_instance = True, - spot_price_max = 1.337, + ], + provisioning_percentage = 1.337, + root_password = '', + short_id = '', + sos = '', + spot_instance = True, + spot_price_max = 1.337, ssh_keys = [ equinix_metal.models.href.Href( href = '', ) - ], - state = 'queued', + ], + state = 'queued', storage = equinix_metal.models.storage.Storage( disks = [ equinix_metal.models.disk.Disk( @@ -664,21 +661,21 @@ class = 'm3.large.x86', href = '', level = '', name = '', ) - ], ), - switch_uuid = '', + ], ), + switch_uuid = '', tags = [ '' - ], - termination_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - user = '', - userdata = '', + ], + termination_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + user = '', + userdata = '', volumes = [ equinix_metal.models.href.Href( href = '', ) ] ) - else : + else: return Device( ) """ diff --git a/equinix_metal/test/test_device_action_input.py b/equinix_metal/test/test_device_action_input.py index 0ab82f0c..169de197 100644 --- a/equinix_metal/test/test_device_action_input.py +++ b/equinix_metal/test/test_device_action_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.device_action_input import DeviceActionInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.device_action_input import DeviceActionInput class TestDeviceActionInput(unittest.TestCase): """DeviceActionInput unit test stubs""" @@ -29,25 +26,25 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> DeviceActionInput: """Test DeviceActionInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `DeviceActionInput` """ - model = equinix_metal.models.device_action_input.DeviceActionInput() # noqa: E501 - if include_optional : + model = DeviceActionInput() + if include_optional: return DeviceActionInput( - deprovision_fast = True, - force_delete = True, - href = '', - ipxe_script_url = '', - operating_system = 'ubuntu_22_04', - preserve_data = True, + deprovision_fast = True, + force_delete = True, + href = '', + ipxe_script_url = '', + operating_system = 'ubuntu_22_04', + preserve_data = True, type = 'power_on' ) - else : + else: return DeviceActionInput( type = 'power_on', ) diff --git a/equinix_metal/test/test_device_actions_inner.py b/equinix_metal/test/test_device_actions_inner.py index 6dc4dd9a..7e87a40e 100644 --- a/equinix_metal/test/test_device_actions_inner.py +++ b/equinix_metal/test/test_device_actions_inner.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.device_actions_inner import DeviceActionsInner # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.device_actions_inner import DeviceActionsInner class TestDeviceActionsInner(unittest.TestCase): """DeviceActionsInner unit test stubs""" @@ -29,21 +26,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> DeviceActionsInner: """Test DeviceActionsInner include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `DeviceActionsInner` """ - model = equinix_metal.models.device_actions_inner.DeviceActionsInner() # noqa: E501 - if include_optional : + model = DeviceActionsInner() + if include_optional: return DeviceActionsInner( - href = '', - name = '', + href = '', + name = '', type = '' ) - else : + else: return DeviceActionsInner( ) """ diff --git a/equinix_metal/test/test_device_create_in_facility_input.py b/equinix_metal/test/test_device_create_in_facility_input.py index 3991a90f..c9381f58 100644 --- a/equinix_metal/test/test_device_create_in_facility_input.py +++ b/equinix_metal/test/test_device_create_in_facility_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.device_create_in_facility_input import DeviceCreateInFacilityInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.device_create_in_facility_input import DeviceCreateInFacilityInput class TestDeviceCreateInFacilityInput(unittest.TestCase): """DeviceCreateInFacilityInput unit test stubs""" @@ -29,27 +26,27 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> DeviceCreateInFacilityInput: """Test DeviceCreateInFacilityInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `DeviceCreateInFacilityInput` """ - model = equinix_metal.models.device_create_in_facility_input.DeviceCreateInFacilityInput() # noqa: E501 - if include_optional : + model = DeviceCreateInFacilityInput() + if include_optional: return DeviceCreateInFacilityInput( - facility = None, - href = '', - always_pxe = True, - billing_cycle = 'hourly', - customdata = { }, - description = '', + facility = None, + href = '', + always_pxe = True, + billing_cycle = 'hourly', + customdata = { }, + description = '', features = [ '' - ], - hardware_reservation_id = 'next-available', - hostname = '', + ], + hardware_reservation_id = 'next-available', + hostname = '', ip_addresses = [ equinix_metal.models.ip_address.IPAddress( address_family = 4, @@ -59,20 +56,20 @@ def make_instance(self, include_optional): '' ], public = False, ) - ], - ipxe_script_url = '', - locked = True, - network_frozen = True, - no_ssh_keys = True, - operating_system = '', - plan = 'c3.large.x86', - private_ipv4_subnet_size = 56, + ], + ipxe_script_url = '', + locked = True, + network_frozen = True, + no_ssh_keys = True, + operating_system = '', + plan = 'c3.large.x86', + private_ipv4_subnet_size = 56, project_ssh_keys = [ '' - ], - public_ipv4_subnet_size = 56, - spot_instance = True, - spot_price_max = 1.23, + ], + public_ipv4_subnet_size = 56, + spot_instance = True, + spot_price_max = 1.23, ssh_keys = [ equinix_metal.models.ssh_key_input.SSHKeyInput( href = '', @@ -81,7 +78,7 @@ def make_instance(self, include_optional): tags = [ '' ], ) - ], + ], storage = equinix_metal.models.storage.Storage( disks = [ equinix_metal.models.disk.Disk( @@ -117,17 +114,17 @@ def make_instance(self, include_optional): href = '', level = '', name = '', ) - ], ), + ], ), tags = [ '' - ], - termination_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + ], + termination_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), user_ssh_keys = [ '' - ], + ], userdata = '' ) - else : + else: return DeviceCreateInFacilityInput( facility = None, operating_system = '', diff --git a/equinix_metal/test/test_device_create_in_metro_input.py b/equinix_metal/test/test_device_create_in_metro_input.py index 76ab9189..7cd2c607 100644 --- a/equinix_metal/test/test_device_create_in_metro_input.py +++ b/equinix_metal/test/test_device_create_in_metro_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.device_create_in_metro_input import DeviceCreateInMetroInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.device_create_in_metro_input import DeviceCreateInMetroInput class TestDeviceCreateInMetroInput(unittest.TestCase): """DeviceCreateInMetroInput unit test stubs""" @@ -29,27 +26,27 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> DeviceCreateInMetroInput: """Test DeviceCreateInMetroInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `DeviceCreateInMetroInput` """ - model = equinix_metal.models.device_create_in_metro_input.DeviceCreateInMetroInput() # noqa: E501 - if include_optional : + model = DeviceCreateInMetroInput() + if include_optional: return DeviceCreateInMetroInput( - href = '', - metro = 'sv', - always_pxe = True, - billing_cycle = 'hourly', - customdata = { }, - description = '', + href = '', + metro = 'sv', + always_pxe = True, + billing_cycle = 'hourly', + customdata = { }, + description = '', features = [ '' - ], - hardware_reservation_id = 'next-available', - hostname = '', + ], + hardware_reservation_id = 'next-available', + hostname = '', ip_addresses = [ equinix_metal.models.ip_address.IPAddress( address_family = 4, @@ -59,20 +56,20 @@ def make_instance(self, include_optional): '' ], public = False, ) - ], - ipxe_script_url = '', - locked = True, - network_frozen = True, - no_ssh_keys = True, - operating_system = '', - plan = 'c3.large.x86', - private_ipv4_subnet_size = 56, + ], + ipxe_script_url = '', + locked = True, + network_frozen = True, + no_ssh_keys = True, + operating_system = '', + plan = 'c3.large.x86', + private_ipv4_subnet_size = 56, project_ssh_keys = [ '' - ], - public_ipv4_subnet_size = 56, - spot_instance = True, - spot_price_max = 1.23, + ], + public_ipv4_subnet_size = 56, + spot_instance = True, + spot_price_max = 1.23, ssh_keys = [ equinix_metal.models.ssh_key_input.SSHKeyInput( href = '', @@ -81,7 +78,7 @@ def make_instance(self, include_optional): tags = [ '' ], ) - ], + ], storage = equinix_metal.models.storage.Storage( disks = [ equinix_metal.models.disk.Disk( @@ -117,17 +114,17 @@ def make_instance(self, include_optional): href = '', level = '', name = '', ) - ], ), + ], ), tags = [ '' - ], - termination_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + ], + termination_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), user_ssh_keys = [ '' - ], + ], userdata = '' ) - else : + else: return DeviceCreateInMetroInput( metro = 'sv', operating_system = '', diff --git a/equinix_metal/test/test_device_create_input.py b/equinix_metal/test/test_device_create_input.py index 22ebe053..894bb4ec 100644 --- a/equinix_metal/test/test_device_create_input.py +++ b/equinix_metal/test/test_device_create_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.device_create_input import DeviceCreateInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.device_create_input import DeviceCreateInput class TestDeviceCreateInput(unittest.TestCase): """DeviceCreateInput unit test stubs""" @@ -29,26 +26,26 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> DeviceCreateInput: """Test DeviceCreateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `DeviceCreateInput` """ - model = equinix_metal.models.device_create_input.DeviceCreateInput() # noqa: E501 - if include_optional : + model = DeviceCreateInput() + if include_optional: return DeviceCreateInput( - always_pxe = True, - billing_cycle = 'hourly', - customdata = { }, - description = '', + always_pxe = True, + billing_cycle = 'hourly', + customdata = { }, + description = '', features = [ '' - ], - hardware_reservation_id = 'next-available', - hostname = '', - href = '', + ], + hardware_reservation_id = 'next-available', + hostname = '', + href = '', ip_addresses = [ equinix_metal.models.ip_address.IPAddress( address_family = 4, @@ -58,20 +55,20 @@ def make_instance(self, include_optional): '' ], public = False, ) - ], - ipxe_script_url = '', - locked = True, - network_frozen = True, - no_ssh_keys = True, - operating_system = '', - plan = 'c3.large.x86', - private_ipv4_subnet_size = 56, + ], + ipxe_script_url = '', + locked = True, + network_frozen = True, + no_ssh_keys = True, + operating_system = '', + plan = 'c3.large.x86', + private_ipv4_subnet_size = 56, project_ssh_keys = [ '' - ], - public_ipv4_subnet_size = 56, - spot_instance = True, - spot_price_max = 1.23, + ], + public_ipv4_subnet_size = 56, + spot_instance = True, + spot_price_max = 1.23, ssh_keys = [ equinix_metal.models.ssh_key_input.SSHKeyInput( href = '', @@ -80,7 +77,7 @@ def make_instance(self, include_optional): tags = [ '' ], ) - ], + ], storage = equinix_metal.models.storage.Storage( disks = [ equinix_metal.models.disk.Disk( @@ -116,17 +113,17 @@ def make_instance(self, include_optional): href = '', level = '', name = '', ) - ], ), + ], ), tags = [ '' - ], - termination_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + ], + termination_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), user_ssh_keys = [ '' - ], + ], userdata = '' ) - else : + else: return DeviceCreateInput( operating_system = '', plan = 'c3.large.x86', diff --git a/equinix_metal/test/test_device_created_by.py b/equinix_metal/test/test_device_created_by.py index acaf5fa7..398586ac 100644 --- a/equinix_metal/test/test_device_created_by.py +++ b/equinix_metal/test/test_device_created_by.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.device_created_by import DeviceCreatedBy # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.device_created_by import DeviceCreatedBy class TestDeviceCreatedBy(unittest.TestCase): """DeviceCreatedBy unit test stubs""" @@ -29,28 +26,28 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> DeviceCreatedBy: """Test DeviceCreatedBy include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `DeviceCreatedBy` """ - model = equinix_metal.models.device_created_by.DeviceCreatedBy() # noqa: E501 - if include_optional : + model = DeviceCreatedBy() + if include_optional: return DeviceCreatedBy( - avatar_thumb_url = '', - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - email = '', - first_name = '', - full_name = '', - href = '', - id = '', - last_name = '', - short_id = '', + avatar_thumb_url = '', + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + email = '', + first_name = '', + full_name = '', + href = '', + id = '', + last_name = '', + short_id = '', updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f') ) - else : + else: return DeviceCreatedBy( id = '', short_id = '', diff --git a/equinix_metal/test/test_device_health_rollup.py b/equinix_metal/test/test_device_health_rollup.py index af932657..ce867baf 100644 --- a/equinix_metal/test/test_device_health_rollup.py +++ b/equinix_metal/test/test_device_health_rollup.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.device_health_rollup import DeviceHealthRollup # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.device_health_rollup import DeviceHealthRollup class TestDeviceHealthRollup(unittest.TestCase): """DeviceHealthRollup unit test stubs""" @@ -29,21 +26,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> DeviceHealthRollup: """Test DeviceHealthRollup include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `DeviceHealthRollup` """ - model = equinix_metal.models.device_health_rollup.DeviceHealthRollup() # noqa: E501 - if include_optional : + model = DeviceHealthRollup() + if include_optional: return DeviceHealthRollup( - health_rollup = 'ok', - href = '', + health_rollup = 'ok', + href = '', updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f') ) - else : + else: return DeviceHealthRollup( ) """ diff --git a/equinix_metal/test/test_device_list.py b/equinix_metal/test/test_device_list.py index 2d275f8a..0e68031e 100644 --- a/equinix_metal/test/test_device_list.py +++ b/equinix_metal/test/test_device_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.device_list import DeviceList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.device_list import DeviceList class TestDeviceList(unittest.TestCase): """DeviceList unit test stubs""" @@ -29,15 +26,15 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> DeviceList: """Test DeviceList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `DeviceList` """ - model = equinix_metal.models.device_list.DeviceList() # noqa: E501 - if include_optional : + model = DeviceList() + if include_optional: return DeviceList( devices = [ equinix_metal.models.device.Device( @@ -443,8 +440,8 @@ class = 'm3.large.x86', user = '', userdata = '', volumes = , ) - ], - href = '', + ], + href = '', meta = equinix_metal.models.meta.Meta( current_page = 56, first = equinix_metal.models.href.Href( @@ -458,7 +455,7 @@ class = 'm3.large.x86', self = , total = 56, ) ) - else : + else: return DeviceList( ) """ diff --git a/equinix_metal/test/test_device_metro.py b/equinix_metal/test/test_device_metro.py index 83671378..ede4d248 100644 --- a/equinix_metal/test/test_device_metro.py +++ b/equinix_metal/test/test_device_metro.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.device_metro import DeviceMetro # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.device_metro import DeviceMetro class TestDeviceMetro(unittest.TestCase): """DeviceMetro unit test stubs""" @@ -29,23 +26,23 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> DeviceMetro: """Test DeviceMetro include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `DeviceMetro` """ - model = equinix_metal.models.device_metro.DeviceMetro() # noqa: E501 - if include_optional : + model = DeviceMetro() + if include_optional: return DeviceMetro( - code = '', - country = '', - href = '', - id = '', + code = '', + country = '', + href = '', + id = '', name = '' ) - else : + else: return DeviceMetro( ) """ diff --git a/equinix_metal/test/test_device_project_lite.py b/equinix_metal/test/test_device_project_lite.py index 9709c857..84c06382 100644 --- a/equinix_metal/test/test_device_project_lite.py +++ b/equinix_metal/test/test_device_project_lite.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.device_project_lite import DeviceProjectLite # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.device_project_lite import DeviceProjectLite class TestDeviceProjectLite(unittest.TestCase): """DeviceProjectLite unit test stubs""" @@ -29,19 +26,19 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> DeviceProjectLite: """Test DeviceProjectLite include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `DeviceProjectLite` """ - model = equinix_metal.models.device_project_lite.DeviceProjectLite() # noqa: E501 - if include_optional : + model = DeviceProjectLite() + if include_optional: return DeviceProjectLite( href = '' ) - else : + else: return DeviceProjectLite( href = '', ) diff --git a/equinix_metal/test/test_device_update_input.py b/equinix_metal/test/test_device_update_input.py index 8214ccf7..6253f1f0 100644 --- a/equinix_metal/test/test_device_update_input.py +++ b/equinix_metal/test/test_device_update_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.device_update_input import DeviceUpdateInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.device_update_input import DeviceUpdateInput class TestDeviceUpdateInput(unittest.TestCase): """DeviceUpdateInput unit test stubs""" @@ -29,33 +26,33 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> DeviceUpdateInput: """Test DeviceUpdateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `DeviceUpdateInput` """ - model = equinix_metal.models.device_update_input.DeviceUpdateInput() # noqa: E501 - if include_optional : + model = DeviceUpdateInput() + if include_optional: return DeviceUpdateInput( - always_pxe = True, - billing_cycle = '', - customdata = { }, - description = '', - firmware_set_id = '', - hostname = '', - href = '', - ipxe_script_url = '', - locked = True, - network_frozen = True, - spot_instance = True, + always_pxe = True, + billing_cycle = '', + customdata = { }, + description = '', + firmware_set_id = '', + hostname = '', + href = '', + ipxe_script_url = '', + locked = True, + network_frozen = True, + spot_instance = True, tags = [ '' - ], + ], userdata = '' ) - else : + else: return DeviceUpdateInput( ) """ diff --git a/equinix_metal/test/test_device_usage.py b/equinix_metal/test/test_device_usage.py index aa8b0bfc..0842dbc4 100644 --- a/equinix_metal/test/test_device_usage.py +++ b/equinix_metal/test/test_device_usage.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.device_usage import DeviceUsage # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.device_usage import DeviceUsage class TestDeviceUsage(unittest.TestCase): """DeviceUsage unit test stubs""" @@ -29,22 +26,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> DeviceUsage: """Test DeviceUsage include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `DeviceUsage` """ - model = equinix_metal.models.device_usage.DeviceUsage() # noqa: E501 - if include_optional : + model = DeviceUsage() + if include_optional: return DeviceUsage( - href = '', - quantity = '', - total = '', + href = '', + quantity = '', + total = '', unit = '' ) - else : + else: return DeviceUsage( ) """ diff --git a/equinix_metal/test/test_device_usage_list.py b/equinix_metal/test/test_device_usage_list.py index 8f6a9af8..7a03e680 100644 --- a/equinix_metal/test/test_device_usage_list.py +++ b/equinix_metal/test/test_device_usage_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.device_usage_list import DeviceUsageList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.device_usage_list import DeviceUsageList class TestDeviceUsageList(unittest.TestCase): """DeviceUsageList unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> DeviceUsageList: """Test DeviceUsageList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `DeviceUsageList` """ - model = equinix_metal.models.device_usage_list.DeviceUsageList() # noqa: E501 - if include_optional : + model = DeviceUsageList() + if include_optional: return DeviceUsageList( - href = '', + href = '', usages = [ equinix_metal.models.device_usage.DeviceUsage( href = '', @@ -48,7 +45,7 @@ def make_instance(self, include_optional): unit = '', ) ] ) - else : + else: return DeviceUsageList( ) """ diff --git a/equinix_metal/test/test_devices_api.py b/equinix_metal/test/test_devices_api.py index 46b18fd8..103fe4b2 100644 --- a/equinix_metal/test/test_devices_api.py +++ b/equinix_metal/test/test_devices_api.py @@ -15,108 +15,106 @@ import unittest -import equinix_metal -from equinix_metal.api.devices_api import DevicesApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.devices_api import DevicesApi class TestDevicesApi(unittest.TestCase): """DevicesApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.devices_api.DevicesApi() # noqa: E501 + def setUp(self) -> None: + self.api = DevicesApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_create_bgp_session(self): + def test_create_bgp_session(self) -> None: """Test case for create_bgp_session - Create a BGP session # noqa: E501 + Create a BGP session """ pass - def test_create_device(self): + def test_create_device(self) -> None: """Test case for create_device - Create a device # noqa: E501 + Create a device """ pass - def test_create_ip_assignment(self): + def test_create_ip_assignment(self) -> None: """Test case for create_ip_assignment - Create an ip assignment # noqa: E501 + Create an ip assignment """ pass - def test_delete_device(self): + def test_delete_device(self) -> None: """Test case for delete_device - Delete the device # noqa: E501 + Delete the device """ pass - def test_find_bgp_sessions(self): + def test_find_bgp_sessions(self) -> None: """Test case for find_bgp_sessions - Retrieve all BGP sessions # noqa: E501 + Retrieve all BGP sessions """ pass - def test_find_device_by_id(self): + def test_find_device_by_id(self) -> None: """Test case for find_device_by_id - Retrieve a device # noqa: E501 + Retrieve a device """ pass - def test_find_device_customdata(self): + def test_find_device_customdata(self) -> None: """Test case for find_device_customdata - Retrieve the custom metadata of an instance # noqa: E501 + Retrieve the custom metadata of an instance """ pass - def test_find_device_metadata_by_id(self): + def test_find_device_metadata_by_id(self) -> None: """Test case for find_device_metadata_by_id - Retrieve metadata # noqa: E501 + Retrieve metadata """ pass - def test_find_device_userdata_by_id(self): + def test_find_device_userdata_by_id(self) -> None: """Test case for find_device_userdata_by_id - Retrieve userdata # noqa: E501 + Retrieve userdata """ pass - def test_find_instance_bandwidth(self): + def test_find_instance_bandwidth(self) -> None: """Test case for find_instance_bandwidth - Retrieve an instance bandwidth # noqa: E501 + Retrieve an instance bandwidth """ pass - def test_find_ip_assignment_customdata(self): + def test_find_ip_assignment_customdata(self) -> None: """Test case for find_ip_assignment_customdata - Retrieve the custom metadata of an IP Assignment # noqa: E501 + Retrieve the custom metadata of an IP Assignment """ pass - def test_find_ip_assignments(self): + def test_find_ip_assignments(self) -> None: """Test case for find_ip_assignments - Retrieve all ip assignments # noqa: E501 + Retrieve all ip assignments """ pass - def test_find_organization_devices(self): + def test_find_organization_devices(self) -> None: """Test case for find_organization_devices - Retrieve all devices of an organization # noqa: E501 + Retrieve all devices of an organization """ pass @@ -127,10 +125,10 @@ def test_find_organization_devices_all_pages(self): """ pass - def test_find_project_devices(self): + def test_find_project_devices(self) -> None: """Test case for find_project_devices - Retrieve all devices of a project # noqa: E501 + Retrieve all devices of a project """ pass @@ -141,45 +139,45 @@ def test_find_project_devices_all_pages(self): """ pass - def test_find_traffic(self): + def test_find_traffic(self) -> None: """Test case for find_traffic - Retrieve device traffic # noqa: E501 + Retrieve device traffic """ pass - def test_get_bgp_neighbor_data(self): + def test_get_bgp_neighbor_data(self) -> None: """Test case for get_bgp_neighbor_data - Retrieve BGP neighbor data for this device # noqa: E501 + Retrieve BGP neighbor data for this device """ pass - def test_get_device_firmware_sets(self): + def test_get_device_firmware_sets(self) -> None: """Test case for get_device_firmware_sets - Get Device's associated Firmware Set # noqa: E501 + Get Device's associated Firmware Set """ pass - def test_get_device_health_rollup(self): + def test_get_device_health_rollup(self) -> None: """Test case for get_device_health_rollup - Get Device's Health Status # noqa: E501 + Get Device's Health Status """ pass - def test_perform_action(self): + def test_perform_action(self) -> None: """Test case for perform_action - Perform an action # noqa: E501 + Perform an action """ pass - def test_update_device(self): + def test_update_device(self) -> None: """Test case for update_device - Update the device # noqa: E501 + Update the device """ pass diff --git a/equinix_metal/test/test_disk.py b/equinix_metal/test/test_disk.py index ddbba8a1..f5c1dadb 100644 --- a/equinix_metal/test/test_disk.py +++ b/equinix_metal/test/test_disk.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.disk import Disk # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.disk import Disk class TestDisk(unittest.TestCase): """Disk unit test stubs""" @@ -29,28 +26,28 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Disk: """Test Disk include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Disk` """ - model = equinix_metal.models.disk.Disk() # noqa: E501 - if include_optional : + model = Disk() + if include_optional: return Disk( - device = '', - href = '', + device = '', + href = '', partitions = [ equinix_metal.models.partition.Partition( href = '', label = '', number = 56, size = '', ) - ], + ], wipe_table = True ) - else : + else: return Disk( ) """ diff --git a/equinix_metal/test/test_email.py b/equinix_metal/test/test_email.py index 01c8d534..5db08ce9 100644 --- a/equinix_metal/test/test_email.py +++ b/equinix_metal/test/test_email.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.email import Email # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.email import Email class TestEmail(unittest.TestCase): """Email unit test stubs""" @@ -29,23 +26,23 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Email: """Test Email include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Email` """ - model = equinix_metal.models.email.Email() # noqa: E501 - if include_optional : + model = Email() + if include_optional: return Email( - address = '', - default = True, - href = '', - id = '', + address = '', + default = True, + href = '', + id = '', verified = True ) - else : + else: return Email( ) """ diff --git a/equinix_metal/test/test_email_input.py b/equinix_metal/test/test_email_input.py index ee7788e6..ebdfdf81 100644 --- a/equinix_metal/test/test_email_input.py +++ b/equinix_metal/test/test_email_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.email_input import EmailInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.email_input import EmailInput class TestEmailInput(unittest.TestCase): """EmailInput unit test stubs""" @@ -29,21 +26,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> EmailInput: """Test EmailInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `EmailInput` """ - model = equinix_metal.models.email_input.EmailInput() # noqa: E501 - if include_optional : + model = EmailInput() + if include_optional: return EmailInput( - address = '', - default = True, + address = '', + default = True, href = '' ) - else : + else: return EmailInput( address = '', ) diff --git a/equinix_metal/test/test_emails_api.py b/equinix_metal/test/test_emails_api.py index 7a6eecde..fd0eb2bb 100644 --- a/equinix_metal/test/test_emails_api.py +++ b/equinix_metal/test/test_emails_api.py @@ -15,45 +15,43 @@ import unittest -import equinix_metal -from equinix_metal.api.emails_api import EmailsApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.emails_api import EmailsApi class TestEmailsApi(unittest.TestCase): """EmailsApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.emails_api.EmailsApi() # noqa: E501 + def setUp(self) -> None: + self.api = EmailsApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_create_email(self): + def test_create_email(self) -> None: """Test case for create_email - Create an email # noqa: E501 + Create an email """ pass - def test_delete_email(self): + def test_delete_email(self) -> None: """Test case for delete_email - Delete the email # noqa: E501 + Delete the email """ pass - def test_find_email_by_id(self): + def test_find_email_by_id(self) -> None: """Test case for find_email_by_id - Retrieve an email # noqa: E501 + Retrieve an email """ pass - def test_update_email(self): + def test_update_email(self) -> None: """Test case for update_email - Update the email # noqa: E501 + Update the email """ pass diff --git a/equinix_metal/test/test_entitlement.py b/equinix_metal/test/test_entitlement.py index 07607ee2..48ef91fd 100644 --- a/equinix_metal/test/test_entitlement.py +++ b/equinix_metal/test/test_entitlement.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.entitlement import Entitlement # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.entitlement import Entitlement class TestEntitlement(unittest.TestCase): """Entitlement unit test stubs""" @@ -29,30 +26,30 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Entitlement: """Test Entitlement include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Entitlement` """ - model = equinix_metal.models.entitlement.Entitlement() # noqa: E501 - if include_optional : + model = Entitlement() + if include_optional: return Entitlement( - description = '', - feature_access = None, - href = '', - id = '', - instance_quota = None, - ip_quota = None, - name = '', - project_quota = 56, - slug = '', - volume_limits = None, - volume_quota = None, + description = '', + feature_access = None, + href = '', + id = '', + instance_quota = None, + ip_quota = None, + name = '', + project_quota = 56, + slug = '', + volume_limits = None, + volume_quota = None, weight = 56 ) - else : + else: return Entitlement( id = '', slug = '', diff --git a/equinix_metal/test/test_error.py b/equinix_metal/test/test_error.py index 68ced86f..6f6e657e 100644 --- a/equinix_metal/test/test_error.py +++ b/equinix_metal/test/test_error.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.error import Error # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.error import Error class TestError(unittest.TestCase): """Error unit test stubs""" @@ -29,23 +26,23 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Error: """Test Error include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Error` """ - model = equinix_metal.models.error.Error() # noqa: E501 - if include_optional : + model = Error() + if include_optional: return Error( - error = '', + error = '', errors = [ '' - ], + ], href = '' ) - else : + else: return Error( ) """ diff --git a/equinix_metal/test/test_event.py b/equinix_metal/test/test_event.py index 394dc661..804b3ed4 100644 --- a/equinix_metal/test/test_event.py +++ b/equinix_metal/test/test_event.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.event import Event # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.event import Event class TestEvent(unittest.TestCase): """Event unit test stubs""" @@ -29,31 +26,31 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Event: """Test Event include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Event` """ - model = equinix_metal.models.event.Event() # noqa: E501 - if include_optional : + model = Event() + if include_optional: return Event( - body = '', - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - href = '', - id = '', - interpolated = '', - ip = '', - modified_by = equinix_metal.models.modified_by.modified_by(), + body = '', + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + href = '', + id = '', + interpolated = '', + ip = '', + modified_by = equinix_metal.models.modified_by.modified_by(), relationships = [ equinix_metal.models.href.Href( href = '', ) - ], - state = '', + ], + state = '', type = '' ) - else : + else: return Event( ) """ diff --git a/equinix_metal/test/test_event_list.py b/equinix_metal/test/test_event_list.py index 36b298ff..56c4605c 100644 --- a/equinix_metal/test/test_event_list.py +++ b/equinix_metal/test/test_event_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.event_list import EventList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.event_list import EventList class TestEventList(unittest.TestCase): """EventList unit test stubs""" @@ -29,15 +26,15 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> EventList: """Test EventList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `EventList` """ - model = equinix_metal.models.event_list.EventList() # noqa: E501 - if include_optional : + model = EventList() + if include_optional: return EventList( events = [ equinix_metal.models.event.Event( @@ -54,8 +51,8 @@ def make_instance(self, include_optional): ], state = '', type = '', ) - ], - href = '', + ], + href = '', meta = equinix_metal.models.meta.Meta( current_page = 56, first = equinix_metal.models.href.Href( @@ -69,7 +66,7 @@ def make_instance(self, include_optional): self = , total = 56, ) ) - else : + else: return EventList( ) """ diff --git a/equinix_metal/test/test_events_api.py b/equinix_metal/test/test_events_api.py index 4a24a94f..d66d1229 100644 --- a/equinix_metal/test/test_events_api.py +++ b/equinix_metal/test/test_events_api.py @@ -15,24 +15,22 @@ import unittest -import equinix_metal -from equinix_metal.api.events_api import EventsApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.events_api import EventsApi class TestEventsApi(unittest.TestCase): """EventsApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.events_api.EventsApi() # noqa: E501 + def setUp(self) -> None: + self.api = EventsApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_find_device_events(self): + def test_find_device_events(self) -> None: """Test case for find_device_events - Retrieve device's events # noqa: E501 + Retrieve device's events """ pass @@ -43,17 +41,17 @@ def test_find_device_events_all_pages(self): """ pass - def test_find_event_by_id(self): + def test_find_event_by_id(self) -> None: """Test case for find_event_by_id - Retrieve an event # noqa: E501 + Retrieve an event """ pass - def test_find_events(self): + def test_find_events(self) -> None: """Test case for find_events - Retrieve current user's events # noqa: E501 + Retrieve current user's events """ pass @@ -64,10 +62,10 @@ def test_find_events_all_pages(self): """ pass - def test_find_interconnection_events(self): + def test_find_interconnection_events(self) -> None: """Test case for find_interconnection_events - Retrieve interconnection events # noqa: E501 + Retrieve interconnection events """ pass @@ -78,17 +76,17 @@ def test_find_interconnection_events_all_pages(self): """ pass - def test_find_interconnection_port_events(self): + def test_find_interconnection_port_events(self) -> None: """Test case for find_interconnection_port_events - Retrieve interconnection port events # noqa: E501 + Retrieve interconnection port events """ pass - def test_find_organization_events(self): + def test_find_organization_events(self) -> None: """Test case for find_organization_events - Retrieve organization's events # noqa: E501 + Retrieve organization's events """ pass @@ -99,10 +97,10 @@ def test_find_organization_events_all_pages(self): """ pass - def test_find_project_events(self): + def test_find_project_events(self) -> None: """Test case for find_project_events - Retrieve project's events # noqa: E501 + Retrieve project's events """ pass @@ -113,17 +111,17 @@ def test_find_project_events_all_pages(self): """ pass - def test_find_virtual_circuit_events(self): + def test_find_virtual_circuit_events(self) -> None: """Test case for find_virtual_circuit_events - Retrieve virtual circuit events # noqa: E501 + Retrieve virtual circuit events """ pass - def test_find_vrf_route_events(self): + def test_find_vrf_route_events(self) -> None: """Test case for find_vrf_route_events - Retrieve VRF route events # noqa: E501 + Retrieve VRF route events """ pass diff --git a/equinix_metal/test/test_fabric_service_token.py b/equinix_metal/test/test_fabric_service_token.py index db3b5d3d..252d25f0 100644 --- a/equinix_metal/test/test_fabric_service_token.py +++ b/equinix_metal/test/test_fabric_service_token.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.fabric_service_token import FabricServiceToken # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.fabric_service_token import FabricServiceToken class TestFabricServiceToken(unittest.TestCase): """FabricServiceToken unit test stubs""" @@ -29,25 +26,25 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> FabricServiceToken: """Test FabricServiceToken include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `FabricServiceToken` """ - model = equinix_metal.models.fabric_service_token.FabricServiceToken() # noqa: E501 - if include_optional : + model = FabricServiceToken() + if include_optional: return FabricServiceToken( - expires_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - href = '', - id = '', - max_allowed_speed = 10000000000, - role = 'primary', - service_token_type = 'a_side', + expires_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + href = '', + id = '', + max_allowed_speed = 10000000000, + role = 'primary', + service_token_type = 'a_side', state = 'inactive' ) - else : + else: return FabricServiceToken( ) """ diff --git a/equinix_metal/test/test_facilities_api.py b/equinix_metal/test/test_facilities_api.py index 2a392e70..491ddd80 100644 --- a/equinix_metal/test/test_facilities_api.py +++ b/equinix_metal/test/test_facilities_api.py @@ -15,38 +15,36 @@ import unittest -import equinix_metal -from equinix_metal.api.facilities_api import FacilitiesApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.facilities_api import FacilitiesApi class TestFacilitiesApi(unittest.TestCase): """FacilitiesApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.facilities_api.FacilitiesApi() # noqa: E501 + def setUp(self) -> None: + self.api = FacilitiesApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_find_facilities(self): + def test_find_facilities(self) -> None: """Test case for find_facilities - Retrieve all facilities # noqa: E501 + Retrieve all facilities """ pass - def test_find_facilities_by_organization(self): + def test_find_facilities_by_organization(self) -> None: """Test case for find_facilities_by_organization - Retrieve all facilities visible by the organization # noqa: E501 + Retrieve all facilities visible by the organization """ pass - def test_find_facilities_by_project(self): + def test_find_facilities_by_project(self) -> None: """Test case for find_facilities_by_project - Retrieve all facilities visible by the project # noqa: E501 + Retrieve all facilities visible by the project """ pass diff --git a/equinix_metal/test/test_facility.py b/equinix_metal/test/test_facility.py index b31ca530..ba8d6ca4 100644 --- a/equinix_metal/test/test_facility.py +++ b/equinix_metal/test/test_facility.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.facility import Facility # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.facility import Facility class TestFacility(unittest.TestCase): """Facility unit test stubs""" @@ -29,15 +26,15 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Facility: """Test Facility include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Facility` """ - model = equinix_metal.models.facility.Facility() # noqa: E501 - if include_optional : + model = Facility() + if include_optional: return Facility( address = equinix_metal.models.address.Address( address2 = '', @@ -49,16 +46,16 @@ def make_instance(self, include_optional): country = '', href = '', state = '', - zip_code = '', ), - code = '', - features = ["baremetal","backend_transfer","global_ipv4"], - href = '', - id = '', - ip_ranges = ["2604:1380::/36","147.75.192.0/21"], - metro = None, + zip_code = '', ), + code = '', + features = ["baremetal","backend_transfer","global_ipv4"], + href = '', + id = '', + ip_ranges = ["2604:1380::/36","147.75.192.0/21"], + metro = None, name = '' ) - else : + else: return Facility( ) """ diff --git a/equinix_metal/test/test_facility_input.py b/equinix_metal/test/test_facility_input.py index 8302f26a..5064329a 100644 --- a/equinix_metal/test/test_facility_input.py +++ b/equinix_metal/test/test_facility_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.facility_input import FacilityInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.facility_input import FacilityInput class TestFacilityInput(unittest.TestCase): """FacilityInput unit test stubs""" @@ -29,20 +26,20 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> FacilityInput: """Test FacilityInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `FacilityInput` """ - model = equinix_metal.models.facility_input.FacilityInput() # noqa: E501 - if include_optional : + model = FacilityInput() + if include_optional: return FacilityInput( - facility = None, + facility = None, href = '' ) - else : + else: return FacilityInput( facility = None, ) diff --git a/equinix_metal/test/test_facility_input_facility.py b/equinix_metal/test/test_facility_input_facility.py index 8ba04cf9..947ba7f9 100644 --- a/equinix_metal/test/test_facility_input_facility.py +++ b/equinix_metal/test/test_facility_input_facility.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.facility_input_facility import FacilityInputFacility # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.facility_input_facility import FacilityInputFacility class TestFacilityInputFacility(unittest.TestCase): """FacilityInputFacility unit test stubs""" @@ -29,18 +26,18 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> FacilityInputFacility: """Test FacilityInputFacility include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `FacilityInputFacility` """ - model = equinix_metal.models.facility_input_facility.FacilityInputFacility() # noqa: E501 - if include_optional : + model = FacilityInputFacility() + if include_optional: return FacilityInputFacility( ) - else : + else: return FacilityInputFacility( ) """ diff --git a/equinix_metal/test/test_facility_list.py b/equinix_metal/test/test_facility_list.py index f6d6ba33..977c3c3c 100644 --- a/equinix_metal/test/test_facility_list.py +++ b/equinix_metal/test/test_facility_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.facility_list import FacilityList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.facility_list import FacilityList class TestFacilityList(unittest.TestCase): """FacilityList unit test stubs""" @@ -29,15 +26,15 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> FacilityList: """Test FacilityList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `FacilityList` """ - model = equinix_metal.models.facility_list.FacilityList() # noqa: E501 - if include_optional : + model = FacilityList() + if include_optional: return FacilityList( facilities = [ equinix_metal.models.facility.Facility( @@ -59,10 +56,10 @@ def make_instance(self, include_optional): ip_ranges = ["2604:1380::/36","147.75.192.0/21"], metro = null, name = '', ) - ], + ], href = '' ) - else : + else: return FacilityList( ) """ diff --git a/equinix_metal/test/test_filesystem.py b/equinix_metal/test/test_filesystem.py index b051f062..c989a350 100644 --- a/equinix_metal/test/test_filesystem.py +++ b/equinix_metal/test/test_filesystem.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.filesystem import Filesystem # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.filesystem import Filesystem class TestFilesystem(unittest.TestCase): """Filesystem unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Filesystem: """Test Filesystem include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Filesystem` """ - model = equinix_metal.models.filesystem.Filesystem() # noqa: E501 - if include_optional : + model = Filesystem() + if include_optional: return Filesystem( - href = '', + href = '', mount = equinix_metal.models.mount.Mount( device = '', format = '', @@ -49,7 +46,7 @@ def make_instance(self, include_optional): ], point = '', ) ) - else : + else: return Filesystem( ) """ diff --git a/equinix_metal/test/test_find_ip_address_by_id200_response.py b/equinix_metal/test/test_find_ip_address_by_id200_response.py index 24f1ef88..2b91baae 100644 --- a/equinix_metal/test/test_find_ip_address_by_id200_response.py +++ b/equinix_metal/test/test_find_ip_address_by_id200_response.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.find_ip_address_by_id200_response import FindIPAddressById200Response # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.find_ip_address_by_id200_response import FindIPAddressById200Response class TestFindIPAddressById200Response(unittest.TestCase): """FindIPAddressById200Response unit test stubs""" @@ -29,55 +26,55 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> FindIPAddressById200Response: """Test FindIPAddressById200Response include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `FindIPAddressById200Response` """ - model = equinix_metal.models.find_ip_address_by_id200_response.FindIPAddressById200Response() # noqa: E501 - if include_optional : + model = FindIPAddressById200Response() + if include_optional: return FindIPAddressById200Response( - address = '', - address_family = 56, + address = '', + address_family = 56, assigned_to = equinix_metal.models.href.Href( - href = '', ), - cidr = 56, - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - enabled = True, - gateway = '', - global_ip = True, - href = '', - id = '', - manageable = True, - management = True, + href = '', ), + cidr = 56, + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + enabled = True, + gateway = '', + global_ip = True, + href = '', + id = '', + manageable = True, + management = True, metro = equinix_metal.models.metro.Metro( code = '', country = '', href = '', id = '', - name = '', ), - netmask = '', - network = '', - next_hop = '', + name = '', ), + netmask = '', + network = '', + next_hop = '', parent_block = equinix_metal.models.parent_block.ParentBlock( cidr = 56, href = '', netmask = '', - network = '', ), - public = True, - state = '', - addon = True, + network = '', ), + public = True, + state = '', + addon = True, assignments = [ equinix_metal.models.href.Href( href = '', ) - ], - available = '', - bill = True, - customdata = equinix_metal.models.customdata.customdata(), - details = '', - facility = None, + ], + available = '', + bill = True, + customdata = equinix_metal.models.customdata.customdata(), + details = '', + facility = None, metal_gateway = equinix_metal.models.metal_gateway_lite.MetalGatewayLite( created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), gateway_address = '10.1.2.1/27', @@ -85,7 +82,7 @@ def make_instance(self, include_optional): id = '', state = 'ready', updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - vlan = 1001, ), + vlan = 1001, ), project = equinix_metal.models.project.Project( backend_transfer_enabled = True, bgp_config = equinix_metal.models.href.Href( @@ -122,7 +119,7 @@ def make_instance(self, include_optional): updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), volumes = [ - ], ), + ], ), project_lite = equinix_metal.models.project.Project( backend_transfer_enabled = True, bgp_config = equinix_metal.models.href.Href( @@ -159,15 +156,15 @@ def make_instance(self, include_optional): updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), volumes = [ - ], ), + ], ), requested_by = equinix_metal.models.href.Href( - href = '', ), + href = '', ), tags = [ '' - ], - type = 'global_ipv4', + ], + type = 'global_ipv4', created_by = equinix_metal.models.href.Href( - href = '', ), + href = '', ), vrf = equinix_metal.models.vrf.Vrf( bgp_dynamic_neighbors_bfd_enabled = True, bgp_dynamic_neighbors_enabled = True, @@ -286,7 +283,7 @@ def make_instance(self, include_optional): updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), ), ) ], ) ) - else : + else: return FindIPAddressById200Response( assigned_to = equinix_metal.models.href.Href( href = '', ), diff --git a/equinix_metal/test/test_find_metal_gateway_by_id200_response.py b/equinix_metal/test/test_find_metal_gateway_by_id200_response.py index 3d99dffe..bc1df7a9 100644 --- a/equinix_metal/test/test_find_metal_gateway_by_id200_response.py +++ b/equinix_metal/test/test_find_metal_gateway_by_id200_response.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.find_metal_gateway_by_id200_response import FindMetalGatewayById200Response # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.find_metal_gateway_by_id200_response import FindMetalGatewayById200Response class TestFindMetalGatewayById200Response(unittest.TestCase): """FindMetalGatewayById200Response unit test stubs""" @@ -29,21 +26,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> FindMetalGatewayById200Response: """Test FindMetalGatewayById200Response include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `FindMetalGatewayById200Response` """ - model = equinix_metal.models.find_metal_gateway_by_id200_response.FindMetalGatewayById200Response() # noqa: E501 - if include_optional : + model = FindMetalGatewayById200Response() + if include_optional: return FindMetalGatewayById200Response( - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), created_by = equinix_metal.models.href.Href( - href = '', ), - href = '', - id = '', + href = '', ), + href = '', + id = '', ip_reservation = equinix_metal.models.vrf_ip_reservation.VrfIpReservation( address = '', address_family = 56, @@ -173,7 +170,7 @@ def make_instance(self, include_optional): local_asn = 56, name = '', updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), ), ) - ], ), ), + ], ), ), project = equinix_metal.models.project.Project( backend_transfer_enabled = True, bgp_config = equinix_metal.models.href.Href( @@ -210,9 +207,9 @@ def make_instance(self, include_optional): updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), volumes = [ - ], ), - state = 'ready', - updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + ], ), + state = 'ready', + updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), virtual_network = equinix_metal.models.virtual_network.VirtualNetwork( assigned_to = equinix_metal.models.href.Href( href = '', ), @@ -240,7 +237,7 @@ def make_instance(self, include_optional): tags = [ '' ], - vxlan = 56, ), + vxlan = 56, ), vrf = equinix_metal.models.vrf.Vrf( bgp_dynamic_neighbors_bfd_enabled = True, bgp_dynamic_neighbors_enabled = True, @@ -359,7 +356,7 @@ def make_instance(self, include_optional): updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), ), ) ], ) ) - else : + else: return FindMetalGatewayById200Response( ) """ diff --git a/equinix_metal/test/test_find_traffic_timeframe_parameter.py b/equinix_metal/test/test_find_traffic_timeframe_parameter.py index 11981043..ee0b5582 100644 --- a/equinix_metal/test/test_find_traffic_timeframe_parameter.py +++ b/equinix_metal/test/test_find_traffic_timeframe_parameter.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.find_traffic_timeframe_parameter import FindTrafficTimeframeParameter # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.find_traffic_timeframe_parameter import FindTrafficTimeframeParameter class TestFindTrafficTimeframeParameter(unittest.TestCase): """FindTrafficTimeframeParameter unit test stubs""" @@ -29,21 +26,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> FindTrafficTimeframeParameter: """Test FindTrafficTimeframeParameter include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `FindTrafficTimeframeParameter` """ - model = equinix_metal.models.find_traffic_timeframe_parameter.FindTrafficTimeframeParameter() # noqa: E501 - if include_optional : + model = FindTrafficTimeframeParameter() + if include_optional: return FindTrafficTimeframeParameter( - ended_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - href = '', + ended_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + href = '', started_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f') ) - else : + else: return FindTrafficTimeframeParameter( ended_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), started_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), diff --git a/equinix_metal/test/test_firmware_set.py b/equinix_metal/test/test_firmware_set.py index 4734d127..23351663 100644 --- a/equinix_metal/test/test_firmware_set.py +++ b/equinix_metal/test/test_firmware_set.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.firmware_set import FirmwareSet # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.firmware_set import FirmwareSet class TestFirmwareSet(unittest.TestCase): """FirmwareSet unit test stubs""" @@ -29,15 +26,15 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> FirmwareSet: """Test FirmwareSet include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `FirmwareSet` """ - model = equinix_metal.models.firmware_set.FirmwareSet() # noqa: E501 - if include_optional : + model = FirmwareSet() + if include_optional: return FirmwareSet( attributes = [ equinix_metal.models.attribute.Attribute( @@ -51,7 +48,7 @@ def make_instance(self, include_optional): href = '', namespace = '', updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), ) - ], + ], component_firmware = [ equinix_metal.models.component.Component( checksum = '', @@ -68,14 +65,14 @@ def make_instance(self, include_optional): uuid = '0516463a-47ee-4809-9a66-ece8c740eed9', vendor = 'equinix', version = '1.5.0', ) - ], - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - href = '', - name = '', - updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + ], + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + href = '', + name = '', + updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), uuid = '0516463a-47ee-4809-9a66-ece8c740eed9' ) - else : + else: return FirmwareSet( name = '', uuid = '0516463a-47ee-4809-9a66-ece8c740eed9', diff --git a/equinix_metal/test/test_firmware_set_list_response.py b/equinix_metal/test/test_firmware_set_list_response.py index 1dccfa91..50dacbdf 100644 --- a/equinix_metal/test/test_firmware_set_list_response.py +++ b/equinix_metal/test/test_firmware_set_list_response.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.firmware_set_list_response import FirmwareSetListResponse # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.firmware_set_list_response import FirmwareSetListResponse class TestFirmwareSetListResponse(unittest.TestCase): """FirmwareSetListResponse unit test stubs""" @@ -29,20 +26,20 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> FirmwareSetListResponse: """Test FirmwareSetListResponse include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `FirmwareSetListResponse` """ - model = equinix_metal.models.firmware_set_list_response.FirmwareSetListResponse() # noqa: E501 - if include_optional : + model = FirmwareSetListResponse() + if include_optional: return FirmwareSetListResponse( - href = '', - page = 56, - page_count = 56, - page_size = 56, + href = '', + page = 56, + page_count = 56, + page_size = 56, records = [ equinix_metal.models.firmware_set.FirmwareSet( attributes = [ @@ -80,11 +77,11 @@ def make_instance(self, include_optional): name = '', updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), uuid = '0516463a-47ee-4809-9a66-ece8c740eed9', ) - ], - total_pages = 56, + ], + total_pages = 56, total_record_count = 56 ) - else : + else: return FirmwareSetListResponse( ) """ diff --git a/equinix_metal/test/test_firmware_set_response.py b/equinix_metal/test/test_firmware_set_response.py index a36908c9..aadb88d1 100644 --- a/equinix_metal/test/test_firmware_set_response.py +++ b/equinix_metal/test/test_firmware_set_response.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.firmware_set_response import FirmwareSetResponse # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.firmware_set_response import FirmwareSetResponse class TestFirmwareSetResponse(unittest.TestCase): """FirmwareSetResponse unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> FirmwareSetResponse: """Test FirmwareSetResponse include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `FirmwareSetResponse` """ - model = equinix_metal.models.firmware_set_response.FirmwareSetResponse() # noqa: E501 - if include_optional : + model = FirmwareSetResponse() + if include_optional: return FirmwareSetResponse( - href = '', + href = '', record = equinix_metal.models.firmware_set.FirmwareSet( attributes = [ equinix_metal.models.attribute.Attribute( @@ -77,7 +74,7 @@ def make_instance(self, include_optional): updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), uuid = '0516463a-47ee-4809-9a66-ece8c740eed9', ) ) - else : + else: return FirmwareSetResponse( ) """ diff --git a/equinix_metal/test/test_firmware_sets_api.py b/equinix_metal/test/test_firmware_sets_api.py index 6da7305e..3af0b9ae 100644 --- a/equinix_metal/test/test_firmware_sets_api.py +++ b/equinix_metal/test/test_firmware_sets_api.py @@ -15,31 +15,29 @@ import unittest -import equinix_metal -from equinix_metal.api.firmware_sets_api import FirmwareSetsApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.firmware_sets_api import FirmwareSetsApi class TestFirmwareSetsApi(unittest.TestCase): """FirmwareSetsApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.firmware_sets_api.FirmwareSetsApi() # noqa: E501 + def setUp(self) -> None: + self.api = FirmwareSetsApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_get_organization_firmware_sets(self): + def test_get_organization_firmware_sets(self) -> None: """Test case for get_organization_firmware_sets - Get Organization's Firmware Sets # noqa: E501 + Get Organization's Firmware Sets """ pass - def test_get_project_firmware_sets(self): + def test_get_project_firmware_sets(self) -> None: """Test case for get_project_firmware_sets - Get Project's Firmware Sets # noqa: E501 + Get Project's Firmware Sets """ pass diff --git a/equinix_metal/test/test_global_bgp_range.py b/equinix_metal/test/test_global_bgp_range.py index bde219d3..3268dc52 100644 --- a/equinix_metal/test/test_global_bgp_range.py +++ b/equinix_metal/test/test_global_bgp_range.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.global_bgp_range import GlobalBgpRange # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.global_bgp_range import GlobalBgpRange class TestGlobalBgpRange(unittest.TestCase): """GlobalBgpRange unit test stubs""" @@ -29,24 +26,24 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> GlobalBgpRange: """Test GlobalBgpRange include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `GlobalBgpRange` """ - model = equinix_metal.models.global_bgp_range.GlobalBgpRange() # noqa: E501 - if include_optional : + model = GlobalBgpRange() + if include_optional: return GlobalBgpRange( - address_family = 56, - href = '', - id = '', + address_family = 56, + href = '', + id = '', project = equinix_metal.models.href.Href( - href = '', ), + href = '', ), range = '' ) - else : + else: return GlobalBgpRange( ) """ diff --git a/equinix_metal/test/test_global_bgp_range_list.py b/equinix_metal/test/test_global_bgp_range_list.py index 57d2778e..8066d44e 100644 --- a/equinix_metal/test/test_global_bgp_range_list.py +++ b/equinix_metal/test/test_global_bgp_range_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.global_bgp_range_list import GlobalBgpRangeList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.global_bgp_range_list import GlobalBgpRangeList class TestGlobalBgpRangeList(unittest.TestCase): """GlobalBgpRangeList unit test stubs""" @@ -29,15 +26,15 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> GlobalBgpRangeList: """Test GlobalBgpRangeList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `GlobalBgpRangeList` """ - model = equinix_metal.models.global_bgp_range_list.GlobalBgpRangeList() # noqa: E501 - if include_optional : + model = GlobalBgpRangeList() + if include_optional: return GlobalBgpRangeList( global_bgp_ranges = [ equinix_metal.models.global_bgp_range.GlobalBgpRange( @@ -47,10 +44,10 @@ def make_instance(self, include_optional): project = equinix_metal.models.href.Href( href = '', ), range = '', ) - ], + ], href = '' ) - else : + else: return GlobalBgpRangeList( ) """ diff --git a/equinix_metal/test/test_hardware_reservation.py b/equinix_metal/test/test_hardware_reservation.py index 4aaf1d57..76b28b05 100644 --- a/equinix_metal/test/test_hardware_reservation.py +++ b/equinix_metal/test/test_hardware_reservation.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.hardware_reservation import HardwareReservation # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.hardware_reservation import HardwareReservation class TestHardwareReservation(unittest.TestCase): """HardwareReservation unit test stubs""" @@ -29,18 +26,18 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> HardwareReservation: """Test HardwareReservation include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `HardwareReservation` """ - model = equinix_metal.models.hardware_reservation.HardwareReservation() # noqa: E501 - if include_optional : + model = HardwareReservation() + if include_optional: return HardwareReservation( - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - custom_rate = 1050.5, + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + custom_rate = 1050.5, device = equinix_metal.models.device.Device( actions = [ equinix_metal.models.device_actions_inner.Device_actions_inner( @@ -356,7 +353,7 @@ class = 'm3.large.x86', userdata = '', volumes = [ - ], ), + ], ), facility = equinix_metal.models.facility.Facility( address = equinix_metal.models.address.Address( address2 = '', @@ -375,10 +372,10 @@ class = 'm3.large.x86', id = '', ip_ranges = ["2604:1380::/36","147.75.192.0/21"], metro = null, - name = '', ), - href = '', - id = '', - need_of_service = True, + name = '', ), + href = '', + id = '', + need_of_service = True, plan = equinix_metal.models.plan.Plan( available_in = [ equinix_metal.models.plan_available_in_inner.Plan_available_in_inner( @@ -436,7 +433,7 @@ class = 'm3.large.x86', href = '', type = '', ) ], ), - type = 'standard', ), + type = 'standard', ), project = equinix_metal.models.project.Project( backend_transfer_enabled = True, bgp_config = equinix_metal.models.href.Href( @@ -473,14 +470,14 @@ class = 'm3.large.x86', updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), volumes = [ - ], ), - provisionable = True, - short_id = '', - spare = True, - switch_uuid = '', + ], ), + provisionable = True, + short_id = '', + spare = True, + switch_uuid = '', termination_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f') ) - else : + else: return HardwareReservation( ) """ diff --git a/equinix_metal/test/test_hardware_reservation_list.py b/equinix_metal/test/test_hardware_reservation_list.py index 761da476..2e684b6f 100644 --- a/equinix_metal/test/test_hardware_reservation_list.py +++ b/equinix_metal/test/test_hardware_reservation_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.hardware_reservation_list import HardwareReservationList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.hardware_reservation_list import HardwareReservationList class TestHardwareReservationList(unittest.TestCase): """HardwareReservationList unit test stubs""" @@ -29,15 +26,15 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> HardwareReservationList: """Test HardwareReservationList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `HardwareReservationList` """ - model = equinix_metal.models.hardware_reservation_list.HardwareReservationList() # noqa: E501 - if include_optional : + model = HardwareReservationList() + if include_optional: return HardwareReservationList( hardware_reservations = [ equinix_metal.models.hardware_reservation.HardwareReservation( @@ -375,8 +372,8 @@ class = 'm3.large.x86', spare = True, switch_uuid = '', termination_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), ) - ], - href = '', + ], + href = '', meta = equinix_metal.models.meta.Meta( current_page = 56, first = equinix_metal.models.href.Href( @@ -390,7 +387,7 @@ class = 'm3.large.x86', self = , total = 56, ) ) - else : + else: return HardwareReservationList( ) """ diff --git a/equinix_metal/test/test_hardware_reservations_api.py b/equinix_metal/test/test_hardware_reservations_api.py index fe229711..5fc0c188 100644 --- a/equinix_metal/test/test_hardware_reservations_api.py +++ b/equinix_metal/test/test_hardware_reservations_api.py @@ -15,38 +15,36 @@ import unittest -import equinix_metal -from equinix_metal.api.hardware_reservations_api import HardwareReservationsApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.hardware_reservations_api import HardwareReservationsApi class TestHardwareReservationsApi(unittest.TestCase): """HardwareReservationsApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.hardware_reservations_api.HardwareReservationsApi() # noqa: E501 + def setUp(self) -> None: + self.api = HardwareReservationsApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_activate_hardware_reservation(self): + def test_activate_hardware_reservation(self) -> None: """Test case for activate_hardware_reservation - Activate a spare hardware reservation # noqa: E501 + Activate a spare hardware reservation """ pass - def test_find_hardware_reservation_by_id(self): + def test_find_hardware_reservation_by_id(self) -> None: """Test case for find_hardware_reservation_by_id - Retrieve a hardware reservation # noqa: E501 + Retrieve a hardware reservation """ pass - def test_find_project_hardware_reservations(self): + def test_find_project_hardware_reservations(self) -> None: """Test case for find_project_hardware_reservations - Retrieve all hardware reservations for a given project # noqa: E501 + Retrieve all hardware reservations for a given project """ pass @@ -57,10 +55,10 @@ def test_find_project_hardware_reservations_all_pages(self): """ pass - def test_move_hardware_reservation(self): + def test_move_hardware_reservation(self) -> None: """Test case for move_hardware_reservation - Move a hardware reservation # noqa: E501 + Move a hardware reservation """ pass diff --git a/equinix_metal/test/test_href.py b/equinix_metal/test/test_href.py index 027dd51b..72ccf2cc 100644 --- a/equinix_metal/test/test_href.py +++ b/equinix_metal/test/test_href.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.href import Href # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.href import Href class TestHref(unittest.TestCase): """Href unit test stubs""" @@ -29,19 +26,19 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Href: """Test Href include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Href` """ - model = equinix_metal.models.href.Href() # noqa: E501 - if include_optional : + model = Href() + if include_optional: return Href( href = '' ) - else : + else: return Href( href = '', ) diff --git a/equinix_metal/test/test_incidents_api.py b/equinix_metal/test/test_incidents_api.py index 2a4f0fa7..767a3790 100644 --- a/equinix_metal/test/test_incidents_api.py +++ b/equinix_metal/test/test_incidents_api.py @@ -15,24 +15,22 @@ import unittest -import equinix_metal -from equinix_metal.api.incidents_api import IncidentsApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.incidents_api import IncidentsApi class TestIncidentsApi(unittest.TestCase): """IncidentsApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.incidents_api.IncidentsApi() # noqa: E501 + def setUp(self) -> None: + self.api = IncidentsApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_find_incidents(self): + def test_find_incidents(self) -> None: """Test case for find_incidents - Retrieve the number of incidents # noqa: E501 + Retrieve the number of incidents """ pass diff --git a/equinix_metal/test/test_instances_batch_create_input.py b/equinix_metal/test/test_instances_batch_create_input.py index 6308d381..e33a6c36 100644 --- a/equinix_metal/test/test_instances_batch_create_input.py +++ b/equinix_metal/test/test_instances_batch_create_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.instances_batch_create_input import InstancesBatchCreateInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.instances_batch_create_input import InstancesBatchCreateInput class TestInstancesBatchCreateInput(unittest.TestCase): """InstancesBatchCreateInput unit test stubs""" @@ -29,22 +26,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> InstancesBatchCreateInput: """Test InstancesBatchCreateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `InstancesBatchCreateInput` """ - model = equinix_metal.models.instances_batch_create_input.InstancesBatchCreateInput() # noqa: E501 - if include_optional : + model = InstancesBatchCreateInput() + if include_optional: return InstancesBatchCreateInput( batches = [ null - ], + ], href = '' ) - else : + else: return InstancesBatchCreateInput( ) """ diff --git a/equinix_metal/test/test_instances_batch_create_input_batches_inner.py b/equinix_metal/test/test_instances_batch_create_input_batches_inner.py index bb3568cc..3cd5afc8 100644 --- a/equinix_metal/test/test_instances_batch_create_input_batches_inner.py +++ b/equinix_metal/test/test_instances_batch_create_input_batches_inner.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.instances_batch_create_input_batches_inner import InstancesBatchCreateInputBatchesInner # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.instances_batch_create_input_batches_inner import InstancesBatchCreateInputBatchesInner class TestInstancesBatchCreateInputBatchesInner(unittest.TestCase): """InstancesBatchCreateInputBatchesInner unit test stubs""" @@ -29,31 +26,31 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> InstancesBatchCreateInputBatchesInner: """Test InstancesBatchCreateInputBatchesInner include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `InstancesBatchCreateInputBatchesInner` """ - model = equinix_metal.models.instances_batch_create_input_batches_inner.InstancesBatchCreateInputBatchesInner() # noqa: E501 - if include_optional : + model = InstancesBatchCreateInputBatchesInner() + if include_optional: return InstancesBatchCreateInputBatchesInner( hostnames = [ '' - ], - quantity = 56, - href = '', - metro = 'sv', - always_pxe = True, - billing_cycle = 'hourly', - customdata = { }, - description = '', + ], + quantity = 56, + href = '', + metro = 'sv', + always_pxe = True, + billing_cycle = 'hourly', + customdata = { }, + description = '', features = [ '' - ], - hardware_reservation_id = 'next-available', - hostname = '', + ], + hardware_reservation_id = 'next-available', + hostname = '', ip_addresses = [ equinix_metal.models.ip_address.IPAddress( address_family = 4, @@ -63,20 +60,20 @@ def make_instance(self, include_optional): '' ], public = False, ) - ], - ipxe_script_url = '', - locked = True, - network_frozen = True, - no_ssh_keys = True, - operating_system = '', - plan = 'c3.large.x86', - private_ipv4_subnet_size = 56, + ], + ipxe_script_url = '', + locked = True, + network_frozen = True, + no_ssh_keys = True, + operating_system = '', + plan = 'c3.large.x86', + private_ipv4_subnet_size = 56, project_ssh_keys = [ '' - ], - public_ipv4_subnet_size = 56, - spot_instance = True, - spot_price_max = 1.23, + ], + public_ipv4_subnet_size = 56, + spot_instance = True, + spot_price_max = 1.23, ssh_keys = [ equinix_metal.models.ssh_key_input.SSHKeyInput( href = '', @@ -85,7 +82,7 @@ def make_instance(self, include_optional): tags = [ '' ], ) - ], + ], storage = equinix_metal.models.storage.Storage( disks = [ equinix_metal.models.disk.Disk( @@ -121,18 +118,18 @@ def make_instance(self, include_optional): href = '', level = '', name = '', ) - ], ), + ], ), tags = [ '' - ], - termination_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + ], + termination_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), user_ssh_keys = [ '' - ], - userdata = '', + ], + userdata = '', facility = None ) - else : + else: return InstancesBatchCreateInputBatchesInner( metro = 'sv', operating_system = '', diff --git a/equinix_metal/test/test_interconnection.py b/equinix_metal/test/test_interconnection.py index d324212b..74d34517 100644 --- a/equinix_metal/test/test_interconnection.py +++ b/equinix_metal/test/test_interconnection.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.interconnection import Interconnection # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.interconnection import Interconnection class TestInterconnection(unittest.TestCase): """Interconnection unit test stubs""" @@ -29,34 +26,34 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Interconnection: """Test Interconnection include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Interconnection` """ - model = equinix_metal.models.interconnection.Interconnection() # noqa: E501 - if include_optional : + model = Interconnection() + if include_optional: return Interconnection( - authorization_code = '', - contact_email = '', - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - description = '', + authorization_code = '', + contact_email = '', + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + description = '', facility = equinix_metal.models.href.Href( - href = '', ), - href = '', - id = '', + href = '', ), + href = '', + id = '', metro = equinix_metal.models.metro.Metro( code = '', country = '', href = '', id = '', - name = '', ), - mode = 'standard', - name = '', + name = '', ), + mode = 'standard', + name = '', organization = equinix_metal.models.href.Href( - href = '', ), + href = '', ), ports = [ equinix_metal.models.interconnection_port.InterconnectionPort( href = '', @@ -72,10 +69,10 @@ def make_instance(self, include_optional): virtual_circuits = [ null ], ) - ], - redundancy = 'primary', + ], + redundancy = 'primary', requested_by = equinix_metal.models.href.Href( - href = '', ), + href = '', ), service_tokens = [ equinix_metal.models.fabric_service_token.FabricServiceToken( expires_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), @@ -85,17 +82,17 @@ def make_instance(self, include_optional): role = 'primary', service_token_type = 'a_side', state = 'inactive', ) - ], - speed = 10000000000, - status = '', + ], + speed = 10000000000, + status = '', tags = [ '' - ], - token = '', - type = 'shared', + ], + token = '', + type = 'shared', updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f') ) - else : + else: return Interconnection( ) """ diff --git a/equinix_metal/test/test_interconnection_list.py b/equinix_metal/test/test_interconnection_list.py index 8c18faf4..a337e20a 100644 --- a/equinix_metal/test/test_interconnection_list.py +++ b/equinix_metal/test/test_interconnection_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.interconnection_list import InterconnectionList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.interconnection_list import InterconnectionList class TestInterconnectionList(unittest.TestCase): """InterconnectionList unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> InterconnectionList: """Test InterconnectionList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `InterconnectionList` """ - model = equinix_metal.models.interconnection_list.InterconnectionList() # noqa: E501 - if include_optional : + model = InterconnectionList() + if include_optional: return InterconnectionList( - href = '', + href = '', interconnections = [ equinix_metal.models.interconnection.Interconnection( authorization_code = '', @@ -89,7 +86,7 @@ def make_instance(self, include_optional): token = '', type = 'shared', updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), ) - ], + ], meta = equinix_metal.models.meta.Meta( current_page = 56, first = equinix_metal.models.href.Href( @@ -103,7 +100,7 @@ def make_instance(self, include_optional): self = , total = 56, ) ) - else : + else: return InterconnectionList( ) """ diff --git a/equinix_metal/test/test_interconnection_metro_list.py b/equinix_metal/test/test_interconnection_metro_list.py index b44d6a0d..d4a5ae5e 100644 --- a/equinix_metal/test/test_interconnection_metro_list.py +++ b/equinix_metal/test/test_interconnection_metro_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.interconnection_metro_list import InterconnectionMetroList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.interconnection_metro_list import InterconnectionMetroList class TestInterconnectionMetroList(unittest.TestCase): """InterconnectionMetroList unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> InterconnectionMetroList: """Test InterconnectionMetroList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `InterconnectionMetroList` """ - model = equinix_metal.models.interconnection_metro_list.InterconnectionMetroList() # noqa: E501 - if include_optional : + model = InterconnectionMetroList() + if include_optional: return InterconnectionMetroList( - href = '', + href = '', meta = equinix_metal.models.meta.Meta( current_page = 56, first = equinix_metal.models.href.Href( @@ -51,12 +48,12 @@ def make_instance(self, include_optional): next = , previous = , self = , - total = 56, ), + total = 56, ), metros = [ null ] ) - else : + else: return InterconnectionMetroList( ) """ diff --git a/equinix_metal/test/test_interconnection_metro_list_metros_inner.py b/equinix_metal/test/test_interconnection_metro_list_metros_inner.py index 160f0dee..143b3542 100644 --- a/equinix_metal/test/test_interconnection_metro_list_metros_inner.py +++ b/equinix_metal/test/test_interconnection_metro_list_metros_inner.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.interconnection_metro_list_metros_inner import InterconnectionMetroListMetrosInner # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.interconnection_metro_list_metros_inner import InterconnectionMetroListMetrosInner class TestInterconnectionMetroListMetrosInner(unittest.TestCase): """InterconnectionMetroListMetrosInner unit test stubs""" @@ -29,21 +26,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> InterconnectionMetroListMetrosInner: """Test InterconnectionMetroListMetrosInner include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `InterconnectionMetroListMetrosInner` """ - model = equinix_metal.models.interconnection_metro_list_metros_inner.InterconnectionMetroListMetrosInner() # noqa: E501 - if include_optional : + model = InterconnectionMetroListMetrosInner() + if include_optional: return InterconnectionMetroListMetrosInner( - code = '', - country = '', - href = '', - id = '', - name = '', + code = '', + country = '', + href = '', + id = '', + name = '', providers = [ equinix_metal.models.interconnection_metro_list_metros_inner_all_of_providers_inner.InterconnectionMetroList_metros_inner_allOf_providers_inner( href = '', @@ -54,7 +51,7 @@ def make_instance(self, include_optional): type = 'CSP_AWS', ) ] ) - else : + else: return InterconnectionMetroListMetrosInner( ) """ diff --git a/equinix_metal/test/test_interconnection_metro_list_metros_inner_all_of_providers_inner.py b/equinix_metal/test/test_interconnection_metro_list_metros_inner_all_of_providers_inner.py index f621a432..aeeff4f8 100644 --- a/equinix_metal/test/test_interconnection_metro_list_metros_inner_all_of_providers_inner.py +++ b/equinix_metal/test/test_interconnection_metro_list_metros_inner_all_of_providers_inner.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.interconnection_metro_list_metros_inner_all_of_providers_inner import InterconnectionMetroListMetrosInnerAllOfProvidersInner # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.interconnection_metro_list_metros_inner_all_of_providers_inner import InterconnectionMetroListMetrosInnerAllOfProvidersInner class TestInterconnectionMetroListMetrosInnerAllOfProvidersInner(unittest.TestCase): """InterconnectionMetroListMetrosInnerAllOfProvidersInner unit test stubs""" @@ -29,24 +26,24 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> InterconnectionMetroListMetrosInnerAllOfProvidersInner: """Test InterconnectionMetroListMetrosInnerAllOfProvidersInner include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `InterconnectionMetroListMetrosInnerAllOfProvidersInner` """ - model = equinix_metal.models.interconnection_metro_list_metros_inner_all_of_providers_inner.InterconnectionMetroListMetrosInnerAllOfProvidersInner() # noqa: E501 - if include_optional : + model = InterconnectionMetroListMetrosInnerAllOfProvidersInner() + if include_optional: return InterconnectionMetroListMetrosInnerAllOfProvidersInner( - href = '', + href = '', locations = [ 'us-east-1' - ], - name = 'AWS Direct Connect', + ], + name = 'AWS Direct Connect', type = 'CSP_AWS' ) - else : + else: return InterconnectionMetroListMetrosInnerAllOfProvidersInner( ) """ diff --git a/equinix_metal/test/test_interconnection_port.py b/equinix_metal/test/test_interconnection_port.py index 206834b1..8679bc5d 100644 --- a/equinix_metal/test/test_interconnection_port.py +++ b/equinix_metal/test/test_interconnection_port.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.interconnection_port import InterconnectionPort # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.interconnection_port import InterconnectionPort class TestInterconnectionPort(unittest.TestCase): """InterconnectionPort unit test stubs""" @@ -29,31 +26,31 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> InterconnectionPort: """Test InterconnectionPort include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `InterconnectionPort` """ - model = equinix_metal.models.interconnection_port.InterconnectionPort() # noqa: E501 - if include_optional : + model = InterconnectionPort() + if include_optional: return InterconnectionPort( - href = '', - id = '', - link_status = '', - name = '', + href = '', + id = '', + link_status = '', + name = '', organization = equinix_metal.models.href.Href( - href = '', ), - role = 'primary', - speed = 56, - status = 'requested', - switch_id = '', + href = '', ), + role = 'primary', + speed = 56, + status = 'requested', + switch_id = '', virtual_circuits = [ null ] ) - else : + else: return InterconnectionPort( ) """ diff --git a/equinix_metal/test/test_interconnection_port_list.py b/equinix_metal/test/test_interconnection_port_list.py index 8e321dc4..94f348b4 100644 --- a/equinix_metal/test/test_interconnection_port_list.py +++ b/equinix_metal/test/test_interconnection_port_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.interconnection_port_list import InterconnectionPortList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.interconnection_port_list import InterconnectionPortList class TestInterconnectionPortList(unittest.TestCase): """InterconnectionPortList unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> InterconnectionPortList: """Test InterconnectionPortList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `InterconnectionPortList` """ - model = equinix_metal.models.interconnection_port_list.InterconnectionPortList() # noqa: E501 - if include_optional : + model = InterconnectionPortList() + if include_optional: return InterconnectionPortList( - href = '', + href = '', ports = [ equinix_metal.models.interconnection_port.InterconnectionPort( href = '', @@ -57,7 +54,7 @@ def make_instance(self, include_optional): ], ) ] ) - else : + else: return InterconnectionPortList( ) """ diff --git a/equinix_metal/test/test_interconnection_pricing_list.py b/equinix_metal/test/test_interconnection_pricing_list.py index b4807249..6c64f49a 100644 --- a/equinix_metal/test/test_interconnection_pricing_list.py +++ b/equinix_metal/test/test_interconnection_pricing_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.interconnection_pricing_list import InterconnectionPricingList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.interconnection_pricing_list import InterconnectionPricingList class TestInterconnectionPricingList(unittest.TestCase): """InterconnectionPricingList unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> InterconnectionPricingList: """Test InterconnectionPricingList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `InterconnectionPricingList` """ - model = equinix_metal.models.interconnection_pricing_list.InterconnectionPricingList() # noqa: E501 - if include_optional : + model = InterconnectionPricingList() + if include_optional: return InterconnectionPricingList( - href = '', + href = '', provider_pricing = [ equinix_metal.models.interconnection_pricing_list_provider_pricing_inner.InterconnectionPricingList_provider_pricing_inner( href = '', @@ -53,7 +50,7 @@ def make_instance(self, include_optional): ], ) ] ) - else : + else: return InterconnectionPricingList( ) """ diff --git a/equinix_metal/test/test_interconnection_pricing_list_provider_pricing_inner.py b/equinix_metal/test/test_interconnection_pricing_list_provider_pricing_inner.py index 0fc34019..2970121a 100644 --- a/equinix_metal/test/test_interconnection_pricing_list_provider_pricing_inner.py +++ b/equinix_metal/test/test_interconnection_pricing_list_provider_pricing_inner.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.interconnection_pricing_list_provider_pricing_inner import InterconnectionPricingListProviderPricingInner # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.interconnection_pricing_list_provider_pricing_inner import InterconnectionPricingListProviderPricingInner class TestInterconnectionPricingListProviderPricingInner(unittest.TestCase): """InterconnectionPricingListProviderPricingInner unit test stubs""" @@ -29,18 +26,18 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> InterconnectionPricingListProviderPricingInner: """Test InterconnectionPricingListProviderPricingInner include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `InterconnectionPricingListProviderPricingInner` """ - model = equinix_metal.models.interconnection_pricing_list_provider_pricing_inner.InterconnectionPricingListProviderPricingInner() # noqa: E501 - if include_optional : + model = InterconnectionPricingListProviderPricingInner() + if include_optional: return InterconnectionPricingListProviderPricingInner( - href = '', - provider = 'CSP_AWS', + href = '', + provider = 'CSP_AWS', tiers = [ equinix_metal.models.interconnection_pricing_list_provider_pricing_inner_tiers_inner.InterconnectionPricingList_provider_pricing_inner_tiers_inner( bandwidth = 500, @@ -49,7 +46,7 @@ def make_instance(self, include_optional): price = 10.04, ) ] ) - else : + else: return InterconnectionPricingListProviderPricingInner( ) """ diff --git a/equinix_metal/test/test_interconnection_pricing_list_provider_pricing_inner_tiers_inner.py b/equinix_metal/test/test_interconnection_pricing_list_provider_pricing_inner_tiers_inner.py index da70029e..8db29f55 100644 --- a/equinix_metal/test/test_interconnection_pricing_list_provider_pricing_inner_tiers_inner.py +++ b/equinix_metal/test/test_interconnection_pricing_list_provider_pricing_inner_tiers_inner.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.interconnection_pricing_list_provider_pricing_inner_tiers_inner import InterconnectionPricingListProviderPricingInnerTiersInner # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.interconnection_pricing_list_provider_pricing_inner_tiers_inner import InterconnectionPricingListProviderPricingInnerTiersInner class TestInterconnectionPricingListProviderPricingInnerTiersInner(unittest.TestCase): """InterconnectionPricingListProviderPricingInnerTiersInner unit test stubs""" @@ -29,22 +26,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> InterconnectionPricingListProviderPricingInnerTiersInner: """Test InterconnectionPricingListProviderPricingInnerTiersInner include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `InterconnectionPricingListProviderPricingInnerTiersInner` """ - model = equinix_metal.models.interconnection_pricing_list_provider_pricing_inner_tiers_inner.InterconnectionPricingListProviderPricingInnerTiersInner() # noqa: E501 - if include_optional : + model = InterconnectionPricingListProviderPricingInnerTiersInner() + if include_optional: return InterconnectionPricingListProviderPricingInnerTiersInner( - bandwidth = 500, - billing_cycle = 'monthly', - href = '', + bandwidth = 500, + billing_cycle = 'monthly', + href = '', price = 10.04 ) - else : + else: return InterconnectionPricingListProviderPricingInnerTiersInner( ) """ diff --git a/equinix_metal/test/test_interconnection_update_input.py b/equinix_metal/test/test_interconnection_update_input.py index a7b5fbe9..839cee42 100644 --- a/equinix_metal/test/test_interconnection_update_input.py +++ b/equinix_metal/test/test_interconnection_update_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.interconnection_update_input import InterconnectionUpdateInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.interconnection_update_input import InterconnectionUpdateInput class TestInterconnectionUpdateInput(unittest.TestCase): """InterconnectionUpdateInput unit test stubs""" @@ -29,26 +26,26 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> InterconnectionUpdateInput: """Test InterconnectionUpdateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `InterconnectionUpdateInput` """ - model = equinix_metal.models.interconnection_update_input.InterconnectionUpdateInput() # noqa: E501 - if include_optional : + model = InterconnectionUpdateInput() + if include_optional: return InterconnectionUpdateInput( - contact_email = '', - description = '', - href = '', - mode = 'standard', - name = '', + contact_email = '', + description = '', + href = '', + mode = 'standard', + name = '', tags = [ '' ] ) - else : + else: return InterconnectionUpdateInput( ) """ diff --git a/equinix_metal/test/test_interconnections_api.py b/equinix_metal/test/test_interconnections_api.py index 5ebcaaeb..d459e777 100644 --- a/equinix_metal/test/test_interconnections_api.py +++ b/equinix_metal/test/test_interconnections_api.py @@ -15,122 +15,120 @@ import unittest -import equinix_metal -from equinix_metal.api.interconnections_api import InterconnectionsApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.interconnections_api import InterconnectionsApi class TestInterconnectionsApi(unittest.TestCase): """InterconnectionsApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.interconnections_api.InterconnectionsApi() # noqa: E501 + def setUp(self) -> None: + self.api = InterconnectionsApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_create_interconnection_port_virtual_circuit(self): + def test_create_interconnection_port_virtual_circuit(self) -> None: """Test case for create_interconnection_port_virtual_circuit - Create a new Virtual Circuit # noqa: E501 + Create a new Virtual Circuit """ pass - def test_create_organization_interconnection(self): + def test_create_organization_interconnection(self) -> None: """Test case for create_organization_interconnection - Request a new interconnection for the organization # noqa: E501 + Request a new interconnection for the organization """ pass - def test_create_project_interconnection(self): + def test_create_project_interconnection(self) -> None: """Test case for create_project_interconnection - Request a new interconnection for the project's organization # noqa: E501 + Request a new interconnection for the project's organization """ pass - def test_delete_interconnection(self): + def test_delete_interconnection(self) -> None: """Test case for delete_interconnection - Delete interconnection # noqa: E501 + Delete interconnection """ pass - def test_delete_virtual_circuit(self): + def test_delete_virtual_circuit(self) -> None: """Test case for delete_virtual_circuit - Delete a virtual circuit # noqa: E501 + Delete a virtual circuit """ pass - def test_get_interconnection(self): + def test_get_interconnection(self) -> None: """Test case for get_interconnection - Get interconnection # noqa: E501 + Get interconnection """ pass - def test_get_interconnection_metros(self): + def test_get_interconnection_metros(self) -> None: """Test case for get_interconnection_metros - Get connectivity to network provider by metro # noqa: E501 + Get connectivity to network provider by metro """ pass - def test_get_interconnection_port(self): + def test_get_interconnection_port(self) -> None: """Test case for get_interconnection_port - Get a interconnection port # noqa: E501 + Get a interconnection port """ pass - def test_get_interconnection_pricing(self): + def test_get_interconnection_pricing(self) -> None: """Test case for get_interconnection_pricing - Get Interconnection Pricing # noqa: E501 + Get Interconnection Pricing """ pass - def test_get_virtual_circuit(self): + def test_get_virtual_circuit(self) -> None: """Test case for get_virtual_circuit - Get a virtual circuit # noqa: E501 + Get a virtual circuit """ pass - def test_list_interconnection_port_virtual_circuits(self): + def test_list_interconnection_port_virtual_circuits(self) -> None: """Test case for list_interconnection_port_virtual_circuits - List a interconnection port's virtual circuits # noqa: E501 + List a interconnection port's virtual circuits """ pass - def test_list_interconnection_ports(self): + def test_list_interconnection_ports(self) -> None: """Test case for list_interconnection_ports - List a interconnection's ports # noqa: E501 + List a interconnection's ports """ pass - def test_list_interconnection_virtual_circuits(self): + def test_list_interconnection_virtual_circuits(self) -> None: """Test case for list_interconnection_virtual_circuits - List a interconnection's virtual circuits # noqa: E501 + List a interconnection's virtual circuits """ pass - def test_organization_list_interconnections(self): + def test_organization_list_interconnections(self) -> None: """Test case for organization_list_interconnections - List organization connections # noqa: E501 + List organization connections """ pass - def test_project_list_interconnections(self): + def test_project_list_interconnections(self) -> None: """Test case for project_list_interconnections - List project connections # noqa: E501 + List project connections """ pass @@ -141,17 +139,17 @@ def test_project_list_interconnections_all_pages(self): """ pass - def test_update_interconnection(self): + def test_update_interconnection(self) -> None: """Test case for update_interconnection - Update interconnection # noqa: E501 + Update interconnection """ pass - def test_update_virtual_circuit(self): + def test_update_virtual_circuit(self) -> None: """Test case for update_virtual_circuit - Update a virtual circuit # noqa: E501 + Update a virtual circuit """ pass diff --git a/equinix_metal/test/test_invitation.py b/equinix_metal/test/test_invitation.py index 52d0f5e8..b8177d85 100644 --- a/equinix_metal/test/test_invitation.py +++ b/equinix_metal/test/test_invitation.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.invitation import Invitation # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.invitation import Invitation class TestInvitation(unittest.TestCase): """Invitation unit test stubs""" @@ -29,37 +26,37 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Invitation: """Test Invitation include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Invitation` """ - model = equinix_metal.models.invitation.Invitation() # noqa: E501 - if include_optional : + model = Invitation() + if include_optional: return Invitation( - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - href = '', - id = '', + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + href = '', + id = '', invitation = equinix_metal.models.href.Href( - href = '', ), + href = '', ), invited_by = equinix_metal.models.href.Href( - href = '', ), - invitee = '', - nonce = '', + href = '', ), + invitee = '', + nonce = '', organization = equinix_metal.models.href.Href( - href = '', ), + href = '', ), projects = [ equinix_metal.models.href.Href( href = '', ) - ], + ], roles = [ 'admin' - ], + ], updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f') ) - else : + else: return Invitation( ) """ diff --git a/equinix_metal/test/test_invitation_input.py b/equinix_metal/test/test_invitation_input.py index c7a472c1..a0f1ac14 100644 --- a/equinix_metal/test/test_invitation_input.py +++ b/equinix_metal/test/test_invitation_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.invitation_input import InvitationInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.invitation_input import InvitationInput class TestInvitationInput(unittest.TestCase): """InvitationInput unit test stubs""" @@ -29,28 +26,28 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> InvitationInput: """Test InvitationInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `InvitationInput` """ - model = equinix_metal.models.invitation_input.InvitationInput() # noqa: E501 - if include_optional : + model = InvitationInput() + if include_optional: return InvitationInput( - href = '', - invitee = '', - message = '', - organization_id = '', + href = '', + invitee = '', + message = '', + organization_id = '', projects_ids = [ '' - ], + ], roles = [ 'admin' ] ) - else : + else: return InvitationInput( invitee = '', ) diff --git a/equinix_metal/test/test_invitation_list.py b/equinix_metal/test/test_invitation_list.py index e19cbee5..d63e813d 100644 --- a/equinix_metal/test/test_invitation_list.py +++ b/equinix_metal/test/test_invitation_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.invitation_list import InvitationList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.invitation_list import InvitationList class TestInvitationList(unittest.TestCase): """InvitationList unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> InvitationList: """Test InvitationList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `InvitationList` """ - model = equinix_metal.models.invitation_list.InvitationList() # noqa: E501 - if include_optional : + model = InvitationList() + if include_optional: return InvitationList( - href = '', + href = '', invitations = [ equinix_metal.models.membership.Membership( created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), @@ -55,7 +52,7 @@ def make_instance(self, include_optional): href = '', ), ) ] ) - else : + else: return InvitationList( ) """ diff --git a/equinix_metal/test/test_invitations_api.py b/equinix_metal/test/test_invitations_api.py index 6f7d582b..5ba581cb 100644 --- a/equinix_metal/test/test_invitations_api.py +++ b/equinix_metal/test/test_invitations_api.py @@ -15,38 +15,36 @@ import unittest -import equinix_metal -from equinix_metal.api.invitations_api import InvitationsApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.invitations_api import InvitationsApi class TestInvitationsApi(unittest.TestCase): """InvitationsApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.invitations_api.InvitationsApi() # noqa: E501 + def setUp(self) -> None: + self.api = InvitationsApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_accept_invitation(self): + def test_accept_invitation(self) -> None: """Test case for accept_invitation - Accept an invitation # noqa: E501 + Accept an invitation """ pass - def test_decline_invitation(self): + def test_decline_invitation(self) -> None: """Test case for decline_invitation - Decline an invitation # noqa: E501 + Decline an invitation """ pass - def test_find_invitation_by_id(self): + def test_find_invitation_by_id(self) -> None: """Test case for find_invitation_by_id - View an invitation # noqa: E501 + View an invitation """ pass diff --git a/equinix_metal/test/test_invoice.py b/equinix_metal/test/test_invoice.py index 2f3a1af7..1584e073 100644 --- a/equinix_metal/test/test_invoice.py +++ b/equinix_metal/test/test_invoice.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.invoice import Invoice # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.invoice import Invoice class TestInvoice(unittest.TestCase): """Invoice unit test stubs""" @@ -29,25 +26,25 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Invoice: """Test Invoice include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Invoice` """ - model = equinix_metal.models.invoice.Invoice() # noqa: E501 - if include_optional : + model = Invoice() + if include_optional: return Invoice( - amount = 1.337, - balance = 1.337, - created_on = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), - credit_amount = 1.337, - credits_applied = 1.337, - currency = 'USD', - due_on = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), - href = '', - id = '', + amount = 1.337, + balance = 1.337, + created_on = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + credit_amount = 1.337, + credits_applied = 1.337, + currency = 'USD', + due_on = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + href = '', + id = '', items = [ equinix_metal.models.line_item.LineItem( amount = 1.337, @@ -115,17 +112,17 @@ class = 'm3.large.x86', type = 'standard', ), unit = '', unit_price = 1.337, ) - ], - number = '', + ], + number = '', project = equinix_metal.models.project_id_name.ProjectIdName( href = '', id = '', - name = '', ), - reference_number = '', - status = '', + name = '', ), + reference_number = '', + status = '', target_date = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date() ) - else : + else: return Invoice( ) """ diff --git a/equinix_metal/test/test_invoice_list.py b/equinix_metal/test/test_invoice_list.py index 10121c71..7b966691 100644 --- a/equinix_metal/test/test_invoice_list.py +++ b/equinix_metal/test/test_invoice_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.invoice_list import InvoiceList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.invoice_list import InvoiceList class TestInvoiceList(unittest.TestCase): """InvoiceList unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> InvoiceList: """Test InvoiceList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `InvoiceList` """ - model = equinix_metal.models.invoice_list.InvoiceList() # noqa: E501 - if include_optional : + model = InvoiceList() + if include_optional: return InvoiceList( - href = '', + href = '', invoices = [ equinix_metal.models.invoice.Invoice( amount = 1.337, @@ -129,7 +126,7 @@ class = 'm3.large.x86', target_date = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), ) ] ) - else : + else: return InvoiceList( ) """ diff --git a/equinix_metal/test/test_invoices_api.py b/equinix_metal/test/test_invoices_api.py index d3666447..1e523dc7 100644 --- a/equinix_metal/test/test_invoices_api.py +++ b/equinix_metal/test/test_invoices_api.py @@ -15,31 +15,29 @@ import unittest -import equinix_metal -from equinix_metal.api.invoices_api import InvoicesApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.invoices_api import InvoicesApi class TestInvoicesApi(unittest.TestCase): """InvoicesApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.invoices_api.InvoicesApi() # noqa: E501 + def setUp(self) -> None: + self.api = InvoicesApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_find_organization_invoices(self): + def test_find_organization_invoices(self) -> None: """Test case for find_organization_invoices - Retrieve all invoices for an organization # noqa: E501 + Retrieve all invoices for an organization """ pass - def test_get_invoice_by_id(self): + def test_get_invoice_by_id(self) -> None: """Test case for get_invoice_by_id - Retrieve an invoice # noqa: E501 + Retrieve an invoice """ pass diff --git a/equinix_metal/test/test_ip_address.py b/equinix_metal/test/test_ip_address.py index 568e8d85..43a5d2c2 100644 --- a/equinix_metal/test/test_ip_address.py +++ b/equinix_metal/test/test_ip_address.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.ip_address import IPAddress # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.ip_address import IPAddress class TestIPAddress(unittest.TestCase): """IPAddress unit test stubs""" @@ -29,25 +26,25 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> IPAddress: """Test IPAddress include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `IPAddress` """ - model = equinix_metal.models.ip_address.IPAddress() # noqa: E501 - if include_optional : + model = IPAddress() + if include_optional: return IPAddress( - address_family = 4, - cidr = 28, - href = '', + address_family = 4, + cidr = 28, + href = '', ip_reservations = [ '' - ], + ], public = False ) - else : + else: return IPAddress( ) """ diff --git a/equinix_metal/test/test_ip_addresses_api.py b/equinix_metal/test/test_ip_addresses_api.py index 8c3e5d26..4a8dc0a1 100644 --- a/equinix_metal/test/test_ip_addresses_api.py +++ b/equinix_metal/test/test_ip_addresses_api.py @@ -15,66 +15,64 @@ import unittest -import equinix_metal -from equinix_metal.api.ip_addresses_api import IPAddressesApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.ip_addresses_api import IPAddressesApi class TestIPAddressesApi(unittest.TestCase): """IPAddressesApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.ip_addresses_api.IPAddressesApi() # noqa: E501 + def setUp(self) -> None: + self.api = IPAddressesApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_delete_ip_address(self): + def test_delete_ip_address(self) -> None: """Test case for delete_ip_address - Unassign an ip address # noqa: E501 + Unassign an ip address """ pass - def test_find_ip_address_by_id(self): + def test_find_ip_address_by_id(self) -> None: """Test case for find_ip_address_by_id - Retrieve an ip address # noqa: E501 + Retrieve an ip address """ pass - def test_find_ip_address_customdata(self): + def test_find_ip_address_customdata(self) -> None: """Test case for find_ip_address_customdata - Retrieve the custom metadata of an IP Reservation or IP Assignment # noqa: E501 + Retrieve the custom metadata of an IP Reservation or IP Assignment """ pass - def test_find_ip_availabilities(self): + def test_find_ip_availabilities(self) -> None: """Test case for find_ip_availabilities - Retrieve all available subnets of a particular reservation # noqa: E501 + Retrieve all available subnets of a particular reservation """ pass - def test_find_ip_reservations(self): + def test_find_ip_reservations(self) -> None: """Test case for find_ip_reservations - Retrieve all ip reservations # noqa: E501 + Retrieve all ip reservations """ pass - def test_request_ip_reservation(self): + def test_request_ip_reservation(self) -> None: """Test case for request_ip_reservation - Requesting IP reservations # noqa: E501 + Requesting IP reservations """ pass - def test_update_ip_address(self): + def test_update_ip_address(self) -> None: """Test case for update_ip_address - Update an ip address # noqa: E501 + Update an ip address """ pass diff --git a/equinix_metal/test/test_ip_assignment.py b/equinix_metal/test/test_ip_assignment.py index 718f983a..5f13f098 100644 --- a/equinix_metal/test/test_ip_assignment.py +++ b/equinix_metal/test/test_ip_assignment.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.ip_assignment import IPAssignment # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.ip_assignment import IPAssignment class TestIPAssignment(unittest.TestCase): """IPAssignment unit test stubs""" @@ -29,42 +26,42 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> IPAssignment: """Test IPAssignment include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `IPAssignment` """ - model = equinix_metal.models.ip_assignment.IPAssignment() # noqa: E501 - if include_optional : + model = IPAssignment() + if include_optional: return IPAssignment( - address = '', - address_family = 56, + address = '', + address_family = 56, assigned_to = equinix_metal.models.href.Href( - href = '', ), - cidr = 56, - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - enabled = True, - gateway = '', - global_ip = True, - href = '', - id = '', - manageable = True, - management = True, - metro = None, - netmask = '', - network = '', - next_hop = '', + href = '', ), + cidr = 56, + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + enabled = True, + gateway = '', + global_ip = True, + href = '', + id = '', + manageable = True, + management = True, + metro = None, + netmask = '', + network = '', + next_hop = '', parent_block = equinix_metal.models.parent_block.ParentBlock( cidr = 56, href = '', netmask = '', - network = '', ), - public = True, + network = '', ), + public = True, state = 'pending' ) - else : + else: return IPAssignment( assigned_to = equinix_metal.models.href.Href( href = '', ), diff --git a/equinix_metal/test/test_ip_assignment_input.py b/equinix_metal/test/test_ip_assignment_input.py index 39ad3573..a7a9a9f6 100644 --- a/equinix_metal/test/test_ip_assignment_input.py +++ b/equinix_metal/test/test_ip_assignment_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.ip_assignment_input import IPAssignmentInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.ip_assignment_input import IPAssignmentInput class TestIPAssignmentInput(unittest.TestCase): """IPAssignmentInput unit test stubs""" @@ -29,21 +26,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> IPAssignmentInput: """Test IPAssignmentInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `IPAssignmentInput` """ - model = equinix_metal.models.ip_assignment_input.IPAssignmentInput() # noqa: E501 - if include_optional : + model = IPAssignmentInput() + if include_optional: return IPAssignmentInput( - address = '', - customdata = None, + address = '', + customdata = None, href = '' ) - else : + else: return IPAssignmentInput( address = '', ) diff --git a/equinix_metal/test/test_ip_assignment_list.py b/equinix_metal/test/test_ip_assignment_list.py index 07a02d41..15be3336 100644 --- a/equinix_metal/test/test_ip_assignment_list.py +++ b/equinix_metal/test/test_ip_assignment_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.ip_assignment_list import IPAssignmentList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.ip_assignment_list import IPAssignmentList class TestIPAssignmentList(unittest.TestCase): """IPAssignmentList unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> IPAssignmentList: """Test IPAssignmentList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `IPAssignmentList` """ - model = equinix_metal.models.ip_assignment_list.IPAssignmentList() # noqa: E501 - if include_optional : + model = IPAssignmentList() + if include_optional: return IPAssignmentList( - href = '', + href = '', ip_addresses = [ equinix_metal.models.ip_assignment.IPAssignment( address = '', @@ -68,7 +65,7 @@ def make_instance(self, include_optional): state = 'pending', ) ] ) - else : + else: return IPAssignmentList( ) """ diff --git a/equinix_metal/test/test_ip_assignment_metro.py b/equinix_metal/test/test_ip_assignment_metro.py index fe981572..eaf2ab41 100644 --- a/equinix_metal/test/test_ip_assignment_metro.py +++ b/equinix_metal/test/test_ip_assignment_metro.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.ip_assignment_metro import IPAssignmentMetro # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.ip_assignment_metro import IPAssignmentMetro class TestIPAssignmentMetro(unittest.TestCase): """IPAssignmentMetro unit test stubs""" @@ -29,23 +26,23 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> IPAssignmentMetro: """Test IPAssignmentMetro include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `IPAssignmentMetro` """ - model = equinix_metal.models.ip_assignment_metro.IPAssignmentMetro() # noqa: E501 - if include_optional : + model = IPAssignmentMetro() + if include_optional: return IPAssignmentMetro( - code = '', - country = '', - href = '', - id = '', + code = '', + country = '', + href = '', + id = '', name = '' ) - else : + else: return IPAssignmentMetro( ) """ diff --git a/equinix_metal/test/test_ip_assignment_update_input.py b/equinix_metal/test/test_ip_assignment_update_input.py index 9f885e22..51c974b4 100644 --- a/equinix_metal/test/test_ip_assignment_update_input.py +++ b/equinix_metal/test/test_ip_assignment_update_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.ip_assignment_update_input import IPAssignmentUpdateInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.ip_assignment_update_input import IPAssignmentUpdateInput class TestIPAssignmentUpdateInput(unittest.TestCase): """IPAssignmentUpdateInput unit test stubs""" @@ -29,24 +26,24 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> IPAssignmentUpdateInput: """Test IPAssignmentUpdateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `IPAssignmentUpdateInput` """ - model = equinix_metal.models.ip_assignment_update_input.IPAssignmentUpdateInput() # noqa: E501 - if include_optional : + model = IPAssignmentUpdateInput() + if include_optional: return IPAssignmentUpdateInput( - customdata = None, - details = '', - href = '', + customdata = None, + details = '', + href = '', tags = [ '' ] ) - else : + else: return IPAssignmentUpdateInput( ) """ diff --git a/equinix_metal/test/test_ip_availabilities_list.py b/equinix_metal/test/test_ip_availabilities_list.py index 1b7aa00a..1e771d02 100644 --- a/equinix_metal/test/test_ip_availabilities_list.py +++ b/equinix_metal/test/test_ip_availabilities_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.ip_availabilities_list import IPAvailabilitiesList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.ip_availabilities_list import IPAvailabilitiesList class TestIPAvailabilitiesList(unittest.TestCase): """IPAvailabilitiesList unit test stubs""" @@ -29,22 +26,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> IPAvailabilitiesList: """Test IPAvailabilitiesList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `IPAvailabilitiesList` """ - model = equinix_metal.models.ip_availabilities_list.IPAvailabilitiesList() # noqa: E501 - if include_optional : + model = IPAvailabilitiesList() + if include_optional: return IPAvailabilitiesList( available = [ '' - ], + ], href = '' ) - else : + else: return IPAvailabilitiesList( ) """ diff --git a/equinix_metal/test/test_ip_reservation.py b/equinix_metal/test/test_ip_reservation.py index 12606567..4425385d 100644 --- a/equinix_metal/test/test_ip_reservation.py +++ b/equinix_metal/test/test_ip_reservation.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.ip_reservation import IPReservation # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.ip_reservation import IPReservation class TestIPReservation(unittest.TestCase): """IPReservation unit test stubs""" @@ -29,37 +26,37 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> IPReservation: """Test IPReservation include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `IPReservation` """ - model = equinix_metal.models.ip_reservation.IPReservation() # noqa: E501 - if include_optional : + model = IPReservation() + if include_optional: return IPReservation( - addon = True, - address = '', - address_family = 56, + addon = True, + address = '', + address_family = 56, assignments = [ equinix_metal.models.href.Href( href = '', ) - ], - available = '', - bill = True, - cidr = 56, - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - customdata = None, - details = '', - enabled = True, - facility = None, - gateway = '', - global_ip = True, - href = '', - id = '', - manageable = True, - management = True, + ], + available = '', + bill = True, + cidr = 56, + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + customdata = None, + details = '', + enabled = True, + facility = None, + gateway = '', + global_ip = True, + href = '', + id = '', + manageable = True, + management = True, metal_gateway = equinix_metal.models.metal_gateway_lite.MetalGatewayLite( created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), gateway_address = '10.1.2.1/27', @@ -67,10 +64,10 @@ def make_instance(self, include_optional): id = '', state = 'ready', updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - vlan = 1001, ), - metro = None, - netmask = '', - network = '', + vlan = 1001, ), + metro = None, + netmask = '', + network = '', project = equinix_metal.models.project.Project( backend_transfer_enabled = True, bgp_config = equinix_metal.models.href.Href( @@ -107,19 +104,19 @@ def make_instance(self, include_optional): updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), volumes = [ - ], ), + ], ), project_lite = equinix_metal.models.href.Href( - href = '', ), - public = True, + href = '', ), + public = True, requested_by = equinix_metal.models.href.Href( - href = '', ), - state = '', + href = '', ), + state = '', tags = [ '' - ], + ], type = 'global_ipv4' ) - else : + else: return IPReservation( type = 'global_ipv4', ) diff --git a/equinix_metal/test/test_ip_reservation_facility.py b/equinix_metal/test/test_ip_reservation_facility.py index 3a9e03af..2349e283 100644 --- a/equinix_metal/test/test_ip_reservation_facility.py +++ b/equinix_metal/test/test_ip_reservation_facility.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.ip_reservation_facility import IPReservationFacility # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.ip_reservation_facility import IPReservationFacility class TestIPReservationFacility(unittest.TestCase): """IPReservationFacility unit test stubs""" @@ -29,17 +26,18 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> IPReservationFacility: """Test IPReservationFacility include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `IPReservationFacility` """ - model = equinix_metal.models.ip_reservation_facility.IPReservationFacility() # noqa: E501 - if include_optional : + model = IPReservationFacility() + if include_optional: return IPReservationFacility( address = equinix_metal.models.address.Address( + address = '', address2 = '', city = '', coordinates = equinix_metal.models.coordinates.Coordinates( @@ -49,16 +47,16 @@ def make_instance(self, include_optional): country = '', href = '', state = '', - zip_code = '', ), - code = '', - features = ["baremetal","backend_transfer","global_ipv4"], - href = '', - id = '', - ip_ranges = ["2604:1380::/36","147.75.192.0/21"], - metro = None, + zip_code = '', ), + code = '', + features = [baremetal, backend_transfer, global_ipv4], + href = '', + id = '', + ip_ranges = [2604:1380::/36, 147.75.192.0/21], + metro = None, name = '' ) - else : + else: return IPReservationFacility( ) """ diff --git a/equinix_metal/test/test_ip_reservation_list.py b/equinix_metal/test/test_ip_reservation_list.py index c4c570ee..7749a158 100644 --- a/equinix_metal/test/test_ip_reservation_list.py +++ b/equinix_metal/test/test_ip_reservation_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.ip_reservation_list import IPReservationList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.ip_reservation_list import IPReservationList class TestIPReservationList(unittest.TestCase): """IPReservationList unit test stubs""" @@ -29,20 +26,20 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> IPReservationList: """Test IPReservationList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `IPReservationList` """ - model = equinix_metal.models.ip_reservation_list.IPReservationList() # noqa: E501 - if include_optional : + model = IPReservationList() + if include_optional: return IPReservationList( - href = '', + href = '', ip_addresses = [ null - ], + ], meta = equinix_metal.models.meta.Meta( current_page = 56, first = equinix_metal.models.href.Href( @@ -56,7 +53,7 @@ def make_instance(self, include_optional): self = , total = 56, ) ) - else : + else: return IPReservationList( ) """ diff --git a/equinix_metal/test/test_ip_reservation_list_ip_addresses_inner.py b/equinix_metal/test/test_ip_reservation_list_ip_addresses_inner.py index 38386df4..1142e712 100644 --- a/equinix_metal/test/test_ip_reservation_list_ip_addresses_inner.py +++ b/equinix_metal/test/test_ip_reservation_list_ip_addresses_inner.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.ip_reservation_list_ip_addresses_inner import IPReservationListIpAddressesInner # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.ip_reservation_list_ip_addresses_inner import IPReservationListIpAddressesInner class TestIPReservationListIpAddressesInner(unittest.TestCase): """IPReservationListIpAddressesInner unit test stubs""" @@ -29,37 +26,37 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> IPReservationListIpAddressesInner: """Test IPReservationListIpAddressesInner include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `IPReservationListIpAddressesInner` """ - model = equinix_metal.models.ip_reservation_list_ip_addresses_inner.IPReservationListIpAddressesInner() # noqa: E501 - if include_optional : + model = IPReservationListIpAddressesInner() + if include_optional: return IPReservationListIpAddressesInner( - addon = True, - address = '', - address_family = 56, + addon = True, + address = '', + address_family = 56, assignments = [ equinix_metal.models.href.Href( href = '', ) - ], - available = '', - bill = True, - cidr = 56, - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - customdata = equinix_metal.models.customdata.customdata(), - details = '', - enabled = True, - facility = None, - gateway = '', - global_ip = True, - href = '', - id = '', - manageable = True, - management = True, + ], + available = '', + bill = True, + cidr = 56, + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + customdata = equinix_metal.models.customdata.customdata(), + details = '', + enabled = True, + facility = None, + gateway = '', + global_ip = True, + href = '', + id = '', + manageable = True, + management = True, metal_gateway = equinix_metal.models.metal_gateway_lite.MetalGatewayLite( created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), gateway_address = '10.1.2.1/27', @@ -67,15 +64,15 @@ def make_instance(self, include_optional): id = '', state = 'ready', updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - vlan = 1001, ), + vlan = 1001, ), metro = equinix_metal.models.metro.Metro( code = '', country = '', href = '', id = '', - name = '', ), - netmask = '', - network = '', + name = '', ), + netmask = '', + network = '', project = equinix_metal.models.project.Project( backend_transfer_enabled = True, bgp_config = equinix_metal.models.href.Href( @@ -112,7 +109,7 @@ def make_instance(self, include_optional): updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), volumes = [ - ], ), + ], ), project_lite = equinix_metal.models.project.Project( backend_transfer_enabled = True, bgp_config = equinix_metal.models.href.Href( @@ -149,17 +146,17 @@ def make_instance(self, include_optional): updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), volumes = [ - ], ), - public = True, + ], ), + public = True, requested_by = equinix_metal.models.href.Href( - href = '', ), - state = '', + href = '', ), + state = '', tags = [ '' - ], - type = 'global_ipv4', + ], + type = 'global_ipv4', created_by = equinix_metal.models.href.Href( - href = '', ), + href = '', ), vrf = equinix_metal.models.vrf.Vrf( bgp_dynamic_neighbors_bfd_enabled = True, bgp_dynamic_neighbors_enabled = True, @@ -278,7 +275,7 @@ def make_instance(self, include_optional): updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), ), ) ], ) ) - else : + else: return IPReservationListIpAddressesInner( type = 'global_ipv4', vrf = equinix_metal.models.vrf.Vrf( diff --git a/equinix_metal/test/test_ip_reservation_metro.py b/equinix_metal/test/test_ip_reservation_metro.py index 82bbf898..caa134c5 100644 --- a/equinix_metal/test/test_ip_reservation_metro.py +++ b/equinix_metal/test/test_ip_reservation_metro.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.ip_reservation_metro import IPReservationMetro # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.ip_reservation_metro import IPReservationMetro class TestIPReservationMetro(unittest.TestCase): """IPReservationMetro unit test stubs""" @@ -29,23 +26,23 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> IPReservationMetro: """Test IPReservationMetro include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `IPReservationMetro` """ - model = equinix_metal.models.ip_reservation_metro.IPReservationMetro() # noqa: E501 - if include_optional : + model = IPReservationMetro() + if include_optional: return IPReservationMetro( - code = '', - country = '', - href = '', - id = '', + code = '', + country = '', + href = '', + id = '', name = '' ) - else : + else: return IPReservationMetro( ) """ diff --git a/equinix_metal/test/test_ip_reservation_request_input.py b/equinix_metal/test/test_ip_reservation_request_input.py index bbc7954b..5ac69047 100644 --- a/equinix_metal/test/test_ip_reservation_request_input.py +++ b/equinix_metal/test/test_ip_reservation_request_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.ip_reservation_request_input import IPReservationRequestInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.ip_reservation_request_input import IPReservationRequestInput class TestIPReservationRequestInput(unittest.TestCase): """IPReservationRequestInput unit test stubs""" @@ -29,30 +26,30 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> IPReservationRequestInput: """Test IPReservationRequestInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `IPReservationRequestInput` """ - model = equinix_metal.models.ip_reservation_request_input.IPReservationRequestInput() # noqa: E501 - if include_optional : + model = IPReservationRequestInput() + if include_optional: return IPReservationRequestInput( - comments = '', - customdata = None, - details = '', - facility = '', - fail_on_approval_required = True, - href = '', - metro = 'SV', - quantity = 56, + comments = '', + customdata = None, + details = '', + facility = '', + fail_on_approval_required = True, + href = '', + metro = 'SV', + quantity = 56, tags = [ '' - ], + ], type = '' ) - else : + else: return IPReservationRequestInput( quantity = 56, type = '', diff --git a/equinix_metal/test/test_license.py b/equinix_metal/test/test_license.py index add0c229..5a2e1a72 100644 --- a/equinix_metal/test/test_license.py +++ b/equinix_metal/test/test_license.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.license import License # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.license import License class TestLicense(unittest.TestCase): """License unit test stubs""" @@ -29,27 +26,27 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> License: """Test License include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `License` """ - model = equinix_metal.models.license.License() # noqa: E501 - if include_optional : + model = License() + if include_optional: return License( - description = '', - href = '', - id = '', - license_key = '', + description = '', + href = '', + id = '', + license_key = '', licensee_product = equinix_metal.models.href.Href( - href = '', ), + href = '', ), project = equinix_metal.models.href.Href( - href = '', ), + href = '', ), size = 1.337 ) - else : + else: return License( ) """ diff --git a/equinix_metal/test/test_license_create_input.py b/equinix_metal/test/test_license_create_input.py index 7bff7cc7..d47db075 100644 --- a/equinix_metal/test/test_license_create_input.py +++ b/equinix_metal/test/test_license_create_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.license_create_input import LicenseCreateInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.license_create_input import LicenseCreateInput class TestLicenseCreateInput(unittest.TestCase): """LicenseCreateInput unit test stubs""" @@ -29,22 +26,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> LicenseCreateInput: """Test LicenseCreateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `LicenseCreateInput` """ - model = equinix_metal.models.license_create_input.LicenseCreateInput() # noqa: E501 - if include_optional : + model = LicenseCreateInput() + if include_optional: return LicenseCreateInput( - description = '', - href = '', - licensee_product_id = '', + description = '', + href = '', + licensee_product_id = '', size = 1.337 ) - else : + else: return LicenseCreateInput( ) """ diff --git a/equinix_metal/test/test_license_list.py b/equinix_metal/test/test_license_list.py index f66f3e90..abbae925 100644 --- a/equinix_metal/test/test_license_list.py +++ b/equinix_metal/test/test_license_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.license_list import LicenseList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.license_list import LicenseList class TestLicenseList(unittest.TestCase): """LicenseList unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> LicenseList: """Test LicenseList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `LicenseList` """ - model = equinix_metal.models.license_list.LicenseList() # noqa: E501 - if include_optional : + model = LicenseList() + if include_optional: return LicenseList( - href = '', + href = '', licenses = [ equinix_metal.models.license.License( description = '', @@ -53,7 +50,7 @@ def make_instance(self, include_optional): size = 1.337, ) ] ) - else : + else: return LicenseList( ) """ diff --git a/equinix_metal/test/test_license_update_input.py b/equinix_metal/test/test_license_update_input.py index cb2792df..a0941f5c 100644 --- a/equinix_metal/test/test_license_update_input.py +++ b/equinix_metal/test/test_license_update_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.license_update_input import LicenseUpdateInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.license_update_input import LicenseUpdateInput class TestLicenseUpdateInput(unittest.TestCase): """LicenseUpdateInput unit test stubs""" @@ -29,21 +26,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> LicenseUpdateInput: """Test LicenseUpdateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `LicenseUpdateInput` """ - model = equinix_metal.models.license_update_input.LicenseUpdateInput() # noqa: E501 - if include_optional : + model = LicenseUpdateInput() + if include_optional: return LicenseUpdateInput( - description = '', - href = '', + description = '', + href = '', size = 1.337 ) - else : + else: return LicenseUpdateInput( ) """ diff --git a/equinix_metal/test/test_licenses_api.py b/equinix_metal/test/test_licenses_api.py index 06333a01..59332591 100644 --- a/equinix_metal/test/test_licenses_api.py +++ b/equinix_metal/test/test_licenses_api.py @@ -15,52 +15,50 @@ import unittest -import equinix_metal -from equinix_metal.api.licenses_api import LicensesApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.licenses_api import LicensesApi class TestLicensesApi(unittest.TestCase): """LicensesApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.licenses_api.LicensesApi() # noqa: E501 + def setUp(self) -> None: + self.api = LicensesApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_create_license(self): + def test_create_license(self) -> None: """Test case for create_license - Create a License # noqa: E501 + Create a License """ pass - def test_delete_license(self): + def test_delete_license(self) -> None: """Test case for delete_license - Delete the license # noqa: E501 + Delete the license """ pass - def test_find_license_by_id(self): + def test_find_license_by_id(self) -> None: """Test case for find_license_by_id - Retrieve a license # noqa: E501 + Retrieve a license """ pass - def test_find_project_licenses(self): + def test_find_project_licenses(self) -> None: """Test case for find_project_licenses - Retrieve all licenses # noqa: E501 + Retrieve all licenses """ pass - def test_update_license(self): + def test_update_license(self) -> None: """Test case for update_license - Update the license # noqa: E501 + Update the license """ pass diff --git a/equinix_metal/test/test_line_item.py b/equinix_metal/test/test_line_item.py index 388ccc41..4e2675f6 100644 --- a/equinix_metal/test/test_line_item.py +++ b/equinix_metal/test/test_line_item.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.line_item import LineItem # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.line_item import LineItem class TestLineItem(unittest.TestCase): """LineItem unit test stubs""" @@ -29,21 +26,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> LineItem: """Test LineItem include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `LineItem` """ - model = equinix_metal.models.line_item.LineItem() # noqa: E501 - if include_optional : + model = LineItem() + if include_optional: return LineItem( - amount = 1.337, - currency = '', - description = '', - details = '', - href = '', + amount = 1.337, + currency = '', + description = '', + details = '', + href = '', plan = equinix_metal.models.plan.Plan( available_in = [ equinix_metal.models.plan_available_in_inner.Plan_available_in_inner( @@ -101,11 +98,11 @@ class = 'm3.large.x86', href = '', type = '', ) ], ), - type = 'standard', ), - unit = '', + type = 'standard', ), + unit = '', unit_price = 1.337 ) - else : + else: return LineItem( ) """ diff --git a/equinix_metal/test/test_membership.py b/equinix_metal/test/test_membership.py index 6a4e3830..cc3903da 100644 --- a/equinix_metal/test/test_membership.py +++ b/equinix_metal/test/test_membership.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.membership import Membership # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.membership import Membership class TestMembership(unittest.TestCase): """Membership unit test stubs""" @@ -29,29 +26,29 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Membership: """Test Membership include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Membership` """ - model = equinix_metal.models.membership.Membership() # noqa: E501 - if include_optional : + model = Membership() + if include_optional: return Membership( - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - href = '', - id = '', + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + href = '', + id = '', project = equinix_metal.models.href.Href( - href = '', ), + href = '', ), roles = [ '' - ], - updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + ], + updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), user = equinix_metal.models.href.Href( href = '', ) ) - else : + else: return Membership( ) """ diff --git a/equinix_metal/test/test_membership_input.py b/equinix_metal/test/test_membership_input.py index f4ae0f45..946881e0 100644 --- a/equinix_metal/test/test_membership_input.py +++ b/equinix_metal/test/test_membership_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.membership_input import MembershipInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.membership_input import MembershipInput class TestMembershipInput(unittest.TestCase): """MembershipInput unit test stubs""" @@ -29,22 +26,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> MembershipInput: """Test MembershipInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `MembershipInput` """ - model = equinix_metal.models.membership_input.MembershipInput() # noqa: E501 - if include_optional : + model = MembershipInput() + if include_optional: return MembershipInput( - href = '', + href = '', role = [ '' ] ) - else : + else: return MembershipInput( ) """ diff --git a/equinix_metal/test/test_membership_list.py b/equinix_metal/test/test_membership_list.py index c2512bc7..64fc7d32 100644 --- a/equinix_metal/test/test_membership_list.py +++ b/equinix_metal/test/test_membership_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.membership_list import MembershipList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.membership_list import MembershipList class TestMembershipList(unittest.TestCase): """MembershipList unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> MembershipList: """Test MembershipList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `MembershipList` """ - model = equinix_metal.models.membership_list.MembershipList() # noqa: E501 - if include_optional : + model = MembershipList() + if include_optional: return MembershipList( - href = '', + href = '', memberships = [ equinix_metal.models.membership.Membership( created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), @@ -55,7 +52,7 @@ def make_instance(self, include_optional): href = '', ), ) ] ) - else : + else: return MembershipList( ) """ diff --git a/equinix_metal/test/test_memberships_api.py b/equinix_metal/test/test_memberships_api.py index d32e5121..04d1af57 100644 --- a/equinix_metal/test/test_memberships_api.py +++ b/equinix_metal/test/test_memberships_api.py @@ -15,38 +15,36 @@ import unittest -import equinix_metal -from equinix_metal.api.memberships_api import MembershipsApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.memberships_api import MembershipsApi class TestMembershipsApi(unittest.TestCase): """MembershipsApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.memberships_api.MembershipsApi() # noqa: E501 + def setUp(self) -> None: + self.api = MembershipsApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_delete_membership(self): + def test_delete_membership(self) -> None: """Test case for delete_membership - Delete the membership # noqa: E501 + Delete the membership """ pass - def test_find_membership_by_id(self): + def test_find_membership_by_id(self) -> None: """Test case for find_membership_by_id - Retrieve a membership # noqa: E501 + Retrieve a membership """ pass - def test_update_membership(self): + def test_update_membership(self) -> None: """Test case for update_membership - Update the membership # noqa: E501 + Update the membership """ pass diff --git a/equinix_metal/test/test_meta.py b/equinix_metal/test/test_meta.py index dd325326..f92a613c 100644 --- a/equinix_metal/test/test_meta.py +++ b/equinix_metal/test/test_meta.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.meta import Meta # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.meta import Meta class TestMeta(unittest.TestCase): """Meta unit test stubs""" @@ -29,32 +26,32 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Meta: """Test Meta include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Meta` """ - model = equinix_metal.models.meta.Meta() # noqa: E501 - if include_optional : + model = Meta() + if include_optional: return Meta( - current_page = 56, + current_page = 56, first = equinix_metal.models.href.Href( - href = '', ), - href = '', + href = '', ), + href = '', last = equinix_metal.models.href.Href( - href = '', ), - last_page = 56, + href = '', ), + last_page = 56, next = equinix_metal.models.href.Href( - href = '', ), + href = '', ), previous = equinix_metal.models.href.Href( - href = '', ), + href = '', ), var_self = equinix_metal.models.href.Href( - href = '', ), + href = '', ), total = 56 ) - else : + else: return Meta( ) """ diff --git a/equinix_metal/test/test_metadata.py b/equinix_metal/test/test_metadata.py index 22655ed7..be3af26e 100644 --- a/equinix_metal/test/test_metadata.py +++ b/equinix_metal/test/test_metadata.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.metadata import Metadata # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.metadata import Metadata class TestMetadata(unittest.TestCase): """Metadata unit test stubs""" @@ -29,24 +26,24 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Metadata: """Test Metadata include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Metadata` """ - model = equinix_metal.models.metadata.Metadata() # noqa: E501 - if include_optional : + model = Metadata() + if include_optional: return Metadata( - var_class = '', - customdata = { }, - facility = '', - hostname = '', - href = '', - id = '', - iqn = '', - metro = '', + var_class = '', + customdata = { }, + facility = '', + hostname = '', + href = '', + id = '', + iqn = '', + metro = '', network = equinix_metal.models.metadata_network.Metadata_network( addresses = [ '' @@ -61,27 +58,27 @@ def make_instance(self, include_optional): link_aggregation = '', mac = '', mode = 56, ), - href = '', ), ), - operating_system = None, - plan = '', + href = '', ), ), + operating_system = None, + plan = '', private_subnets = [ '' - ], - reserved = True, - specs = None, + ], + reserved = True, + specs = None, ssh_keys = [ '' - ], - state = 'queued', - switch_short_id = '', + ], + state = 'queued', + switch_short_id = '', tags = [ '' - ], + ], volumes = [ '' ] ) - else : + else: return Metadata( ) """ diff --git a/equinix_metal/test/test_metadata_network.py b/equinix_metal/test/test_metadata_network.py index 5a04bbaa..c00defb7 100644 --- a/equinix_metal/test/test_metadata_network.py +++ b/equinix_metal/test/test_metadata_network.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.metadata_network import MetadataNetwork # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.metadata_network import MetadataNetwork class TestMetadataNetwork(unittest.TestCase): """MetadataNetwork unit test stubs""" @@ -29,23 +26,23 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> MetadataNetwork: """Test MetadataNetwork include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `MetadataNetwork` """ - model = equinix_metal.models.metadata_network.MetadataNetwork() # noqa: E501 - if include_optional : + model = MetadataNetwork() + if include_optional: return MetadataNetwork( addresses = [ '' - ], - href = '', + ], + href = '', interfaces = [ None - ], + ], network = equinix_metal.models.metadata_network_network.Metadata_network_network( bonding = equinix_metal.models.metadata_network_network_bonding.Metadata_network_network_bonding( href = '', @@ -54,7 +51,7 @@ def make_instance(self, include_optional): mode = 56, ), href = '', ) ) - else : + else: return MetadataNetwork( ) """ diff --git a/equinix_metal/test/test_metadata_network_network.py b/equinix_metal/test/test_metadata_network_network.py index 25a35ba6..76bf9dba 100644 --- a/equinix_metal/test/test_metadata_network_network.py +++ b/equinix_metal/test/test_metadata_network_network.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.metadata_network_network import MetadataNetworkNetwork # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.metadata_network_network import MetadataNetworkNetwork class TestMetadataNetworkNetwork(unittest.TestCase): """MetadataNetworkNetwork unit test stubs""" @@ -29,24 +26,24 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> MetadataNetworkNetwork: """Test MetadataNetworkNetwork include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `MetadataNetworkNetwork` """ - model = equinix_metal.models.metadata_network_network.MetadataNetworkNetwork() # noqa: E501 - if include_optional : + model = MetadataNetworkNetwork() + if include_optional: return MetadataNetworkNetwork( bonding = equinix_metal.models.metadata_network_network_bonding.Metadata_network_network_bonding( href = '', link_aggregation = '', mac = '', - mode = 56, ), + mode = 56, ), href = '' ) - else : + else: return MetadataNetworkNetwork( ) """ diff --git a/equinix_metal/test/test_metadata_network_network_bonding.py b/equinix_metal/test/test_metadata_network_network_bonding.py index d0b5a18b..69b760ca 100644 --- a/equinix_metal/test/test_metadata_network_network_bonding.py +++ b/equinix_metal/test/test_metadata_network_network_bonding.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.metadata_network_network_bonding import MetadataNetworkNetworkBonding # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.metadata_network_network_bonding import MetadataNetworkNetworkBonding class TestMetadataNetworkNetworkBonding(unittest.TestCase): """MetadataNetworkNetworkBonding unit test stubs""" @@ -29,22 +26,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> MetadataNetworkNetworkBonding: """Test MetadataNetworkNetworkBonding include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `MetadataNetworkNetworkBonding` """ - model = equinix_metal.models.metadata_network_network_bonding.MetadataNetworkNetworkBonding() # noqa: E501 - if include_optional : + model = MetadataNetworkNetworkBonding() + if include_optional: return MetadataNetworkNetworkBonding( - href = '', - link_aggregation = '', - mac = '', + href = '', + link_aggregation = '', + mac = '', mode = 56 ) - else : + else: return MetadataNetworkNetworkBonding( ) """ diff --git a/equinix_metal/test/test_metal_gateway.py b/equinix_metal/test/test_metal_gateway.py index 77d8eca9..401fbf79 100644 --- a/equinix_metal/test/test_metal_gateway.py +++ b/equinix_metal/test/test_metal_gateway.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.metal_gateway import MetalGateway # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.metal_gateway import MetalGateway class TestMetalGateway(unittest.TestCase): """MetalGateway unit test stubs""" @@ -29,21 +26,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> MetalGateway: """Test MetalGateway include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `MetalGateway` """ - model = equinix_metal.models.metal_gateway.MetalGateway() # noqa: E501 - if include_optional : + model = MetalGateway() + if include_optional: return MetalGateway( - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), created_by = equinix_metal.models.href.Href( - href = '', ), - href = '', - id = '', + href = '', ), + href = '', + id = '', ip_reservation = equinix_metal.models.ip_reservation.IPReservation( addon = True, address = '', @@ -120,7 +117,7 @@ def make_instance(self, include_optional): tags = [ '' ], - type = 'global_ipv4', ), + type = 'global_ipv4', ), project = equinix_metal.models.project.Project( backend_transfer_enabled = True, bgp_config = equinix_metal.models.href.Href( @@ -157,9 +154,9 @@ def make_instance(self, include_optional): updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), volumes = [ - ], ), - state = 'ready', - updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + ], ), + state = 'ready', + updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), virtual_network = equinix_metal.models.virtual_network.VirtualNetwork( assigned_to = equinix_metal.models.href.Href( href = '', ), @@ -189,7 +186,7 @@ def make_instance(self, include_optional): ], vxlan = 56, ) ) - else : + else: return MetalGateway( ) """ diff --git a/equinix_metal/test/test_metal_gateway_create_input.py b/equinix_metal/test/test_metal_gateway_create_input.py index 9eaeeac8..99de8606 100644 --- a/equinix_metal/test/test_metal_gateway_create_input.py +++ b/equinix_metal/test/test_metal_gateway_create_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.metal_gateway_create_input import MetalGatewayCreateInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.metal_gateway_create_input import MetalGatewayCreateInput class TestMetalGatewayCreateInput(unittest.TestCase): """MetalGatewayCreateInput unit test stubs""" @@ -29,22 +26,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> MetalGatewayCreateInput: """Test MetalGatewayCreateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `MetalGatewayCreateInput` """ - model = equinix_metal.models.metal_gateway_create_input.MetalGatewayCreateInput() # noqa: E501 - if include_optional : + model = MetalGatewayCreateInput() + if include_optional: return MetalGatewayCreateInput( - href = '', - ip_reservation_id = '', - private_ipv4_subnet_size = 56, + href = '', + ip_reservation_id = '', + private_ipv4_subnet_size = 56, virtual_network_id = '' ) - else : + else: return MetalGatewayCreateInput( virtual_network_id = '', ) diff --git a/equinix_metal/test/test_metal_gateway_elastic_ip_create_input.py b/equinix_metal/test/test_metal_gateway_elastic_ip_create_input.py index 72a02e52..680475ac 100644 --- a/equinix_metal/test/test_metal_gateway_elastic_ip_create_input.py +++ b/equinix_metal/test/test_metal_gateway_elastic_ip_create_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.metal_gateway_elastic_ip_create_input import MetalGatewayElasticIpCreateInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.metal_gateway_elastic_ip_create_input import MetalGatewayElasticIpCreateInput class TestMetalGatewayElasticIpCreateInput(unittest.TestCase): """MetalGatewayElasticIpCreateInput unit test stubs""" @@ -29,23 +26,23 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> MetalGatewayElasticIpCreateInput: """Test MetalGatewayElasticIpCreateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `MetalGatewayElasticIpCreateInput` """ - model = equinix_metal.models.metal_gateway_elastic_ip_create_input.MetalGatewayElasticIpCreateInput() # noqa: E501 - if include_optional : + model = MetalGatewayElasticIpCreateInput() + if include_optional: return MetalGatewayElasticIpCreateInput( - address = '147.75.234.8/31', - customdata = { }, - href = '', - next_hop = '192.168.12.13', + address = '147.75.234.8/31', + customdata = { }, + href = '', + next_hop = '192.168.12.13', tags = ["NY","prod","public"] ) - else : + else: return MetalGatewayElasticIpCreateInput( address = '147.75.234.8/31', next_hop = '192.168.12.13', diff --git a/equinix_metal/test/test_metal_gateway_list.py b/equinix_metal/test/test_metal_gateway_list.py index 2b6887ca..583bc1dc 100644 --- a/equinix_metal/test/test_metal_gateway_list.py +++ b/equinix_metal/test/test_metal_gateway_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.metal_gateway_list import MetalGatewayList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.metal_gateway_list import MetalGatewayList class TestMetalGatewayList(unittest.TestCase): """MetalGatewayList unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> MetalGatewayList: """Test MetalGatewayList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `MetalGatewayList` """ - model = equinix_metal.models.metal_gateway_list.MetalGatewayList() # noqa: E501 - if include_optional : + model = MetalGatewayList() + if include_optional: return MetalGatewayList( - href = '', + href = '', meta = equinix_metal.models.meta.Meta( current_page = 56, first = equinix_metal.models.href.Href( @@ -51,12 +48,12 @@ def make_instance(self, include_optional): next = , previous = , self = , - total = 56, ), + total = 56, ), metal_gateways = [ null ] ) - else : + else: return MetalGatewayList( ) """ diff --git a/equinix_metal/test/test_metal_gateway_list_metal_gateways_inner.py b/equinix_metal/test/test_metal_gateway_list_metal_gateways_inner.py index 258aa5f2..6bee8080 100644 --- a/equinix_metal/test/test_metal_gateway_list_metal_gateways_inner.py +++ b/equinix_metal/test/test_metal_gateway_list_metal_gateways_inner.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.metal_gateway_list_metal_gateways_inner import MetalGatewayListMetalGatewaysInner # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.metal_gateway_list_metal_gateways_inner import MetalGatewayListMetalGatewaysInner class TestMetalGatewayListMetalGatewaysInner(unittest.TestCase): """MetalGatewayListMetalGatewaysInner unit test stubs""" @@ -29,21 +26,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> MetalGatewayListMetalGatewaysInner: """Test MetalGatewayListMetalGatewaysInner include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `MetalGatewayListMetalGatewaysInner` """ - model = equinix_metal.models.metal_gateway_list_metal_gateways_inner.MetalGatewayListMetalGatewaysInner() # noqa: E501 - if include_optional : + model = MetalGatewayListMetalGatewaysInner() + if include_optional: return MetalGatewayListMetalGatewaysInner( - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), created_by = equinix_metal.models.href.Href( - href = '', ), - href = '', - id = '', + href = '', ), + href = '', + id = '', ip_reservation = equinix_metal.models.vrf_ip_reservation.VrfIpReservation( address = '', address_family = 56, @@ -173,7 +170,7 @@ def make_instance(self, include_optional): local_asn = 56, name = '', updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), ), ) - ], ), ), + ], ), ), project = equinix_metal.models.project.Project( backend_transfer_enabled = True, bgp_config = equinix_metal.models.href.Href( @@ -210,9 +207,9 @@ def make_instance(self, include_optional): updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), volumes = [ - ], ), - state = 'ready', - updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + ], ), + state = 'ready', + updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), virtual_network = equinix_metal.models.virtual_network.VirtualNetwork( assigned_to = equinix_metal.models.href.Href( href = '', ), @@ -240,7 +237,7 @@ def make_instance(self, include_optional): tags = [ '' ], - vxlan = 56, ), + vxlan = 56, ), vrf = equinix_metal.models.vrf.Vrf( bgp_dynamic_neighbors_bfd_enabled = True, bgp_dynamic_neighbors_enabled = True, @@ -359,7 +356,7 @@ def make_instance(self, include_optional): updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), ), ) ], ) ) - else : + else: return MetalGatewayListMetalGatewaysInner( ) """ diff --git a/equinix_metal/test/test_metal_gateway_lite.py b/equinix_metal/test/test_metal_gateway_lite.py index 6c2e1e6c..6ba5f5f8 100644 --- a/equinix_metal/test/test_metal_gateway_lite.py +++ b/equinix_metal/test/test_metal_gateway_lite.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.metal_gateway_lite import MetalGatewayLite # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.metal_gateway_lite import MetalGatewayLite class TestMetalGatewayLite(unittest.TestCase): """MetalGatewayLite unit test stubs""" @@ -29,25 +26,25 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> MetalGatewayLite: """Test MetalGatewayLite include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `MetalGatewayLite` """ - model = equinix_metal.models.metal_gateway_lite.MetalGatewayLite() # noqa: E501 - if include_optional : + model = MetalGatewayLite() + if include_optional: return MetalGatewayLite( - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - gateway_address = '10.1.2.1/27', - href = '', - id = '', - state = 'ready', - updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + gateway_address = '10.1.2.1/27', + href = '', + id = '', + state = 'ready', + updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), vlan = 1001 ) - else : + else: return MetalGatewayLite( ) """ diff --git a/equinix_metal/test/test_metal_gateways_api.py b/equinix_metal/test/test_metal_gateways_api.py index c198986d..f89e70b8 100644 --- a/equinix_metal/test/test_metal_gateways_api.py +++ b/equinix_metal/test/test_metal_gateways_api.py @@ -15,52 +15,50 @@ import unittest -import equinix_metal -from equinix_metal.api.metal_gateways_api import MetalGatewaysApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.metal_gateways_api import MetalGatewaysApi class TestMetalGatewaysApi(unittest.TestCase): """MetalGatewaysApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.metal_gateways_api.MetalGatewaysApi() # noqa: E501 + def setUp(self) -> None: + self.api = MetalGatewaysApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_create_metal_gateway(self): + def test_create_metal_gateway(self) -> None: """Test case for create_metal_gateway - Create a metal gateway # noqa: E501 + Create a metal gateway """ pass - def test_create_metal_gateway_elastic_ip(self): + def test_create_metal_gateway_elastic_ip(self) -> None: """Test case for create_metal_gateway_elastic_ip - Create a Metal Gateway Elastic IP # noqa: E501 + Create a Metal Gateway Elastic IP """ pass - def test_delete_metal_gateway(self): + def test_delete_metal_gateway(self) -> None: """Test case for delete_metal_gateway - Deletes the metal gateway # noqa: E501 + Deletes the metal gateway """ pass - def test_find_metal_gateway_by_id(self): + def test_find_metal_gateway_by_id(self) -> None: """Test case for find_metal_gateway_by_id - Returns the metal gateway # noqa: E501 + Returns the metal gateway """ pass - def test_find_metal_gateways_by_project(self): + def test_find_metal_gateways_by_project(self) -> None: """Test case for find_metal_gateways_by_project - Returns all metal gateways for a project # noqa: E501 + Returns all metal gateways for a project """ pass @@ -71,10 +69,10 @@ def test_find_metal_gateways_by_project_all_pages(self): """ pass - def test_get_metal_gateway_elastic_ips(self): + def test_get_metal_gateway_elastic_ips(self) -> None: """Test case for get_metal_gateway_elastic_ips - List Metal Gateway Elastic IPs # noqa: E501 + List Metal Gateway Elastic IPs """ pass diff --git a/equinix_metal/test/test_metro.py b/equinix_metal/test/test_metro.py index f4df6683..3c15f024 100644 --- a/equinix_metal/test/test_metro.py +++ b/equinix_metal/test/test_metro.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.metro import Metro # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.metro import Metro class TestMetro(unittest.TestCase): """Metro unit test stubs""" @@ -29,23 +26,23 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Metro: """Test Metro include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Metro` """ - model = equinix_metal.models.metro.Metro() # noqa: E501 - if include_optional : + model = Metro() + if include_optional: return Metro( - code = '', - country = '', - href = '', - id = '', + code = '', + country = '', + href = '', + id = '', name = '' ) - else : + else: return Metro( ) """ diff --git a/equinix_metal/test/test_metro_input.py b/equinix_metal/test/test_metro_input.py index 69d3b50f..906b883c 100644 --- a/equinix_metal/test/test_metro_input.py +++ b/equinix_metal/test/test_metro_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.metro_input import MetroInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.metro_input import MetroInput class TestMetroInput(unittest.TestCase): """MetroInput unit test stubs""" @@ -29,20 +26,20 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> MetroInput: """Test MetroInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `MetroInput` """ - model = equinix_metal.models.metro_input.MetroInput() # noqa: E501 - if include_optional : + model = MetroInput() + if include_optional: return MetroInput( - href = '', + href = '', metro = 'sv' ) - else : + else: return MetroInput( metro = 'sv', ) diff --git a/equinix_metal/test/test_metro_list.py b/equinix_metal/test/test_metro_list.py index e228a8bc..671d4a72 100644 --- a/equinix_metal/test/test_metro_list.py +++ b/equinix_metal/test/test_metro_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.metro_list import MetroList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.metro_list import MetroList class TestMetroList(unittest.TestCase): """MetroList unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> MetroList: """Test MetroList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `MetroList` """ - model = equinix_metal.models.metro_list.MetroList() # noqa: E501 - if include_optional : + model = MetroList() + if include_optional: return MetroList( - href = '', + href = '', metros = [ equinix_metal.models.metro.Metro( code = '', @@ -49,7 +46,7 @@ def make_instance(self, include_optional): name = '', ) ] ) - else : + else: return MetroList( ) """ diff --git a/equinix_metal/test/test_metros_api.py b/equinix_metal/test/test_metros_api.py index 4e78e568..b4aab652 100644 --- a/equinix_metal/test/test_metros_api.py +++ b/equinix_metal/test/test_metros_api.py @@ -15,31 +15,29 @@ import unittest -import equinix_metal -from equinix_metal.api.metros_api import MetrosApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.metros_api import MetrosApi class TestMetrosApi(unittest.TestCase): """MetrosApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.metros_api.MetrosApi() # noqa: E501 + def setUp(self) -> None: + self.api = MetrosApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_find_metros(self): + def test_find_metros(self) -> None: """Test case for find_metros - Retrieve all metros # noqa: E501 + Retrieve all metros """ pass - def test_get_metro(self): + def test_get_metro(self) -> None: """Test case for get_metro - Retrieve a specific Metro's details # noqa: E501 + Retrieve a specific Metro's details """ pass diff --git a/equinix_metal/test/test_mount.py b/equinix_metal/test/test_mount.py index d836e9e7..f05b3230 100644 --- a/equinix_metal/test/test_mount.py +++ b/equinix_metal/test/test_mount.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.mount import Mount # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.mount import Mount class TestMount(unittest.TestCase): """Mount unit test stubs""" @@ -29,25 +26,25 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Mount: """Test Mount include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Mount` """ - model = equinix_metal.models.mount.Mount() # noqa: E501 - if include_optional : + model = Mount() + if include_optional: return Mount( - device = '', - format = '', - href = '', + device = '', + format = '', + href = '', options = [ '' - ], + ], point = '' ) - else : + else: return Mount( ) """ diff --git a/equinix_metal/test/test_move_hardware_reservation_request.py b/equinix_metal/test/test_move_hardware_reservation_request.py index 96c74bf1..9ff27615 100644 --- a/equinix_metal/test/test_move_hardware_reservation_request.py +++ b/equinix_metal/test/test_move_hardware_reservation_request.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.move_hardware_reservation_request import MoveHardwareReservationRequest # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.move_hardware_reservation_request import MoveHardwareReservationRequest class TestMoveHardwareReservationRequest(unittest.TestCase): """MoveHardwareReservationRequest unit test stubs""" @@ -29,20 +26,20 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> MoveHardwareReservationRequest: """Test MoveHardwareReservationRequest include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `MoveHardwareReservationRequest` """ - model = equinix_metal.models.move_hardware_reservation_request.MoveHardwareReservationRequest() # noqa: E501 - if include_optional : + model = MoveHardwareReservationRequest() + if include_optional: return MoveHardwareReservationRequest( - href = '', + href = '', project_id = '' ) - else : + else: return MoveHardwareReservationRequest( ) """ diff --git a/equinix_metal/test/test_new_password.py b/equinix_metal/test/test_new_password.py index e675f7fb..9a15fa33 100644 --- a/equinix_metal/test/test_new_password.py +++ b/equinix_metal/test/test_new_password.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.new_password import NewPassword # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.new_password import NewPassword class TestNewPassword(unittest.TestCase): """NewPassword unit test stubs""" @@ -29,20 +26,20 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> NewPassword: """Test NewPassword include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `NewPassword` """ - model = equinix_metal.models.new_password.NewPassword() # noqa: E501 - if include_optional : + model = NewPassword() + if include_optional: return NewPassword( - href = '', + href = '', new_password = '' ) - else : + else: return NewPassword( ) """ diff --git a/equinix_metal/test/test_operating_system.py b/equinix_metal/test/test_operating_system.py index 73313a4d..a461cf62 100644 --- a/equinix_metal/test/test_operating_system.py +++ b/equinix_metal/test/test_operating_system.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.operating_system import OperatingSystem # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.operating_system import OperatingSystem class TestOperatingSystem(unittest.TestCase): """OperatingSystem unit test stubs""" @@ -29,32 +26,32 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> OperatingSystem: """Test OperatingSystem include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `OperatingSystem` """ - model = equinix_metal.models.operating_system.OperatingSystem() # noqa: E501 - if include_optional : + model = OperatingSystem() + if include_optional: return OperatingSystem( - default_operating_system = True, - distro = '', - distro_label = '', - href = '', - id = '', - licensed = True, - name = '', - preinstallable = True, - pricing = equinix_metal.models.pricing.pricing(), + default_operating_system = True, + distro = '', + distro_label = '', + href = '', + id = '', + licensed = True, + name = '', + preinstallable = True, + pricing = equinix_metal.models.pricing.pricing(), provisionable_on = [ '' - ], - slug = '', + ], + slug = '', version = '' ) - else : + else: return OperatingSystem( ) """ diff --git a/equinix_metal/test/test_operating_system_list.py b/equinix_metal/test/test_operating_system_list.py index 83be70f6..059f91ce 100644 --- a/equinix_metal/test/test_operating_system_list.py +++ b/equinix_metal/test/test_operating_system_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.operating_system_list import OperatingSystemList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.operating_system_list import OperatingSystemList class TestOperatingSystemList(unittest.TestCase): """OperatingSystemList unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> OperatingSystemList: """Test OperatingSystemList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `OperatingSystemList` """ - model = equinix_metal.models.operating_system_list.OperatingSystemList() # noqa: E501 - if include_optional : + model = OperatingSystemList() + if include_optional: return OperatingSystemList( - href = '', + href = '', operating_systems = [ equinix_metal.models.operating_system.OperatingSystem( default_operating_system = True, @@ -58,7 +55,7 @@ def make_instance(self, include_optional): version = '', ) ] ) - else : + else: return OperatingSystemList( ) """ diff --git a/equinix_metal/test/test_operating_systems_api.py b/equinix_metal/test/test_operating_systems_api.py index 54276e4f..a2eaa934 100644 --- a/equinix_metal/test/test_operating_systems_api.py +++ b/equinix_metal/test/test_operating_systems_api.py @@ -15,31 +15,29 @@ import unittest -import equinix_metal -from equinix_metal.api.operating_systems_api import OperatingSystemsApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.operating_systems_api import OperatingSystemsApi class TestOperatingSystemsApi(unittest.TestCase): """OperatingSystemsApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.operating_systems_api.OperatingSystemsApi() # noqa: E501 + def setUp(self) -> None: + self.api = OperatingSystemsApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_find_operating_system_version(self): + def test_find_operating_system_version(self) -> None: """Test case for find_operating_system_version - Retrieve all operating system versions # noqa: E501 + Retrieve all operating system versions """ pass - def test_find_operating_systems(self): + def test_find_operating_systems(self) -> None: """Test case for find_operating_systems - Retrieve all operating systems # noqa: E501 + Retrieve all operating systems """ pass diff --git a/equinix_metal/test/test_organization.py b/equinix_metal/test/test_organization.py index a249e980..91667d05 100644 --- a/equinix_metal/test/test_organization.py +++ b/equinix_metal/test/test_organization.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.organization import Organization # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.organization import Organization class TestOrganization(unittest.TestCase): """Organization unit test stubs""" @@ -29,15 +26,15 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Organization: """Test Organization include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Organization` """ - model = equinix_metal.models.organization.Organization() # noqa: E501 - if include_optional : + model = Organization() + if include_optional: return Organization( address = equinix_metal.models.address.Address( address = '', @@ -50,7 +47,7 @@ def make_instance(self, include_optional): country = '', href = '', state = '', - zip_code = '', ), + zip_code = '', ), billing_address = equinix_metal.models.address.Address( address = '', address2 = '', @@ -62,34 +59,34 @@ def make_instance(self, include_optional): country = '', href = '', state = '', - zip_code = '', ), - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - credit_amount = 1.337, - customdata = None, - description = '', - enforce_2fa_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - href = '', - id = '', - logo = '', + zip_code = '', ), + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + credit_amount = 1.337, + customdata = None, + description = '', + enforce_2fa_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + href = '', + id = '', + logo = '', members = [ equinix_metal.models.href.Href( href = '', ) - ], + ], memberships = [ equinix_metal.models.href.Href( href = '', ) - ], - name = '', + ], + name = '', projects = [ equinix_metal.models.href.Href( href = '', ) - ], - terms = 56, - twitter = '', - updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + ], + terms = 56, + twitter = '', + updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), website = '' ) - else : + else: return Organization( ) """ diff --git a/equinix_metal/test/test_organization_input.py b/equinix_metal/test/test_organization_input.py index da8bdd64..86742da1 100644 --- a/equinix_metal/test/test_organization_input.py +++ b/equinix_metal/test/test_organization_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.organization_input import OrganizationInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.organization_input import OrganizationInput class TestOrganizationInput(unittest.TestCase): """OrganizationInput unit test stubs""" @@ -29,15 +26,15 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> OrganizationInput: """Test OrganizationInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `OrganizationInput` """ - model = equinix_metal.models.organization_input.OrganizationInput() # noqa: E501 - if include_optional : + model = OrganizationInput() + if include_optional: return OrganizationInput( address = equinix_metal.models.address.Address( address = '', @@ -50,7 +47,7 @@ def make_instance(self, include_optional): country = '', href = '', state = '', - zip_code = '', ), + zip_code = '', ), billing_address = equinix_metal.models.address.Address( address = '', address2 = '', @@ -62,17 +59,17 @@ def make_instance(self, include_optional): country = '', href = '', state = '', - zip_code = '', ), - customdata = None, - description = '', - enforce_2fa_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - href = '', - logo = 'YQ==', - name = '', - twitter = '', + zip_code = '', ), + customdata = None, + description = '', + enforce_2fa_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + href = '', + logo = 'YQ==', + name = '', + twitter = '', website = '' ) - else : + else: return OrganizationInput( ) """ diff --git a/equinix_metal/test/test_organization_list.py b/equinix_metal/test/test_organization_list.py index 7a75b291..1f07c22c 100644 --- a/equinix_metal/test/test_organization_list.py +++ b/equinix_metal/test/test_organization_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.organization_list import OrganizationList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.organization_list import OrganizationList class TestOrganizationList(unittest.TestCase): """OrganizationList unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> OrganizationList: """Test OrganizationList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `OrganizationList` """ - model = equinix_metal.models.organization_list.OrganizationList() # noqa: E501 - if include_optional : + model = OrganizationList() + if include_optional: return OrganizationList( - href = '', + href = '', meta = equinix_metal.models.meta.Meta( current_page = 56, first = equinix_metal.models.href.Href( @@ -51,7 +48,7 @@ def make_instance(self, include_optional): next = , previous = , self = , - total = 56, ), + total = 56, ), organizations = [ equinix_metal.models.organization.Organization( address = equinix_metal.models.address.Address( @@ -98,7 +95,7 @@ def make_instance(self, include_optional): website = '', ) ] ) - else : + else: return OrganizationList( ) """ diff --git a/equinix_metal/test/test_organizations_api.py b/equinix_metal/test/test_organizations_api.py index 8fb86fe1..54aed36b 100644 --- a/equinix_metal/test/test_organizations_api.py +++ b/equinix_metal/test/test_organizations_api.py @@ -15,94 +15,92 @@ import unittest -import equinix_metal -from equinix_metal.api.organizations_api import OrganizationsApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.organizations_api import OrganizationsApi class TestOrganizationsApi(unittest.TestCase): """OrganizationsApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.organizations_api.OrganizationsApi() # noqa: E501 + def setUp(self) -> None: + self.api = OrganizationsApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_create_organization(self): + def test_create_organization(self) -> None: """Test case for create_organization - Create an organization # noqa: E501 + Create an organization """ pass - def test_create_organization_invitation(self): + def test_create_organization_invitation(self) -> None: """Test case for create_organization_invitation - Create an invitation for an organization # noqa: E501 + Create an invitation for an organization """ pass - def test_create_organization_project(self): + def test_create_organization_project(self) -> None: """Test case for create_organization_project - Create a project for the organization # noqa: E501 + Create a project for the organization """ pass - def test_create_payment_method(self): + def test_create_payment_method(self) -> None: """Test case for create_payment_method - Create a payment method for the given organization # noqa: E501 + Create a payment method for the given organization """ pass - def test_delete_organization(self): + def test_delete_organization(self) -> None: """Test case for delete_organization - Delete the organization # noqa: E501 + Delete the organization """ pass - def test_find_operating_systems_by_organization(self): + def test_find_operating_systems_by_organization(self) -> None: """Test case for find_operating_systems_by_organization - Retrieve all operating systems visible by the organization # noqa: E501 + Retrieve all operating systems visible by the organization """ pass - def test_find_organization_by_id(self): + def test_find_organization_by_id(self) -> None: """Test case for find_organization_by_id - Retrieve an organization's details # noqa: E501 + Retrieve an organization's details """ pass - def test_find_organization_customdata(self): + def test_find_organization_customdata(self) -> None: """Test case for find_organization_customdata - Retrieve the custom metadata of an organization # noqa: E501 + Retrieve the custom metadata of an organization """ pass - def test_find_organization_invitations(self): + def test_find_organization_invitations(self) -> None: """Test case for find_organization_invitations - Retrieve organization invitations # noqa: E501 + Retrieve organization invitations """ pass - def test_find_organization_payment_methods(self): + def test_find_organization_payment_methods(self) -> None: """Test case for find_organization_payment_methods - Retrieve all payment methods of an organization # noqa: E501 + Retrieve all payment methods of an organization """ pass - def test_find_organization_projects(self): + def test_find_organization_projects(self) -> None: """Test case for find_organization_projects - Retrieve all projects of an organization # noqa: E501 + Retrieve all projects of an organization """ pass @@ -113,17 +111,17 @@ def test_find_organization_projects_all_pages(self): """ pass - def test_find_organization_transfers(self): + def test_find_organization_transfers(self) -> None: """Test case for find_organization_transfers - Retrieve all project transfer requests from or to an organization # noqa: E501 + Retrieve all project transfer requests from or to an organization """ pass - def test_find_organizations(self): + def test_find_organizations(self) -> None: """Test case for find_organizations - Retrieve all organizations # noqa: E501 + Retrieve all organizations """ pass @@ -134,17 +132,17 @@ def test_find_organizations_all_pages(self): """ pass - def test_find_plans_by_organization(self): + def test_find_plans_by_organization(self) -> None: """Test case for find_plans_by_organization - Retrieve all plans visible by the organization # noqa: E501 + Retrieve all plans visible by the organization """ pass - def test_update_organization(self): + def test_update_organization(self) -> None: """Test case for update_organization - Update the organization # noqa: E501 + Update the organization """ pass diff --git a/equinix_metal/test/test_otps_api.py b/equinix_metal/test/test_otps_api.py index 9da9dc92..f5c80903 100644 --- a/equinix_metal/test/test_otps_api.py +++ b/equinix_metal/test/test_otps_api.py @@ -15,45 +15,43 @@ import unittest -import equinix_metal -from equinix_metal.api.otps_api import OTPsApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.otps_api import OTPsApi class TestOTPsApi(unittest.TestCase): """OTPsApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.otps_api.OTPsApi() # noqa: E501 + def setUp(self) -> None: + self.api = OTPsApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_find_ensure_otp(self): + def test_find_ensure_otp(self) -> None: """Test case for find_ensure_otp - Verify user by providing an OTP # noqa: E501 + Verify user by providing an OTP """ pass - def test_find_recovery_codes(self): + def test_find_recovery_codes(self) -> None: """Test case for find_recovery_codes - Retrieve my recovery codes # noqa: E501 + Retrieve my recovery codes """ pass - def test_receive_codes(self): + def test_receive_codes(self) -> None: """Test case for receive_codes - Receive an OTP per sms # noqa: E501 + Receive an OTP per sms """ pass - def test_regenerate_codes(self): + def test_regenerate_codes(self) -> None: """Test case for regenerate_codes - Generate new recovery codes # noqa: E501 + Generate new recovery codes """ pass diff --git a/equinix_metal/test/test_parent_block.py b/equinix_metal/test/test_parent_block.py index e1af4a18..1a91841f 100644 --- a/equinix_metal/test/test_parent_block.py +++ b/equinix_metal/test/test_parent_block.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.parent_block import ParentBlock # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.parent_block import ParentBlock class TestParentBlock(unittest.TestCase): """ParentBlock unit test stubs""" @@ -29,22 +26,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> ParentBlock: """Test ParentBlock include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `ParentBlock` """ - model = equinix_metal.models.parent_block.ParentBlock() # noqa: E501 - if include_optional : + model = ParentBlock() + if include_optional: return ParentBlock( - cidr = 56, - href = '', - netmask = '', + cidr = 56, + href = '', + netmask = '', network = '' ) - else : + else: return ParentBlock( ) """ diff --git a/equinix_metal/test/test_partition.py b/equinix_metal/test/test_partition.py index 88ac268c..cf27493f 100644 --- a/equinix_metal/test/test_partition.py +++ b/equinix_metal/test/test_partition.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.partition import Partition # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.partition import Partition class TestPartition(unittest.TestCase): """Partition unit test stubs""" @@ -29,22 +26,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Partition: """Test Partition include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Partition` """ - model = equinix_metal.models.partition.Partition() # noqa: E501 - if include_optional : + model = Partition() + if include_optional: return Partition( - href = '', - label = '', - number = 56, + href = '', + label = '', + number = 56, size = '' ) - else : + else: return Partition( ) """ diff --git a/equinix_metal/test/test_password_reset_tokens_api.py b/equinix_metal/test/test_password_reset_tokens_api.py index 90ef38f0..1b322000 100644 --- a/equinix_metal/test/test_password_reset_tokens_api.py +++ b/equinix_metal/test/test_password_reset_tokens_api.py @@ -15,31 +15,29 @@ import unittest -import equinix_metal -from equinix_metal.api.password_reset_tokens_api import PasswordResetTokensApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.password_reset_tokens_api import PasswordResetTokensApi class TestPasswordResetTokensApi(unittest.TestCase): """PasswordResetTokensApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.password_reset_tokens_api.PasswordResetTokensApi() # noqa: E501 + def setUp(self) -> None: + self.api = PasswordResetTokensApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_create_password_reset_token(self): + def test_create_password_reset_token(self) -> None: """Test case for create_password_reset_token - Create a password reset token # noqa: E501 + Create a password reset token """ pass - def test_reset_password(self): + def test_reset_password(self) -> None: """Test case for reset_password - Reset current user password # noqa: E501 + Reset current user password """ pass diff --git a/equinix_metal/test/test_payment_method.py b/equinix_metal/test/test_payment_method.py index 1e3b926d..0d1986e9 100644 --- a/equinix_metal/test/test_payment_method.py +++ b/equinix_metal/test/test_payment_method.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.payment_method import PaymentMethod # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.payment_method import PaymentMethod class TestPaymentMethod(unittest.TestCase): """PaymentMethod unit test stubs""" @@ -29,43 +26,43 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> PaymentMethod: """Test PaymentMethod include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `PaymentMethod` """ - model = equinix_metal.models.payment_method.PaymentMethod() # noqa: E501 - if include_optional : + model = PaymentMethod() + if include_optional: return PaymentMethod( billing_address = equinix_metal.models.payment_method_billing_address.PaymentMethodBillingAddress( country_code_alpha2 = '', href = '', postal_code = '', - street_address = '', ), - card_type = '', - cardholder_name = '', - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + street_address = '', ), + card_type = '', + cardholder_name = '', + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), created_by_user = equinix_metal.models.href.Href( - href = '', ), - default = True, - email = '', - expiration_month = '', - expiration_year = '', - href = '', - id = '', - name = '', + href = '', ), + default = True, + email = '', + expiration_month = '', + expiration_year = '', + href = '', + id = '', + name = '', organization = equinix_metal.models.href.Href( - href = '', ), + href = '', ), projects = [ equinix_metal.models.href.Href( href = '', ) - ], - type = '', + ], + type = '', updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f') ) - else : + else: return PaymentMethod( ) """ diff --git a/equinix_metal/test/test_payment_method_billing_address.py b/equinix_metal/test/test_payment_method_billing_address.py index 100539fb..59f2fc3b 100644 --- a/equinix_metal/test/test_payment_method_billing_address.py +++ b/equinix_metal/test/test_payment_method_billing_address.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.payment_method_billing_address import PaymentMethodBillingAddress # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.payment_method_billing_address import PaymentMethodBillingAddress class TestPaymentMethodBillingAddress(unittest.TestCase): """PaymentMethodBillingAddress unit test stubs""" @@ -29,22 +26,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> PaymentMethodBillingAddress: """Test PaymentMethodBillingAddress include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `PaymentMethodBillingAddress` """ - model = equinix_metal.models.payment_method_billing_address.PaymentMethodBillingAddress() # noqa: E501 - if include_optional : + model = PaymentMethodBillingAddress() + if include_optional: return PaymentMethodBillingAddress( - country_code_alpha2 = '', - href = '', - postal_code = '', + country_code_alpha2 = '', + href = '', + postal_code = '', street_address = '' ) - else : + else: return PaymentMethodBillingAddress( ) """ diff --git a/equinix_metal/test/test_payment_method_create_input.py b/equinix_metal/test/test_payment_method_create_input.py index 1aeb4f27..61494d8f 100644 --- a/equinix_metal/test/test_payment_method_create_input.py +++ b/equinix_metal/test/test_payment_method_create_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.payment_method_create_input import PaymentMethodCreateInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.payment_method_create_input import PaymentMethodCreateInput class TestPaymentMethodCreateInput(unittest.TestCase): """PaymentMethodCreateInput unit test stubs""" @@ -29,22 +26,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> PaymentMethodCreateInput: """Test PaymentMethodCreateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `PaymentMethodCreateInput` """ - model = equinix_metal.models.payment_method_create_input.PaymentMethodCreateInput() # noqa: E501 - if include_optional : + model = PaymentMethodCreateInput() + if include_optional: return PaymentMethodCreateInput( - default = True, - href = '', - name = '', + default = True, + href = '', + name = '', nonce = '' ) - else : + else: return PaymentMethodCreateInput( name = '', nonce = '', diff --git a/equinix_metal/test/test_payment_method_list.py b/equinix_metal/test/test_payment_method_list.py index d12832c9..ac069cac 100644 --- a/equinix_metal/test/test_payment_method_list.py +++ b/equinix_metal/test/test_payment_method_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.payment_method_list import PaymentMethodList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.payment_method_list import PaymentMethodList class TestPaymentMethodList(unittest.TestCase): """PaymentMethodList unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> PaymentMethodList: """Test PaymentMethodList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `PaymentMethodList` """ - model = equinix_metal.models.payment_method_list.PaymentMethodList() # noqa: E501 - if include_optional : + model = PaymentMethodList() + if include_optional: return PaymentMethodList( - href = '', + href = '', payment_methods = [ equinix_metal.models.payment_method.PaymentMethod( billing_address = equinix_metal.models.payment_method_billing_address.PaymentMethodBillingAddress( @@ -68,7 +65,7 @@ def make_instance(self, include_optional): updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), ) ] ) - else : + else: return PaymentMethodList( ) """ diff --git a/equinix_metal/test/test_payment_method_update_input.py b/equinix_metal/test/test_payment_method_update_input.py index 45b4aebf..5a03fb46 100644 --- a/equinix_metal/test/test_payment_method_update_input.py +++ b/equinix_metal/test/test_payment_method_update_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.payment_method_update_input import PaymentMethodUpdateInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.payment_method_update_input import PaymentMethodUpdateInput class TestPaymentMethodUpdateInput(unittest.TestCase): """PaymentMethodUpdateInput unit test stubs""" @@ -29,25 +26,25 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> PaymentMethodUpdateInput: """Test PaymentMethodUpdateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `PaymentMethodUpdateInput` """ - model = equinix_metal.models.payment_method_update_input.PaymentMethodUpdateInput() # noqa: E501 - if include_optional : + model = PaymentMethodUpdateInput() + if include_optional: return PaymentMethodUpdateInput( - billing_address = None, - cardholder_name = '', - default = True, - expiration_month = '', - expiration_year = 56, - href = '', + billing_address = None, + cardholder_name = '', + default = True, + expiration_month = '', + expiration_year = 56, + href = '', name = '' ) - else : + else: return PaymentMethodUpdateInput( ) """ diff --git a/equinix_metal/test/test_payment_methods_api.py b/equinix_metal/test/test_payment_methods_api.py index 46473214..fdf1b918 100644 --- a/equinix_metal/test/test_payment_methods_api.py +++ b/equinix_metal/test/test_payment_methods_api.py @@ -15,38 +15,36 @@ import unittest -import equinix_metal -from equinix_metal.api.payment_methods_api import PaymentMethodsApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.payment_methods_api import PaymentMethodsApi class TestPaymentMethodsApi(unittest.TestCase): """PaymentMethodsApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.payment_methods_api.PaymentMethodsApi() # noqa: E501 + def setUp(self) -> None: + self.api = PaymentMethodsApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_delete_payment_method(self): + def test_delete_payment_method(self) -> None: """Test case for delete_payment_method - Delete the payment method # noqa: E501 + Delete the payment method """ pass - def test_find_payment_method_by_id(self): + def test_find_payment_method_by_id(self) -> None: """Test case for find_payment_method_by_id - Retrieve a payment method # noqa: E501 + Retrieve a payment method """ pass - def test_update_payment_method(self): + def test_update_payment_method(self) -> None: """Test case for update_payment_method - Update the payment method # noqa: E501 + Update the payment method """ pass diff --git a/equinix_metal/test/test_plan.py b/equinix_metal/test/test_plan.py index 150e347a..97cae661 100644 --- a/equinix_metal/test/test_plan.py +++ b/equinix_metal/test/test_plan.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.plan import Plan # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.plan import Plan class TestPlan(unittest.TestCase): """Plan unit test stubs""" @@ -29,15 +26,15 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Plan: """Test Plan include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Plan` """ - model = equinix_metal.models.plan.Plan() # noqa: E501 - if include_optional : + model = Plan() + if include_optional: return Plan( available_in = [ equinix_metal.models.plan_available_in_inner.Plan_available_in_inner( @@ -45,29 +42,29 @@ def make_instance(self, include_optional): price = equinix_metal.models.plan_available_in_inner_price.Plan_available_in_inner_price( hour = 1.23, href = '', ), ) - ], + ], available_in_metros = [ equinix_metal.models.plan_available_in_metros_inner.Plan_available_in_metros_inner( href = '', price = equinix_metal.models.plan_available_in_inner_price.Plan_available_in_inner_price( hour = 1.23, href = '', ), ) - ], + ], categories = [ '' - ], - var_class = 'm3.large.x86', + ], + var_class = 'm3.large.x86', deployment_types = [ 'on_demand' - ], - description = '', - href = '', - id = '', - legacy = True, - line = '', - name = '', - pricing = equinix_metal.models.pricing.pricing(), - slug = 'm3.large.x86', + ], + description = '', + href = '', + id = '', + legacy = True, + line = '', + name = '', + pricing = equinix_metal.models.pricing.pricing(), + slug = 'm3.large.x86', specs = equinix_metal.models.plan_specs.Plan_specs( cpus = [ equinix_metal.models.plan_specs_cpus_inner.Plan_specs_cpus_inner( @@ -97,10 +94,10 @@ def make_instance(self, include_optional): count = 2, href = '', type = '', ) - ], ), + ], ), type = 'standard' ) - else : + else: return Plan( ) """ diff --git a/equinix_metal/test/test_plan_available_in_inner.py b/equinix_metal/test/test_plan_available_in_inner.py index 3383245d..8b12fd1c 100644 --- a/equinix_metal/test/test_plan_available_in_inner.py +++ b/equinix_metal/test/test_plan_available_in_inner.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.plan_available_in_inner import PlanAvailableInInner # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.plan_available_in_inner import PlanAvailableInInner class TestPlanAvailableInInner(unittest.TestCase): """PlanAvailableInInner unit test stubs""" @@ -29,22 +26,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> PlanAvailableInInner: """Test PlanAvailableInInner include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `PlanAvailableInInner` """ - model = equinix_metal.models.plan_available_in_inner.PlanAvailableInInner() # noqa: E501 - if include_optional : + model = PlanAvailableInInner() + if include_optional: return PlanAvailableInInner( - href = '', + href = '', price = equinix_metal.models.plan_available_in_inner_price.Plan_available_in_inner_price( hour = 1.23, href = '', ) ) - else : + else: return PlanAvailableInInner( ) """ diff --git a/equinix_metal/test/test_plan_available_in_inner_price.py b/equinix_metal/test/test_plan_available_in_inner_price.py index df7d1476..76856567 100644 --- a/equinix_metal/test/test_plan_available_in_inner_price.py +++ b/equinix_metal/test/test_plan_available_in_inner_price.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.plan_available_in_inner_price import PlanAvailableInInnerPrice # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.plan_available_in_inner_price import PlanAvailableInInnerPrice class TestPlanAvailableInInnerPrice(unittest.TestCase): """PlanAvailableInInnerPrice unit test stubs""" @@ -29,20 +26,20 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> PlanAvailableInInnerPrice: """Test PlanAvailableInInnerPrice include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `PlanAvailableInInnerPrice` """ - model = equinix_metal.models.plan_available_in_inner_price.PlanAvailableInInnerPrice() # noqa: E501 - if include_optional : + model = PlanAvailableInInnerPrice() + if include_optional: return PlanAvailableInInnerPrice( - hour = 1.23, + hour = 1.23, href = '' ) - else : + else: return PlanAvailableInInnerPrice( ) """ diff --git a/equinix_metal/test/test_plan_available_in_metros_inner.py b/equinix_metal/test/test_plan_available_in_metros_inner.py index e9758dbb..5d912446 100644 --- a/equinix_metal/test/test_plan_available_in_metros_inner.py +++ b/equinix_metal/test/test_plan_available_in_metros_inner.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.plan_available_in_metros_inner import PlanAvailableInMetrosInner # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.plan_available_in_metros_inner import PlanAvailableInMetrosInner class TestPlanAvailableInMetrosInner(unittest.TestCase): """PlanAvailableInMetrosInner unit test stubs""" @@ -29,22 +26,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> PlanAvailableInMetrosInner: """Test PlanAvailableInMetrosInner include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `PlanAvailableInMetrosInner` """ - model = equinix_metal.models.plan_available_in_metros_inner.PlanAvailableInMetrosInner() # noqa: E501 - if include_optional : + model = PlanAvailableInMetrosInner() + if include_optional: return PlanAvailableInMetrosInner( - href = '', + href = '', price = equinix_metal.models.plan_available_in_inner_price.Plan_available_in_inner_price( hour = 1.23, href = '', ) ) - else : + else: return PlanAvailableInMetrosInner( ) """ diff --git a/equinix_metal/test/test_plan_list.py b/equinix_metal/test/test_plan_list.py index 58921d4b..d9714772 100644 --- a/equinix_metal/test/test_plan_list.py +++ b/equinix_metal/test/test_plan_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.plan_list import PlanList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.plan_list import PlanList class TestPlanList(unittest.TestCase): """PlanList unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> PlanList: """Test PlanList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `PlanList` """ - model = equinix_metal.models.plan_list.PlanList() # noqa: E501 - if include_optional : + model = PlanList() + if include_optional: return PlanList( - href = '', + href = '', plans = [ equinix_metal.models.plan.Plan( available_in = [ @@ -101,7 +98,7 @@ class = 'm3.large.x86', type = 'standard', ) ] ) - else : + else: return PlanList( ) """ diff --git a/equinix_metal/test/test_plan_specs.py b/equinix_metal/test/test_plan_specs.py index bf93161f..a5896fea 100644 --- a/equinix_metal/test/test_plan_specs.py +++ b/equinix_metal/test/test_plan_specs.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.plan_specs import PlanSpecs # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.plan_specs import PlanSpecs class TestPlanSpecs(unittest.TestCase): """PlanSpecs unit test stubs""" @@ -29,22 +26,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> PlanSpecs: """Test PlanSpecs include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `PlanSpecs` """ - model = equinix_metal.models.plan_specs.PlanSpecs() # noqa: E501 - if include_optional : + model = PlanSpecs() + if include_optional: return PlanSpecs( cpus = [ equinix_metal.models.plan_specs_cpus_inner.Plan_specs_cpus_inner( count = 56, href = '', type = '', ) - ], + ], drives = [ equinix_metal.models.plan_specs_drives_inner.Plan_specs_drives_inner( category = 'boot', @@ -52,16 +49,16 @@ def make_instance(self, include_optional): href = '', size = '3.84TB', type = '', ) - ], + ], features = equinix_metal.models.plan_specs_features.Plan_specs_features( href = '', raid = True, txt = True, - uefi = True, ), - href = '', + uefi = True, ), + href = '', memory = equinix_metal.models.plan_specs_memory.Plan_specs_memory( href = '', - total = '', ), + total = '', ), nics = [ equinix_metal.models.plan_specs_nics_inner.Plan_specs_nics_inner( count = 2, @@ -69,7 +66,7 @@ def make_instance(self, include_optional): type = '', ) ] ) - else : + else: return PlanSpecs( ) """ diff --git a/equinix_metal/test/test_plan_specs_cpus_inner.py b/equinix_metal/test/test_plan_specs_cpus_inner.py index 1f3ca2bf..a416a04e 100644 --- a/equinix_metal/test/test_plan_specs_cpus_inner.py +++ b/equinix_metal/test/test_plan_specs_cpus_inner.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.plan_specs_cpus_inner import PlanSpecsCpusInner # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.plan_specs_cpus_inner import PlanSpecsCpusInner class TestPlanSpecsCpusInner(unittest.TestCase): """PlanSpecsCpusInner unit test stubs""" @@ -29,21 +26,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> PlanSpecsCpusInner: """Test PlanSpecsCpusInner include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `PlanSpecsCpusInner` """ - model = equinix_metal.models.plan_specs_cpus_inner.PlanSpecsCpusInner() # noqa: E501 - if include_optional : + model = PlanSpecsCpusInner() + if include_optional: return PlanSpecsCpusInner( - count = 56, - href = '', + count = 56, + href = '', type = '' ) - else : + else: return PlanSpecsCpusInner( ) """ diff --git a/equinix_metal/test/test_plan_specs_drives_inner.py b/equinix_metal/test/test_plan_specs_drives_inner.py index 262c90e3..474b85b2 100644 --- a/equinix_metal/test/test_plan_specs_drives_inner.py +++ b/equinix_metal/test/test_plan_specs_drives_inner.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.plan_specs_drives_inner import PlanSpecsDrivesInner # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.plan_specs_drives_inner import PlanSpecsDrivesInner class TestPlanSpecsDrivesInner(unittest.TestCase): """PlanSpecsDrivesInner unit test stubs""" @@ -29,23 +26,23 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> PlanSpecsDrivesInner: """Test PlanSpecsDrivesInner include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `PlanSpecsDrivesInner` """ - model = equinix_metal.models.plan_specs_drives_inner.PlanSpecsDrivesInner() # noqa: E501 - if include_optional : + model = PlanSpecsDrivesInner() + if include_optional: return PlanSpecsDrivesInner( - category = 'boot', - count = 56, - href = '', - size = '3.84TB', + category = 'boot', + count = 56, + href = '', + size = '3.84TB', type = '' ) - else : + else: return PlanSpecsDrivesInner( ) """ diff --git a/equinix_metal/test/test_plan_specs_features.py b/equinix_metal/test/test_plan_specs_features.py index 6ca1d90e..85f4a0fd 100644 --- a/equinix_metal/test/test_plan_specs_features.py +++ b/equinix_metal/test/test_plan_specs_features.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.plan_specs_features import PlanSpecsFeatures # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.plan_specs_features import PlanSpecsFeatures class TestPlanSpecsFeatures(unittest.TestCase): """PlanSpecsFeatures unit test stubs""" @@ -29,22 +26,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> PlanSpecsFeatures: """Test PlanSpecsFeatures include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `PlanSpecsFeatures` """ - model = equinix_metal.models.plan_specs_features.PlanSpecsFeatures() # noqa: E501 - if include_optional : + model = PlanSpecsFeatures() + if include_optional: return PlanSpecsFeatures( - href = '', - raid = True, - txt = True, + href = '', + raid = True, + txt = True, uefi = True ) - else : + else: return PlanSpecsFeatures( ) """ diff --git a/equinix_metal/test/test_plan_specs_memory.py b/equinix_metal/test/test_plan_specs_memory.py index 220ca91c..6f10ba17 100644 --- a/equinix_metal/test/test_plan_specs_memory.py +++ b/equinix_metal/test/test_plan_specs_memory.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.plan_specs_memory import PlanSpecsMemory # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.plan_specs_memory import PlanSpecsMemory class TestPlanSpecsMemory(unittest.TestCase): """PlanSpecsMemory unit test stubs""" @@ -29,20 +26,20 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> PlanSpecsMemory: """Test PlanSpecsMemory include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `PlanSpecsMemory` """ - model = equinix_metal.models.plan_specs_memory.PlanSpecsMemory() # noqa: E501 - if include_optional : + model = PlanSpecsMemory() + if include_optional: return PlanSpecsMemory( - href = '', + href = '', total = '' ) - else : + else: return PlanSpecsMemory( ) """ diff --git a/equinix_metal/test/test_plan_specs_nics_inner.py b/equinix_metal/test/test_plan_specs_nics_inner.py index bf419ec6..8a048912 100644 --- a/equinix_metal/test/test_plan_specs_nics_inner.py +++ b/equinix_metal/test/test_plan_specs_nics_inner.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.plan_specs_nics_inner import PlanSpecsNicsInner # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.plan_specs_nics_inner import PlanSpecsNicsInner class TestPlanSpecsNicsInner(unittest.TestCase): """PlanSpecsNicsInner unit test stubs""" @@ -29,21 +26,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> PlanSpecsNicsInner: """Test PlanSpecsNicsInner include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `PlanSpecsNicsInner` """ - model = equinix_metal.models.plan_specs_nics_inner.PlanSpecsNicsInner() # noqa: E501 - if include_optional : + model = PlanSpecsNicsInner() + if include_optional: return PlanSpecsNicsInner( - count = 2, - href = '', + count = 2, + href = '', type = '' ) - else : + else: return PlanSpecsNicsInner( ) """ diff --git a/equinix_metal/test/test_plans_api.py b/equinix_metal/test/test_plans_api.py index ffb39cf5..db8112a4 100644 --- a/equinix_metal/test/test_plans_api.py +++ b/equinix_metal/test/test_plans_api.py @@ -15,31 +15,29 @@ import unittest -import equinix_metal -from equinix_metal.api.plans_api import PlansApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.plans_api import PlansApi class TestPlansApi(unittest.TestCase): """PlansApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.plans_api.PlansApi() # noqa: E501 + def setUp(self) -> None: + self.api = PlansApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_find_plans(self): + def test_find_plans(self) -> None: """Test case for find_plans - Retrieve all plans # noqa: E501 + Retrieve all plans """ pass - def test_find_plans_by_project(self): + def test_find_plans_by_project(self) -> None: """Test case for find_plans_by_project - Retrieve all plans visible by the project # noqa: E501 + Retrieve all plans visible by the project """ pass diff --git a/equinix_metal/test/test_port.py b/equinix_metal/test/test_port.py index 63a0a00c..6d9f0ccc 100644 --- a/equinix_metal/test/test_port.py +++ b/equinix_metal/test/test_port.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.port import Port # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.port import Port class TestPort(unittest.TestCase): """Port unit test stubs""" @@ -29,28 +26,28 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Port: """Test Port include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Port` """ - model = equinix_metal.models.port.Port() # noqa: E501 - if include_optional : + model = Port() + if include_optional: return Port( bond = equinix_metal.models.bond_port_data.BondPortData( href = '', id = '', - name = '', ), + name = '', ), data = equinix_metal.models.port_data.PortData( bonded = True, href = '', - mac = '', ), - disbond_operation_supported = True, - href = '', - id = '', - name = 'bond0', + mac = '', ), + disbond_operation_supported = True, + href = '', + id = '', + name = 'bond0', native_virtual_network = equinix_metal.models.virtual_network.VirtualNetwork( assigned_to = equinix_metal.models.href.Href( href = '', ), @@ -78,15 +75,15 @@ def make_instance(self, include_optional): tags = [ '' ], - vxlan = 56, ), - network_type = 'layer2-bonded', - type = 'NetworkPort', + vxlan = 56, ), + network_type = 'layer2-bonded', + type = 'NetworkPort', virtual_networks = [ equinix_metal.models.href.Href( href = '', ) ] ) - else : + else: return Port( ) """ diff --git a/equinix_metal/test/test_port_assign_input.py b/equinix_metal/test/test_port_assign_input.py index 238dece4..709e7764 100644 --- a/equinix_metal/test/test_port_assign_input.py +++ b/equinix_metal/test/test_port_assign_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.port_assign_input import PortAssignInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.port_assign_input import PortAssignInput class TestPortAssignInput(unittest.TestCase): """PortAssignInput unit test stubs""" @@ -29,20 +26,20 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> PortAssignInput: """Test PortAssignInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `PortAssignInput` """ - model = equinix_metal.models.port_assign_input.PortAssignInput() # noqa: E501 - if include_optional : + model = PortAssignInput() + if include_optional: return PortAssignInput( - href = '', + href = '', vnid = '1001' ) - else : + else: return PortAssignInput( ) """ diff --git a/equinix_metal/test/test_port_convert_layer3_input.py b/equinix_metal/test/test_port_convert_layer3_input.py index 9bca0c60..46cbdf94 100644 --- a/equinix_metal/test/test_port_convert_layer3_input.py +++ b/equinix_metal/test/test_port_convert_layer3_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.port_convert_layer3_input import PortConvertLayer3Input # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.port_convert_layer3_input import PortConvertLayer3Input class TestPortConvertLayer3Input(unittest.TestCase): """PortConvertLayer3Input unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> PortConvertLayer3Input: """Test PortConvertLayer3Input include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `PortConvertLayer3Input` """ - model = equinix_metal.models.port_convert_layer3_input.PortConvertLayer3Input() # noqa: E501 - if include_optional : + model = PortConvertLayer3Input() + if include_optional: return PortConvertLayer3Input( - href = '', + href = '', request_ips = [ equinix_metal.models.port_convert_layer3_input_request_ips_inner.PortConvertLayer3Input_request_ips_inner( address_family = 56, @@ -47,7 +44,7 @@ def make_instance(self, include_optional): public = True, ) ] ) - else : + else: return PortConvertLayer3Input( ) """ diff --git a/equinix_metal/test/test_port_convert_layer3_input_request_ips_inner.py b/equinix_metal/test/test_port_convert_layer3_input_request_ips_inner.py index 97b5cb8a..6dc5d94e 100644 --- a/equinix_metal/test/test_port_convert_layer3_input_request_ips_inner.py +++ b/equinix_metal/test/test_port_convert_layer3_input_request_ips_inner.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.port_convert_layer3_input_request_ips_inner import PortConvertLayer3InputRequestIpsInner # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.port_convert_layer3_input_request_ips_inner import PortConvertLayer3InputRequestIpsInner class TestPortConvertLayer3InputRequestIpsInner(unittest.TestCase): """PortConvertLayer3InputRequestIpsInner unit test stubs""" @@ -29,21 +26,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> PortConvertLayer3InputRequestIpsInner: """Test PortConvertLayer3InputRequestIpsInner include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `PortConvertLayer3InputRequestIpsInner` """ - model = equinix_metal.models.port_convert_layer3_input_request_ips_inner.PortConvertLayer3InputRequestIpsInner() # noqa: E501 - if include_optional : + model = PortConvertLayer3InputRequestIpsInner() + if include_optional: return PortConvertLayer3InputRequestIpsInner( - address_family = 56, - href = '', + address_family = 56, + href = '', public = True ) - else : + else: return PortConvertLayer3InputRequestIpsInner( ) """ diff --git a/equinix_metal/test/test_port_data.py b/equinix_metal/test/test_port_data.py index 5fe09acb..cf3e4744 100644 --- a/equinix_metal/test/test_port_data.py +++ b/equinix_metal/test/test_port_data.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.port_data import PortData # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.port_data import PortData class TestPortData(unittest.TestCase): """PortData unit test stubs""" @@ -29,21 +26,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> PortData: """Test PortData include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `PortData` """ - model = equinix_metal.models.port_data.PortData() # noqa: E501 - if include_optional : + model = PortData() + if include_optional: return PortData( - bonded = True, - href = '', + bonded = True, + href = '', mac = '' ) - else : + else: return PortData( ) """ diff --git a/equinix_metal/test/test_port_vlan_assignment.py b/equinix_metal/test/test_port_vlan_assignment.py index efc536a0..6c18d335 100644 --- a/equinix_metal/test/test_port_vlan_assignment.py +++ b/equinix_metal/test/test_port_vlan_assignment.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.port_vlan_assignment import PortVlanAssignment # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.port_vlan_assignment import PortVlanAssignment class TestPortVlanAssignment(unittest.TestCase): """PortVlanAssignment unit test stubs""" @@ -29,29 +26,29 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> PortVlanAssignment: """Test PortVlanAssignment include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `PortVlanAssignment` """ - model = equinix_metal.models.port_vlan_assignment.PortVlanAssignment() # noqa: E501 - if include_optional : + model = PortVlanAssignment() + if include_optional: return PortVlanAssignment( - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - href = '', - id = '', - native = True, + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + href = '', + id = '', + native = True, port = equinix_metal.models.href.Href( - href = '', ), - state = 'assigned', - updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + href = '', ), + state = 'assigned', + updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), virtual_network = equinix_metal.models.href.Href( - href = '', ), + href = '', ), vlan = 56 ) - else : + else: return PortVlanAssignment( ) """ diff --git a/equinix_metal/test/test_port_vlan_assignment_batch.py b/equinix_metal/test/test_port_vlan_assignment_batch.py index 06874e86..8983b364 100644 --- a/equinix_metal/test/test_port_vlan_assignment_batch.py +++ b/equinix_metal/test/test_port_vlan_assignment_batch.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.port_vlan_assignment_batch import PortVlanAssignmentBatch # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.port_vlan_assignment_batch import PortVlanAssignmentBatch class TestPortVlanAssignmentBatch(unittest.TestCase): """PortVlanAssignmentBatch unit test stubs""" @@ -29,22 +26,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> PortVlanAssignmentBatch: """Test PortVlanAssignmentBatch include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `PortVlanAssignmentBatch` """ - model = equinix_metal.models.port_vlan_assignment_batch.PortVlanAssignmentBatch() # noqa: E501 - if include_optional : + model = PortVlanAssignmentBatch() + if include_optional: return PortVlanAssignmentBatch( - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), error_messages = [ '' - ], - href = '', - id = '', + ], + href = '', + id = '', port = equinix_metal.models.port.Port( bond = equinix_metal.models.bond_port_data.BondPortData( href = '', @@ -90,12 +87,12 @@ def make_instance(self, include_optional): type = 'NetworkPort', virtual_networks = [ - ], ), + ], ), project = equinix_metal.models.href.Href( - href = '', ), - quantity = 56, - state = 'queued', - updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + href = '', ), + quantity = 56, + state = 'queued', + updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), vlan_assignments = [ equinix_metal.models.port_vlan_assignment_batch_vlan_assignments_inner.PortVlanAssignmentBatch_vlan_assignments_inner( href = '', @@ -105,7 +102,7 @@ def make_instance(self, include_optional): vlan = 56, ) ] ) - else : + else: return PortVlanAssignmentBatch( ) """ diff --git a/equinix_metal/test/test_port_vlan_assignment_batch_create_input.py b/equinix_metal/test/test_port_vlan_assignment_batch_create_input.py index 57f07cbd..069802ec 100644 --- a/equinix_metal/test/test_port_vlan_assignment_batch_create_input.py +++ b/equinix_metal/test/test_port_vlan_assignment_batch_create_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.port_vlan_assignment_batch_create_input import PortVlanAssignmentBatchCreateInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.port_vlan_assignment_batch_create_input import PortVlanAssignmentBatchCreateInput class TestPortVlanAssignmentBatchCreateInput(unittest.TestCase): """PortVlanAssignmentBatchCreateInput unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> PortVlanAssignmentBatchCreateInput: """Test PortVlanAssignmentBatchCreateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `PortVlanAssignmentBatchCreateInput` """ - model = equinix_metal.models.port_vlan_assignment_batch_create_input.PortVlanAssignmentBatchCreateInput() # noqa: E501 - if include_optional : + model = PortVlanAssignmentBatchCreateInput() + if include_optional: return PortVlanAssignmentBatchCreateInput( - href = '', + href = '', vlan_assignments = [ equinix_metal.models.port_vlan_assignment_batch_create_input_vlan_assignments_inner.PortVlanAssignmentBatchCreateInput_vlan_assignments_inner( href = '', @@ -48,7 +45,7 @@ def make_instance(self, include_optional): vlan = '', ) ] ) - else : + else: return PortVlanAssignmentBatchCreateInput( ) """ diff --git a/equinix_metal/test/test_port_vlan_assignment_batch_create_input_vlan_assignments_inner.py b/equinix_metal/test/test_port_vlan_assignment_batch_create_input_vlan_assignments_inner.py index f06a0751..c81f390d 100644 --- a/equinix_metal/test/test_port_vlan_assignment_batch_create_input_vlan_assignments_inner.py +++ b/equinix_metal/test/test_port_vlan_assignment_batch_create_input_vlan_assignments_inner.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.port_vlan_assignment_batch_create_input_vlan_assignments_inner import PortVlanAssignmentBatchCreateInputVlanAssignmentsInner # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.port_vlan_assignment_batch_create_input_vlan_assignments_inner import PortVlanAssignmentBatchCreateInputVlanAssignmentsInner class TestPortVlanAssignmentBatchCreateInputVlanAssignmentsInner(unittest.TestCase): """PortVlanAssignmentBatchCreateInputVlanAssignmentsInner unit test stubs""" @@ -29,22 +26,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> PortVlanAssignmentBatchCreateInputVlanAssignmentsInner: """Test PortVlanAssignmentBatchCreateInputVlanAssignmentsInner include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `PortVlanAssignmentBatchCreateInputVlanAssignmentsInner` """ - model = equinix_metal.models.port_vlan_assignment_batch_create_input_vlan_assignments_inner.PortVlanAssignmentBatchCreateInputVlanAssignmentsInner() # noqa: E501 - if include_optional : + model = PortVlanAssignmentBatchCreateInputVlanAssignmentsInner() + if include_optional: return PortVlanAssignmentBatchCreateInputVlanAssignmentsInner( - href = '', - native = True, - state = 'assigned', + href = '', + native = True, + state = 'assigned', vlan = '' ) - else : + else: return PortVlanAssignmentBatchCreateInputVlanAssignmentsInner( ) """ diff --git a/equinix_metal/test/test_port_vlan_assignment_batch_list.py b/equinix_metal/test/test_port_vlan_assignment_batch_list.py index 7cebf4ce..4c02886e 100644 --- a/equinix_metal/test/test_port_vlan_assignment_batch_list.py +++ b/equinix_metal/test/test_port_vlan_assignment_batch_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.port_vlan_assignment_batch_list import PortVlanAssignmentBatchList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.port_vlan_assignment_batch_list import PortVlanAssignmentBatchList class TestPortVlanAssignmentBatchList(unittest.TestCase): """PortVlanAssignmentBatchList unit test stubs""" @@ -29,15 +26,15 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> PortVlanAssignmentBatchList: """Test PortVlanAssignmentBatchList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `PortVlanAssignmentBatchList` """ - model = equinix_metal.models.port_vlan_assignment_batch_list.PortVlanAssignmentBatchList() # noqa: E501 - if include_optional : + model = PortVlanAssignmentBatchList() + if include_optional: return PortVlanAssignmentBatchList( batches = [ equinix_metal.models.port_vlan_assignment_batch.PortVlanAssignmentBatch( @@ -105,10 +102,10 @@ def make_instance(self, include_optional): state = 'assigned', vlan = 56, ) ], ) - ], + ], href = '' ) - else : + else: return PortVlanAssignmentBatchList( ) """ diff --git a/equinix_metal/test/test_port_vlan_assignment_batch_vlan_assignments_inner.py b/equinix_metal/test/test_port_vlan_assignment_batch_vlan_assignments_inner.py index c9ecd862..263406d7 100644 --- a/equinix_metal/test/test_port_vlan_assignment_batch_vlan_assignments_inner.py +++ b/equinix_metal/test/test_port_vlan_assignment_batch_vlan_assignments_inner.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.port_vlan_assignment_batch_vlan_assignments_inner import PortVlanAssignmentBatchVlanAssignmentsInner # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.port_vlan_assignment_batch_vlan_assignments_inner import PortVlanAssignmentBatchVlanAssignmentsInner class TestPortVlanAssignmentBatchVlanAssignmentsInner(unittest.TestCase): """PortVlanAssignmentBatchVlanAssignmentsInner unit test stubs""" @@ -29,23 +26,23 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> PortVlanAssignmentBatchVlanAssignmentsInner: """Test PortVlanAssignmentBatchVlanAssignmentsInner include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `PortVlanAssignmentBatchVlanAssignmentsInner` """ - model = equinix_metal.models.port_vlan_assignment_batch_vlan_assignments_inner.PortVlanAssignmentBatchVlanAssignmentsInner() # noqa: E501 - if include_optional : + model = PortVlanAssignmentBatchVlanAssignmentsInner() + if include_optional: return PortVlanAssignmentBatchVlanAssignmentsInner( - href = '', - id = '', - native = True, - state = 'assigned', + href = '', + id = '', + native = True, + state = 'assigned', vlan = 56 ) - else : + else: return PortVlanAssignmentBatchVlanAssignmentsInner( ) """ diff --git a/equinix_metal/test/test_port_vlan_assignment_list.py b/equinix_metal/test/test_port_vlan_assignment_list.py index 2ba02a27..607ac34f 100644 --- a/equinix_metal/test/test_port_vlan_assignment_list.py +++ b/equinix_metal/test/test_port_vlan_assignment_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.port_vlan_assignment_list import PortVlanAssignmentList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.port_vlan_assignment_list import PortVlanAssignmentList class TestPortVlanAssignmentList(unittest.TestCase): """PortVlanAssignmentList unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> PortVlanAssignmentList: """Test PortVlanAssignmentList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `PortVlanAssignmentList` """ - model = equinix_metal.models.port_vlan_assignment_list.PortVlanAssignmentList() # noqa: E501 - if include_optional : + model = PortVlanAssignmentList() + if include_optional: return PortVlanAssignmentList( - href = '', + href = '', vlan_assignments = [ equinix_metal.models.port_vlan_assignment.PortVlanAssignment( created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), @@ -55,7 +52,7 @@ def make_instance(self, include_optional): vlan = 56, ) ] ) - else : + else: return PortVlanAssignmentList( ) """ diff --git a/equinix_metal/test/test_ports_api.py b/equinix_metal/test/test_ports_api.py index 53c66bba..4ea5c926 100644 --- a/equinix_metal/test/test_ports_api.py +++ b/equinix_metal/test/test_ports_api.py @@ -15,115 +15,113 @@ import unittest -import equinix_metal -from equinix_metal.api.ports_api import PortsApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.ports_api import PortsApi class TestPortsApi(unittest.TestCase): """PortsApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.ports_api.PortsApi() # noqa: E501 + def setUp(self) -> None: + self.api = PortsApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_assign_native_vlan(self): + def test_assign_native_vlan(self) -> None: """Test case for assign_native_vlan - Assign a native VLAN # noqa: E501 + Assign a native VLAN """ pass - def test_assign_port(self): + def test_assign_port(self) -> None: """Test case for assign_port - Assign a port to virtual network # noqa: E501 + Assign a port to virtual network """ pass - def test_bond_port(self): + def test_bond_port(self) -> None: """Test case for bond_port - Enabling bonding # noqa: E501 + Enabling bonding """ pass - def test_convert_layer2(self): + def test_convert_layer2(self) -> None: """Test case for convert_layer2 - Convert to Layer 2 # noqa: E501 + Convert to Layer 2 """ pass - def test_convert_layer3(self): + def test_convert_layer3(self) -> None: """Test case for convert_layer3 - Convert to Layer 3 # noqa: E501 + Convert to Layer 3 """ pass - def test_create_port_vlan_assignment_batch(self): + def test_create_port_vlan_assignment_batch(self) -> None: """Test case for create_port_vlan_assignment_batch - Create a new Port-VLAN Assignment management batch # noqa: E501 + Create a new Port-VLAN Assignment management batch """ pass - def test_delete_native_vlan(self): + def test_delete_native_vlan(self) -> None: """Test case for delete_native_vlan - Remove native VLAN # noqa: E501 + Remove native VLAN """ pass - def test_disbond_port(self): + def test_disbond_port(self) -> None: """Test case for disbond_port - Disabling bonding # noqa: E501 + Disabling bonding """ pass - def test_find_port_by_id(self): + def test_find_port_by_id(self) -> None: """Test case for find_port_by_id - Retrieve a port # noqa: E501 + Retrieve a port """ pass - def test_find_port_vlan_assignment_batch_by_port_id_and_batch_id(self): + def test_find_port_vlan_assignment_batch_by_port_id_and_batch_id(self) -> None: """Test case for find_port_vlan_assignment_batch_by_port_id_and_batch_id - Retrieve a VLAN Assignment Batch's details # noqa: E501 + Retrieve a VLAN Assignment Batch's details """ pass - def test_find_port_vlan_assignment_batches(self): + def test_find_port_vlan_assignment_batches(self) -> None: """Test case for find_port_vlan_assignment_batches - List the VLAN Assignment Batches for a port # noqa: E501 + List the VLAN Assignment Batches for a port """ pass - def test_find_port_vlan_assignment_by_port_id_and_assignment_id(self): + def test_find_port_vlan_assignment_by_port_id_and_assignment_id(self) -> None: """Test case for find_port_vlan_assignment_by_port_id_and_assignment_id - Show a particular Port VLAN assignment's details # noqa: E501 + Show a particular Port VLAN assignment's details """ pass - def test_find_port_vlan_assignments(self): + def test_find_port_vlan_assignments(self) -> None: """Test case for find_port_vlan_assignments - List Current VLAN assignments for a port # noqa: E501 + List Current VLAN assignments for a port """ pass - def test_unassign_port(self): + def test_unassign_port(self) -> None: """Test case for unassign_port - Unassign a port # noqa: E501 + Unassign a port """ pass diff --git a/equinix_metal/test/test_project.py b/equinix_metal/test/test_project.py index 0c5e42f2..5af6dfda 100644 --- a/equinix_metal/test/test_project.py +++ b/equinix_metal/test/test_project.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.project import Project # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.project import Project class TestProject(unittest.TestCase): """Project unit test stubs""" @@ -29,61 +26,61 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Project: """Test Project include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Project` """ - model = equinix_metal.models.project.Project() # noqa: E501 - if include_optional : + model = Project() + if include_optional: return Project( - backend_transfer_enabled = True, + backend_transfer_enabled = True, bgp_config = equinix_metal.models.href.Href( - href = '', ), - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - customdata = equinix_metal.models.customdata.customdata(), + href = '', ), + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + customdata = equinix_metal.models.customdata.customdata(), devices = [ equinix_metal.models.href.Href( href = '', ) - ], - href = '', - id = '', + ], + href = '', + id = '', invitations = [ equinix_metal.models.href.Href( href = '', ) - ], - max_devices = equinix_metal.models.max_devices.max_devices(), + ], + max_devices = equinix_metal.models.max_devices.max_devices(), members = [ equinix_metal.models.href.Href( href = '', ) - ], + ], memberships = [ equinix_metal.models.href.Href( href = '', ) - ], - name = '0', - network_status = equinix_metal.models.network_status.network_status(), + ], + name = '0', + network_status = equinix_metal.models.network_status.network_status(), organization = equinix_metal.models.href.Href( - href = '', ), + href = '', ), payment_method = equinix_metal.models.href.Href( - href = '', ), + href = '', ), ssh_keys = [ equinix_metal.models.href.Href( href = '', ) - ], + ], tags = [ '' - ], - type = 'default', - updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + ], + type = 'default', + updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), volumes = [ equinix_metal.models.href.Href( href = '', ) ] ) - else : + else: return Project( ) """ diff --git a/equinix_metal/test/test_project_create_from_root_input.py b/equinix_metal/test/test_project_create_from_root_input.py index 6ef14ba6..287a1e41 100644 --- a/equinix_metal/test/test_project_create_from_root_input.py +++ b/equinix_metal/test/test_project_create_from_root_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.project_create_from_root_input import ProjectCreateFromRootInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.project_create_from_root_input import ProjectCreateFromRootInput class TestProjectCreateFromRootInput(unittest.TestCase): """ProjectCreateFromRootInput unit test stubs""" @@ -29,27 +26,27 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> ProjectCreateFromRootInput: """Test ProjectCreateFromRootInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `ProjectCreateFromRootInput` """ - model = equinix_metal.models.project_create_from_root_input.ProjectCreateFromRootInput() # noqa: E501 - if include_optional : + model = ProjectCreateFromRootInput() + if include_optional: return ProjectCreateFromRootInput( - customdata = None, - href = '', - name = '0', - organization_id = '', - payment_method_id = '', + customdata = None, + href = '', + name = '0', + organization_id = '', + payment_method_id = '', tags = [ '' - ], + ], type = 'default' ) - else : + else: return ProjectCreateFromRootInput( name = '0', ) diff --git a/equinix_metal/test/test_project_create_input.py b/equinix_metal/test/test_project_create_input.py index e0bd1bcb..af104897 100644 --- a/equinix_metal/test/test_project_create_input.py +++ b/equinix_metal/test/test_project_create_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.project_create_input import ProjectCreateInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.project_create_input import ProjectCreateInput class TestProjectCreateInput(unittest.TestCase): """ProjectCreateInput unit test stubs""" @@ -29,26 +26,26 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> ProjectCreateInput: """Test ProjectCreateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `ProjectCreateInput` """ - model = equinix_metal.models.project_create_input.ProjectCreateInput() # noqa: E501 - if include_optional : + model = ProjectCreateInput() + if include_optional: return ProjectCreateInput( - customdata = None, - href = '', - name = '0', - payment_method_id = '', + customdata = None, + href = '', + name = '0', + payment_method_id = '', tags = [ '' - ], + ], type = 'default' ) - else : + else: return ProjectCreateInput( name = '0', ) diff --git a/equinix_metal/test/test_project_id_name.py b/equinix_metal/test/test_project_id_name.py index 63823346..094c8b8d 100644 --- a/equinix_metal/test/test_project_id_name.py +++ b/equinix_metal/test/test_project_id_name.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.project_id_name import ProjectIdName # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.project_id_name import ProjectIdName class TestProjectIdName(unittest.TestCase): """ProjectIdName unit test stubs""" @@ -29,21 +26,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> ProjectIdName: """Test ProjectIdName include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `ProjectIdName` """ - model = equinix_metal.models.project_id_name.ProjectIdName() # noqa: E501 - if include_optional : + model = ProjectIdName() + if include_optional: return ProjectIdName( - href = '', - id = '', + href = '', + id = '', name = '' ) - else : + else: return ProjectIdName( ) """ diff --git a/equinix_metal/test/test_project_list.py b/equinix_metal/test/test_project_list.py index ee9fab3f..c1540237 100644 --- a/equinix_metal/test/test_project_list.py +++ b/equinix_metal/test/test_project_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.project_list import ProjectList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.project_list import ProjectList class TestProjectList(unittest.TestCase): """ProjectList unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> ProjectList: """Test ProjectList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `ProjectList` """ - model = equinix_metal.models.project_list.ProjectList() # noqa: E501 - if include_optional : + model = ProjectList() + if include_optional: return ProjectList( - href = '', + href = '', meta = equinix_metal.models.meta.Meta( current_page = 56, first = equinix_metal.models.href.Href( @@ -51,7 +48,7 @@ def make_instance(self, include_optional): next = , previous = , self = , - total = 56, ), + total = 56, ), projects = [ equinix_metal.models.project.Project( backend_transfer_enabled = True, @@ -92,7 +89,7 @@ def make_instance(self, include_optional): ], ) ] ) - else : + else: return ProjectList( ) """ diff --git a/equinix_metal/test/test_project_update_input.py b/equinix_metal/test/test_project_update_input.py index bdc69204..8c7aa315 100644 --- a/equinix_metal/test/test_project_update_input.py +++ b/equinix_metal/test/test_project_update_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.project_update_input import ProjectUpdateInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.project_update_input import ProjectUpdateInput class TestProjectUpdateInput(unittest.TestCase): """ProjectUpdateInput unit test stubs""" @@ -29,26 +26,26 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> ProjectUpdateInput: """Test ProjectUpdateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `ProjectUpdateInput` """ - model = equinix_metal.models.project_update_input.ProjectUpdateInput() # noqa: E501 - if include_optional : + model = ProjectUpdateInput() + if include_optional: return ProjectUpdateInput( - backend_transfer_enabled = True, - customdata = None, - href = '', - name = '0', - payment_method_id = '', + backend_transfer_enabled = True, + customdata = None, + href = '', + name = '0', + payment_method_id = '', tags = [ '' ] ) - else : + else: return ProjectUpdateInput( ) """ diff --git a/equinix_metal/test/test_project_usage.py b/equinix_metal/test/test_project_usage.py index cdc3b5e7..c6edacad 100644 --- a/equinix_metal/test/test_project_usage.py +++ b/equinix_metal/test/test_project_usage.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.project_usage import ProjectUsage # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.project_usage import ProjectUsage class TestProjectUsage(unittest.TestCase): """ProjectUsage unit test stubs""" @@ -29,28 +26,28 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> ProjectUsage: """Test ProjectUsage include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `ProjectUsage` """ - model = equinix_metal.models.project_usage.ProjectUsage() # noqa: E501 - if include_optional : + model = ProjectUsage() + if include_optional: return ProjectUsage( - facility = '', - href = '', - name = '', - plan = '', - plan_version = '', - price = '', - quantity = '', - total = '', - type = '', + facility = '', + href = '', + name = '', + plan = '', + plan_version = '', + price = '', + quantity = '', + total = '', + type = '', unit = '' ) - else : + else: return ProjectUsage( ) """ diff --git a/equinix_metal/test/test_project_usage_list.py b/equinix_metal/test/test_project_usage_list.py index 776bd6ae..9d860c76 100644 --- a/equinix_metal/test/test_project_usage_list.py +++ b/equinix_metal/test/test_project_usage_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.project_usage_list import ProjectUsageList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.project_usage_list import ProjectUsageList class TestProjectUsageList(unittest.TestCase): """ProjectUsageList unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> ProjectUsageList: """Test ProjectUsageList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `ProjectUsageList` """ - model = equinix_metal.models.project_usage_list.ProjectUsageList() # noqa: E501 - if include_optional : + model = ProjectUsageList() + if include_optional: return ProjectUsageList( - href = '', + href = '', usages = [ equinix_metal.models.project_usage.ProjectUsage( facility = '', @@ -54,7 +51,7 @@ def make_instance(self, include_optional): unit = '', ) ] ) - else : + else: return ProjectUsageList( ) """ diff --git a/equinix_metal/test/test_projects_api.py b/equinix_metal/test/test_projects_api.py index ec93c0d7..d0207c07 100644 --- a/equinix_metal/test/test_projects_api.py +++ b/equinix_metal/test/test_projects_api.py @@ -15,87 +15,85 @@ import unittest -import equinix_metal -from equinix_metal.api.projects_api import ProjectsApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.projects_api import ProjectsApi class TestProjectsApi(unittest.TestCase): """ProjectsApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.projects_api.ProjectsApi() # noqa: E501 + def setUp(self) -> None: + self.api = ProjectsApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_create_project(self): + def test_create_project(self) -> None: """Test case for create_project - Create a project # noqa: E501 + Create a project """ pass - def test_create_project_invitation(self): + def test_create_project_invitation(self) -> None: """Test case for create_project_invitation - Create an invitation for a project # noqa: E501 + Create an invitation for a project """ pass - def test_create_transfer_request(self): + def test_create_transfer_request(self) -> None: """Test case for create_transfer_request - Create a transfer request # noqa: E501 + Create a transfer request """ pass - def test_delete_project(self): + def test_delete_project(self) -> None: """Test case for delete_project - Delete the project # noqa: E501 + Delete the project """ pass - def test_find_ip_reservation_customdata(self): + def test_find_ip_reservation_customdata(self) -> None: """Test case for find_ip_reservation_customdata - Retrieve the custom metadata of an IP Reservation # noqa: E501 + Retrieve the custom metadata of an IP Reservation """ pass - def test_find_project_by_id(self): + def test_find_project_by_id(self) -> None: """Test case for find_project_by_id - Retrieve a project # noqa: E501 + Retrieve a project """ pass - def test_find_project_customdata(self): + def test_find_project_customdata(self) -> None: """Test case for find_project_customdata - Retrieve the custom metadata of a project # noqa: E501 + Retrieve the custom metadata of a project """ pass - def test_find_project_invitations(self): + def test_find_project_invitations(self) -> None: """Test case for find_project_invitations - Retrieve project invitations # noqa: E501 + Retrieve project invitations """ pass - def test_find_project_memberships(self): + def test_find_project_memberships(self) -> None: """Test case for find_project_memberships - Retrieve project memberships # noqa: E501 + Retrieve project memberships """ pass - def test_find_projects(self): + def test_find_projects(self) -> None: """Test case for find_projects - Retrieve all projects # noqa: E501 + Retrieve all projects """ pass @@ -106,10 +104,10 @@ def test_find_projects_all_pages(self): """ pass - def test_update_project(self): + def test_update_project(self) -> None: """Test case for update_project - Update the project # noqa: E501 + Update the project """ pass diff --git a/equinix_metal/test/test_raid.py b/equinix_metal/test/test_raid.py index 544d8d40..cfddbf1d 100644 --- a/equinix_metal/test/test_raid.py +++ b/equinix_metal/test/test_raid.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.raid import Raid # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.raid import Raid class TestRaid(unittest.TestCase): """Raid unit test stubs""" @@ -29,24 +26,24 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Raid: """Test Raid include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Raid` """ - model = equinix_metal.models.raid.Raid() # noqa: E501 - if include_optional : + model = Raid() + if include_optional: return Raid( devices = [ '' - ], - href = '', - level = '', + ], + href = '', + level = '', name = '' ) - else : + else: return Raid( ) """ diff --git a/equinix_metal/test/test_recovery_code_list.py b/equinix_metal/test/test_recovery_code_list.py index f7bb1560..f3318af3 100644 --- a/equinix_metal/test/test_recovery_code_list.py +++ b/equinix_metal/test/test_recovery_code_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.recovery_code_list import RecoveryCodeList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.recovery_code_list import RecoveryCodeList class TestRecoveryCodeList(unittest.TestCase): """RecoveryCodeList unit test stubs""" @@ -29,22 +26,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> RecoveryCodeList: """Test RecoveryCodeList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `RecoveryCodeList` """ - model = equinix_metal.models.recovery_code_list.RecoveryCodeList() # noqa: E501 - if include_optional : + model = RecoveryCodeList() + if include_optional: return RecoveryCodeList( - href = '', + href = '', recovery_codes = [ '' ] ) - else : + else: return RecoveryCodeList( ) """ diff --git a/equinix_metal/test/test_request_ip_reservation201_response.py b/equinix_metal/test/test_request_ip_reservation201_response.py index ce605d09..bc516dd3 100644 --- a/equinix_metal/test/test_request_ip_reservation201_response.py +++ b/equinix_metal/test/test_request_ip_reservation201_response.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.request_ip_reservation201_response import RequestIPReservation201Response # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.request_ip_reservation201_response import RequestIPReservation201Response class TestRequestIPReservation201Response(unittest.TestCase): """RequestIPReservation201Response unit test stubs""" @@ -29,37 +26,37 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> RequestIPReservation201Response: """Test RequestIPReservation201Response include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `RequestIPReservation201Response` """ - model = equinix_metal.models.request_ip_reservation201_response.RequestIPReservation201Response() # noqa: E501 - if include_optional : + model = RequestIPReservation201Response() + if include_optional: return RequestIPReservation201Response( - addon = True, - address = '', - address_family = 56, + addon = True, + address = '', + address_family = 56, assignments = [ equinix_metal.models.href.Href( href = '', ) - ], - available = '', - bill = True, - cidr = 56, - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - customdata = equinix_metal.models.customdata.customdata(), - details = '', - enabled = True, - facility = None, - gateway = '', - global_ip = True, - href = '', - id = '', - manageable = True, - management = True, + ], + available = '', + bill = True, + cidr = 56, + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + customdata = equinix_metal.models.customdata.customdata(), + details = '', + enabled = True, + facility = None, + gateway = '', + global_ip = True, + href = '', + id = '', + manageable = True, + management = True, metal_gateway = equinix_metal.models.metal_gateway_lite.MetalGatewayLite( created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), gateway_address = '10.1.2.1/27', @@ -67,15 +64,15 @@ def make_instance(self, include_optional): id = '', state = 'ready', updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - vlan = 1001, ), + vlan = 1001, ), metro = equinix_metal.models.metro.Metro( code = '', country = '', href = '', id = '', - name = '', ), - netmask = '', - network = '', + name = '', ), + netmask = '', + network = '', project = equinix_metal.models.project.Project( backend_transfer_enabled = True, bgp_config = equinix_metal.models.href.Href( @@ -112,7 +109,7 @@ def make_instance(self, include_optional): updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), volumes = [ - ], ), + ], ), project_lite = equinix_metal.models.project.Project( backend_transfer_enabled = True, bgp_config = equinix_metal.models.href.Href( @@ -149,17 +146,17 @@ def make_instance(self, include_optional): updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), volumes = [ - ], ), - public = True, + ], ), + public = True, requested_by = equinix_metal.models.href.Href( - href = '', ), - state = '', + href = '', ), + state = '', tags = [ '' - ], - type = 'global_ipv4', + ], + type = 'global_ipv4', created_by = equinix_metal.models.href.Href( - href = '', ), + href = '', ), vrf = equinix_metal.models.vrf.Vrf( bgp_dynamic_neighbors_bfd_enabled = True, bgp_dynamic_neighbors_enabled = True, @@ -278,7 +275,7 @@ def make_instance(self, include_optional): updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), ), ) ], ) ) - else : + else: return RequestIPReservation201Response( type = 'global_ipv4', vrf = equinix_metal.models.vrf.Vrf( diff --git a/equinix_metal/test/test_request_ip_reservation_request.py b/equinix_metal/test/test_request_ip_reservation_request.py index 00161b3d..d3beceab 100644 --- a/equinix_metal/test/test_request_ip_reservation_request.py +++ b/equinix_metal/test/test_request_ip_reservation_request.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.request_ip_reservation_request import RequestIPReservationRequest # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.request_ip_reservation_request import RequestIPReservationRequest class TestRequestIPReservationRequest(unittest.TestCase): """RequestIPReservationRequest unit test stubs""" @@ -29,33 +26,33 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> RequestIPReservationRequest: """Test RequestIPReservationRequest include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `RequestIPReservationRequest` """ - model = equinix_metal.models.request_ip_reservation_request.RequestIPReservationRequest() # noqa: E501 - if include_optional : + model = RequestIPReservationRequest() + if include_optional: return RequestIPReservationRequest( - comments = '', - customdata = equinix_metal.models.customdata.customdata(), - details = '', - facility = '', - fail_on_approval_required = True, - href = '', - metro = 'SV', - quantity = 56, + comments = '', + customdata = equinix_metal.models.customdata.customdata(), + details = '', + facility = '', + fail_on_approval_required = True, + href = '', + metro = 'SV', + quantity = 56, tags = [ '' - ], - type = 'vrf', - cidr = 16, - network = '10.1.2.0', + ], + type = 'vrf', + cidr = 16, + network = '10.1.2.0', vrf_id = '' ) - else : + else: return RequestIPReservationRequest( quantity = 56, type = 'vrf', diff --git a/equinix_metal/test/test_self_service_reservation_item_request.py b/equinix_metal/test/test_self_service_reservation_item_request.py index 904b78b8..19c6d31f 100644 --- a/equinix_metal/test/test_self_service_reservation_item_request.py +++ b/equinix_metal/test/test_self_service_reservation_item_request.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.self_service_reservation_item_request import SelfServiceReservationItemRequest # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.self_service_reservation_item_request import SelfServiceReservationItemRequest class TestSelfServiceReservationItemRequest(unittest.TestCase): """SelfServiceReservationItemRequest unit test stubs""" @@ -29,24 +26,24 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> SelfServiceReservationItemRequest: """Test SelfServiceReservationItemRequest include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `SelfServiceReservationItemRequest` """ - model = equinix_metal.models.self_service_reservation_item_request.SelfServiceReservationItemRequest() # noqa: E501 - if include_optional : + model = SelfServiceReservationItemRequest() + if include_optional: return SelfServiceReservationItemRequest( - amount = 1.337, - href = '', - metro_id = '', - plan_id = '', - quantity = 56, + amount = 1.337, + href = '', + metro_id = '', + plan_id = '', + quantity = 56, term = '' ) - else : + else: return SelfServiceReservationItemRequest( ) """ diff --git a/equinix_metal/test/test_self_service_reservation_item_response.py b/equinix_metal/test/test_self_service_reservation_item_response.py index cb83c743..0b85820a 100644 --- a/equinix_metal/test/test_self_service_reservation_item_response.py +++ b/equinix_metal/test/test_self_service_reservation_item_response.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.self_service_reservation_item_response import SelfServiceReservationItemResponse # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.self_service_reservation_item_response import SelfServiceReservationItemResponse class TestSelfServiceReservationItemResponse(unittest.TestCase): """SelfServiceReservationItemResponse unit test stubs""" @@ -29,22 +26,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> SelfServiceReservationItemResponse: """Test SelfServiceReservationItemResponse include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `SelfServiceReservationItemResponse` """ - model = equinix_metal.models.self_service_reservation_item_response.SelfServiceReservationItemResponse() # noqa: E501 - if include_optional : + model = SelfServiceReservationItemResponse() + if include_optional: return SelfServiceReservationItemResponse( - amount = 1.337, - href = '', - id = '', - metro_code = '', - metro_id = '', - metro_name = '', + amount = 1.337, + href = '', + id = '', + metro_code = '', + metro_id = '', + metro_name = '', plan = equinix_metal.models.plan.Plan( available_in = [ equinix_metal.models.plan_available_in_inner.Plan_available_in_inner( @@ -102,17 +99,17 @@ class = 'm3.large.x86', href = '', type = '', ) ], ), - type = 'standard', ), + type = 'standard', ), plan_categories = [ '' - ], - plan_id = '', - plan_name = '', - plan_slug = '', - quantity = 56, + ], + plan_id = '', + plan_name = '', + plan_slug = '', + quantity = 56, term = '' ) - else : + else: return SelfServiceReservationItemResponse( ) """ diff --git a/equinix_metal/test/test_self_service_reservation_list.py b/equinix_metal/test/test_self_service_reservation_list.py index b9e40bfa..607e2518 100644 --- a/equinix_metal/test/test_self_service_reservation_list.py +++ b/equinix_metal/test/test_self_service_reservation_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.self_service_reservation_list import SelfServiceReservationList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.self_service_reservation_list import SelfServiceReservationList class TestSelfServiceReservationList(unittest.TestCase): """SelfServiceReservationList unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> SelfServiceReservationList: """Test SelfServiceReservationList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `SelfServiceReservationList` """ - model = equinix_metal.models.self_service_reservation_list.SelfServiceReservationList() # noqa: E501 - if include_optional : + model = SelfServiceReservationList() + if include_optional: return SelfServiceReservationList( - href = '', + href = '', reservations = [ equinix_metal.models.self_service_reservation_response.SelfServiceReservationResponse( created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), @@ -133,7 +130,7 @@ class = 'm3.large.x86', total_cost = 56, ) ] ) - else : + else: return SelfServiceReservationList( ) """ diff --git a/equinix_metal/test/test_self_service_reservation_response.py b/equinix_metal/test/test_self_service_reservation_response.py index 748304d8..b4dabbbb 100644 --- a/equinix_metal/test/test_self_service_reservation_response.py +++ b/equinix_metal/test/test_self_service_reservation_response.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.self_service_reservation_response import SelfServiceReservationResponse # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.self_service_reservation_response import SelfServiceReservationResponse class TestSelfServiceReservationResponse(unittest.TestCase): """SelfServiceReservationResponse unit test stubs""" @@ -29,18 +26,18 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> SelfServiceReservationResponse: """Test SelfServiceReservationResponse include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `SelfServiceReservationResponse` """ - model = equinix_metal.models.self_service_reservation_response.SelfServiceReservationResponse() # noqa: E501 - if include_optional : + model = SelfServiceReservationResponse() + if include_optional: return SelfServiceReservationResponse( - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - href = '', + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + href = '', item = [ equinix_metal.models.self_service_reservation_item_response.SelfServiceReservationItemResponse( amount = 1.337, @@ -115,21 +112,21 @@ class = 'm3.large.x86', plan_slug = '', quantity = 56, term = '', ) - ], - notes = '', - organization = '', - organization_id = '', + ], + notes = '', + organization = '', + organization_id = '', period = equinix_metal.models.create_self_service_reservation_request_period.CreateSelfServiceReservationRequest_period( count = 12, href = '', - unit = 'monthly', ), - project = '', - project_id = '', - start_date = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - status = '', + unit = 'monthly', ), + project = '', + project_id = '', + start_date = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + status = '', total_cost = 56 ) - else : + else: return SelfServiceReservationResponse( ) """ diff --git a/equinix_metal/test/test_self_service_reservations_api.py b/equinix_metal/test/test_self_service_reservations_api.py index 23f7400c..c477cc9a 100644 --- a/equinix_metal/test/test_self_service_reservations_api.py +++ b/equinix_metal/test/test_self_service_reservations_api.py @@ -15,38 +15,36 @@ import unittest -import equinix_metal -from equinix_metal.api.self_service_reservations_api import SelfServiceReservationsApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.self_service_reservations_api import SelfServiceReservationsApi class TestSelfServiceReservationsApi(unittest.TestCase): """SelfServiceReservationsApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.self_service_reservations_api.SelfServiceReservationsApi() # noqa: E501 + def setUp(self) -> None: + self.api = SelfServiceReservationsApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_create_self_service_reservation(self): + def test_create_self_service_reservation(self) -> None: """Test case for create_self_service_reservation - Create a reservation # noqa: E501 + Create a reservation """ pass - def test_find_self_service_reservation(self): + def test_find_self_service_reservation(self) -> None: """Test case for find_self_service_reservation - Retrieve a reservation # noqa: E501 + Retrieve a reservation """ pass - def test_find_self_service_reservations(self): + def test_find_self_service_reservations(self) -> None: """Test case for find_self_service_reservations - Retrieve all reservations # noqa: E501 + Retrieve all reservations """ pass diff --git a/equinix_metal/test/test_server_info.py b/equinix_metal/test/test_server_info.py index e5dffa4f..0e04588c 100644 --- a/equinix_metal/test/test_server_info.py +++ b/equinix_metal/test/test_server_info.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.server_info import ServerInfo # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.server_info import ServerInfo class TestServerInfo(unittest.TestCase): """ServerInfo unit test stubs""" @@ -29,23 +26,23 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> ServerInfo: """Test ServerInfo include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `ServerInfo` """ - model = equinix_metal.models.server_info.ServerInfo() # noqa: E501 - if include_optional : + model = ServerInfo() + if include_optional: return ServerInfo( - facility = '', - href = '', - metro = '', - plan = '', + facility = '', + href = '', + metro = '', + plan = '', quantity = '' ) - else : + else: return ServerInfo( ) """ diff --git a/equinix_metal/test/test_shared_port_vc_vlan_create_input.py b/equinix_metal/test/test_shared_port_vc_vlan_create_input.py index 4a6825d4..510ab2db 100644 --- a/equinix_metal/test/test_shared_port_vc_vlan_create_input.py +++ b/equinix_metal/test/test_shared_port_vc_vlan_create_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.shared_port_vc_vlan_create_input import SharedPortVCVlanCreateInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.shared_port_vc_vlan_create_input import SharedPortVCVlanCreateInput class TestSharedPortVCVlanCreateInput(unittest.TestCase): """SharedPortVCVlanCreateInput unit test stubs""" @@ -29,30 +26,30 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> SharedPortVCVlanCreateInput: """Test SharedPortVCVlanCreateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `SharedPortVCVlanCreateInput` """ - model = equinix_metal.models.shared_port_vc_vlan_create_input.SharedPortVCVlanCreateInput() # noqa: E501 - if include_optional : + model = SharedPortVCVlanCreateInput() + if include_optional: return SharedPortVCVlanCreateInput( - contact_email = '', - description = '', - href = '', - metro = '', - name = '', - project = '', - speed = '10000000000', + contact_email = '', + description = '', + href = '', + metro = '', + name = '', + project = '', + speed = '10000000000', tags = [ '' - ], - type = 'shared_port_vlan', + ], + type = 'shared_port_vlan', vlans = [1000,1001] ) - else : + else: return SharedPortVCVlanCreateInput( metro = '', name = '', diff --git a/equinix_metal/test/test_spot_market_api.py b/equinix_metal/test/test_spot_market_api.py index 8fe0fc50..7fbca92a 100644 --- a/equinix_metal/test/test_spot_market_api.py +++ b/equinix_metal/test/test_spot_market_api.py @@ -15,66 +15,64 @@ import unittest -import equinix_metal -from equinix_metal.api.spot_market_api import SpotMarketApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.spot_market_api import SpotMarketApi class TestSpotMarketApi(unittest.TestCase): """SpotMarketApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.spot_market_api.SpotMarketApi() # noqa: E501 + def setUp(self) -> None: + self.api = SpotMarketApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_create_spot_market_request(self): + def test_create_spot_market_request(self) -> None: """Test case for create_spot_market_request - Create a spot market request # noqa: E501 + Create a spot market request """ pass - def test_delete_spot_market_request(self): + def test_delete_spot_market_request(self) -> None: """Test case for delete_spot_market_request - Delete the spot market request # noqa: E501 + Delete the spot market request """ pass - def test_find_metro_spot_market_prices(self): + def test_find_metro_spot_market_prices(self) -> None: """Test case for find_metro_spot_market_prices - Get current spot market prices for metros # noqa: E501 + Get current spot market prices for metros """ pass - def test_find_spot_market_prices(self): + def test_find_spot_market_prices(self) -> None: """Test case for find_spot_market_prices - Get current spot market prices # noqa: E501 + Get current spot market prices """ pass - def test_find_spot_market_prices_history(self): + def test_find_spot_market_prices_history(self) -> None: """Test case for find_spot_market_prices_history - Get spot market prices for a given period of time # noqa: E501 + Get spot market prices for a given period of time """ pass - def test_find_spot_market_request_by_id(self): + def test_find_spot_market_request_by_id(self) -> None: """Test case for find_spot_market_request_by_id - Retrieve a spot market request # noqa: E501 + Retrieve a spot market request """ pass - def test_list_spot_market_requests(self): + def test_list_spot_market_requests(self) -> None: """Test case for list_spot_market_requests - List spot market requests # noqa: E501 + List spot market requests """ pass diff --git a/equinix_metal/test/test_spot_market_prices_list.py b/equinix_metal/test/test_spot_market_prices_list.py index 4f4c6038..7223416a 100644 --- a/equinix_metal/test/test_spot_market_prices_list.py +++ b/equinix_metal/test/test_spot_market_prices_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.spot_market_prices_list import SpotMarketPricesList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.spot_market_prices_list import SpotMarketPricesList class TestSpotMarketPricesList(unittest.TestCase): """SpotMarketPricesList unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> SpotMarketPricesList: """Test SpotMarketPricesList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `SpotMarketPricesList` """ - model = equinix_metal.models.spot_market_prices_list.SpotMarketPricesList() # noqa: E501 - if include_optional : + model = SpotMarketPricesList() + if include_optional: return SpotMarketPricesList( - href = '', + href = '', spot_market_prices = equinix_metal.models.spot_prices_report.SpotPricesReport( ams1 = equinix_metal.models.spot_prices_per_facility.SpotPricesPerFacility( baremetal_0 = equinix_metal.models.spot_prices_per_baremetal.SpotPricesPerBaremetal( @@ -75,7 +72,7 @@ def make_instance(self, include_optional): syd1 = , yyz1 = , ) ) - else : + else: return SpotMarketPricesList( ) """ diff --git a/equinix_metal/test/test_spot_market_prices_per_metro_list.py b/equinix_metal/test/test_spot_market_prices_per_metro_list.py index 520f2dca..9c08514d 100644 --- a/equinix_metal/test/test_spot_market_prices_per_metro_list.py +++ b/equinix_metal/test/test_spot_market_prices_per_metro_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.spot_market_prices_per_metro_list import SpotMarketPricesPerMetroList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.spot_market_prices_per_metro_list import SpotMarketPricesPerMetroList class TestSpotMarketPricesPerMetroList(unittest.TestCase): """SpotMarketPricesPerMetroList unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> SpotMarketPricesPerMetroList: """Test SpotMarketPricesPerMetroList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `SpotMarketPricesPerMetroList` """ - model = equinix_metal.models.spot_market_prices_per_metro_list.SpotMarketPricesPerMetroList() # noqa: E501 - if include_optional : + model = SpotMarketPricesPerMetroList() + if include_optional: return SpotMarketPricesPerMetroList( - href = '', + href = '', spot_market_prices = equinix_metal.models.spot_market_prices_per_metro_report.SpotMarketPricesPerMetroReport( am = equinix_metal.models.spot_prices_per_facility.SpotPricesPerFacility( baremetal_0 = equinix_metal.models.spot_prices_per_baremetal.SpotPricesPerBaremetal( @@ -65,7 +62,7 @@ def make_instance(self, include_optional): sg = , sv = , ) ) - else : + else: return SpotMarketPricesPerMetroList( ) """ diff --git a/equinix_metal/test/test_spot_market_prices_per_metro_report.py b/equinix_metal/test/test_spot_market_prices_per_metro_report.py index 713f1c5e..ebe491a1 100644 --- a/equinix_metal/test/test_spot_market_prices_per_metro_report.py +++ b/equinix_metal/test/test_spot_market_prices_per_metro_report.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.spot_market_prices_per_metro_report import SpotMarketPricesPerMetroReport # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.spot_market_prices_per_metro_report import SpotMarketPricesPerMetroReport class TestSpotMarketPricesPerMetroReport(unittest.TestCase): """SpotMarketPricesPerMetroReport unit test stubs""" @@ -29,15 +26,15 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> SpotMarketPricesPerMetroReport: """Test SpotMarketPricesPerMetroReport include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `SpotMarketPricesPerMetroReport` """ - model = equinix_metal.models.spot_market_prices_per_metro_report.SpotMarketPricesPerMetroReport() # noqa: E501 - if include_optional : + model = SpotMarketPricesPerMetroReport() + if include_optional: return SpotMarketPricesPerMetroReport( am = equinix_metal.models.spot_prices_per_facility.SpotPricesPerFacility( baremetal_0 = equinix_metal.models.spot_prices_per_baremetal.SpotPricesPerBaremetal( @@ -53,7 +50,7 @@ def make_instance(self, include_optional): baremetal_s = , c2/medium/x86 = , href = '', - m2/xlarge/x86 = , ), + m2/xlarge/x86 = , ), ch = equinix_metal.models.spot_prices_per_facility.SpotPricesPerFacility( baremetal_0 = equinix_metal.models.spot_prices_per_baremetal.SpotPricesPerBaremetal( href = '', @@ -68,7 +65,7 @@ def make_instance(self, include_optional): baremetal_s = , c2/medium/x86 = , href = '', - m2/xlarge/x86 = , ), + m2/xlarge/x86 = , ), da = equinix_metal.models.spot_prices_per_facility.SpotPricesPerFacility( baremetal_0 = equinix_metal.models.spot_prices_per_baremetal.SpotPricesPerBaremetal( href = '', @@ -83,8 +80,8 @@ def make_instance(self, include_optional): baremetal_s = , c2/medium/x86 = , href = '', - m2/xlarge/x86 = , ), - href = '', + m2/xlarge/x86 = , ), + href = '', la = equinix_metal.models.spot_prices_per_facility.SpotPricesPerFacility( baremetal_0 = equinix_metal.models.spot_prices_per_baremetal.SpotPricesPerBaremetal( href = '', @@ -99,7 +96,7 @@ def make_instance(self, include_optional): baremetal_s = , c2/medium/x86 = , href = '', - m2/xlarge/x86 = , ), + m2/xlarge/x86 = , ), ny = equinix_metal.models.spot_prices_per_facility.SpotPricesPerFacility( baremetal_0 = equinix_metal.models.spot_prices_per_baremetal.SpotPricesPerBaremetal( href = '', @@ -114,7 +111,7 @@ def make_instance(self, include_optional): baremetal_s = , c2/medium/x86 = , href = '', - m2/xlarge/x86 = , ), + m2/xlarge/x86 = , ), sg = equinix_metal.models.spot_prices_per_facility.SpotPricesPerFacility( baremetal_0 = equinix_metal.models.spot_prices_per_baremetal.SpotPricesPerBaremetal( href = '', @@ -129,7 +126,7 @@ def make_instance(self, include_optional): baremetal_s = , c2/medium/x86 = , href = '', - m2/xlarge/x86 = , ), + m2/xlarge/x86 = , ), sv = equinix_metal.models.spot_prices_per_facility.SpotPricesPerFacility( baremetal_0 = equinix_metal.models.spot_prices_per_baremetal.SpotPricesPerBaremetal( href = '', @@ -146,7 +143,7 @@ def make_instance(self, include_optional): href = '', m2/xlarge/x86 = , ) ) - else : + else: return SpotMarketPricesPerMetroReport( ) """ diff --git a/equinix_metal/test/test_spot_market_request.py b/equinix_metal/test/test_spot_market_request.py index 8844c51b..4513ae50 100644 --- a/equinix_metal/test/test_spot_market_request.py +++ b/equinix_metal/test/test_spot_market_request.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.spot_market_request import SpotMarketRequest # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.spot_market_request import SpotMarketRequest class TestSpotMarketRequest(unittest.TestCase): """SpotMarketRequest unit test stubs""" @@ -29,32 +26,32 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> SpotMarketRequest: """Test SpotMarketRequest include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `SpotMarketRequest` """ - model = equinix_metal.models.spot_market_request.SpotMarketRequest() # noqa: E501 - if include_optional : + model = SpotMarketRequest() + if include_optional: return SpotMarketRequest( - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - devices_max = 56, - devices_min = 56, - end_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + devices_max = 56, + devices_min = 56, + end_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), facilities = equinix_metal.models.href.Href( - href = '', ), - href = '', - id = '', + href = '', ), + href = '', + id = '', instances = equinix_metal.models.href.Href( - href = '', ), - max_bid_price = 1.337, - metro = None, + href = '', ), + max_bid_price = 1.337, + metro = None, project = equinix_metal.models.href.Href( href = '', ) ) - else : + else: return SpotMarketRequest( ) """ diff --git a/equinix_metal/test/test_spot_market_request_create_input.py b/equinix_metal/test/test_spot_market_request_create_input.py index 4006c516..c5621115 100644 --- a/equinix_metal/test/test_spot_market_request_create_input.py +++ b/equinix_metal/test/test_spot_market_request_create_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.spot_market_request_create_input import SpotMarketRequestCreateInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.spot_market_request_create_input import SpotMarketRequestCreateInput class TestSpotMarketRequestCreateInput(unittest.TestCase): """SpotMarketRequestCreateInput unit test stubs""" @@ -29,23 +26,23 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> SpotMarketRequestCreateInput: """Test SpotMarketRequestCreateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `SpotMarketRequestCreateInput` """ - model = equinix_metal.models.spot_market_request_create_input.SpotMarketRequestCreateInput() # noqa: E501 - if include_optional : + model = SpotMarketRequestCreateInput() + if include_optional: return SpotMarketRequestCreateInput( - devices_max = 56, - devices_min = 56, - end_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + devices_max = 56, + devices_min = 56, + end_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), facilities = [ '' - ], - href = '', + ], + href = '', instance_parameters = equinix_metal.models.spot_market_request_create_input_instance_parameters.SpotMarketRequestCreateInput_instance_parameters( always_pxe = True, billing_cycle = '', @@ -75,11 +72,11 @@ def make_instance(self, include_optional): user_ssh_keys = [ '' ], - userdata = '', ), - max_bid_price = 1.337, + userdata = '', ), + max_bid_price = 1.337, metro = '' ) - else : + else: return SpotMarketRequestCreateInput( ) """ diff --git a/equinix_metal/test/test_spot_market_request_create_input_instance_parameters.py b/equinix_metal/test/test_spot_market_request_create_input_instance_parameters.py index 5fbcfd65..004805c1 100644 --- a/equinix_metal/test/test_spot_market_request_create_input_instance_parameters.py +++ b/equinix_metal/test/test_spot_market_request_create_input_instance_parameters.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.spot_market_request_create_input_instance_parameters import SpotMarketRequestCreateInputInstanceParameters # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.spot_market_request_create_input_instance_parameters import SpotMarketRequestCreateInputInstanceParameters class TestSpotMarketRequestCreateInputInstanceParameters(unittest.TestCase): """SpotMarketRequestCreateInputInstanceParameters unit test stubs""" @@ -29,47 +26,47 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> SpotMarketRequestCreateInputInstanceParameters: """Test SpotMarketRequestCreateInputInstanceParameters include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `SpotMarketRequestCreateInputInstanceParameters` """ - model = equinix_metal.models.spot_market_request_create_input_instance_parameters.SpotMarketRequestCreateInputInstanceParameters() # noqa: E501 - if include_optional : + model = SpotMarketRequestCreateInputInstanceParameters() + if include_optional: return SpotMarketRequestCreateInputInstanceParameters( - always_pxe = True, - billing_cycle = '', - customdata = equinix_metal.models.customdata.customdata(), - description = '', + always_pxe = True, + billing_cycle = '', + customdata = equinix_metal.models.customdata.customdata(), + description = '', features = [ '' - ], - hostname = '', + ], + hostname = '', hostnames = [ '' - ], - href = '', - locked = True, - no_ssh_keys = True, - operating_system = '', - plan = '', - private_ipv4_subnet_size = 56, + ], + href = '', + locked = True, + no_ssh_keys = True, + operating_system = '', + plan = '', + private_ipv4_subnet_size = 56, project_ssh_keys = [ '' - ], - public_ipv4_subnet_size = 56, + ], + public_ipv4_subnet_size = 56, tags = [ '' - ], - termination_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + ], + termination_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), user_ssh_keys = [ '' - ], + ], userdata = '' ) - else : + else: return SpotMarketRequestCreateInputInstanceParameters( ) """ diff --git a/equinix_metal/test/test_spot_market_request_list.py b/equinix_metal/test/test_spot_market_request_list.py index fc7be432..a2c57fba 100644 --- a/equinix_metal/test/test_spot_market_request_list.py +++ b/equinix_metal/test/test_spot_market_request_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.spot_market_request_list import SpotMarketRequestList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.spot_market_request_list import SpotMarketRequestList class TestSpotMarketRequestList(unittest.TestCase): """SpotMarketRequestList unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> SpotMarketRequestList: """Test SpotMarketRequestList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `SpotMarketRequestList` """ - model = equinix_metal.models.spot_market_request_list.SpotMarketRequestList() # noqa: E501 - if include_optional : + model = SpotMarketRequestList() + if include_optional: return SpotMarketRequestList( - href = '', + href = '', spot_market_requests = [ equinix_metal.models.spot_market_request.SpotMarketRequest( created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), @@ -57,7 +54,7 @@ def make_instance(self, include_optional): project = , ) ] ) - else : + else: return SpotMarketRequestList( ) """ diff --git a/equinix_metal/test/test_spot_market_request_metro.py b/equinix_metal/test/test_spot_market_request_metro.py index 71ecd12f..4450c14f 100644 --- a/equinix_metal/test/test_spot_market_request_metro.py +++ b/equinix_metal/test/test_spot_market_request_metro.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.spot_market_request_metro import SpotMarketRequestMetro # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.spot_market_request_metro import SpotMarketRequestMetro class TestSpotMarketRequestMetro(unittest.TestCase): """SpotMarketRequestMetro unit test stubs""" @@ -29,23 +26,23 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> SpotMarketRequestMetro: """Test SpotMarketRequestMetro include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `SpotMarketRequestMetro` """ - model = equinix_metal.models.spot_market_request_metro.SpotMarketRequestMetro() # noqa: E501 - if include_optional : + model = SpotMarketRequestMetro() + if include_optional: return SpotMarketRequestMetro( - code = '', - country = '', - href = '', - id = '', + code = '', + country = '', + href = '', + id = '', name = '' ) - else : + else: return SpotMarketRequestMetro( ) """ diff --git a/equinix_metal/test/test_spot_prices_datapoints.py b/equinix_metal/test/test_spot_prices_datapoints.py index 8201b40f..92450218 100644 --- a/equinix_metal/test/test_spot_prices_datapoints.py +++ b/equinix_metal/test/test_spot_prices_datapoints.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.spot_prices_datapoints import SpotPricesDatapoints # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.spot_prices_datapoints import SpotPricesDatapoints class TestSpotPricesDatapoints(unittest.TestCase): """SpotPricesDatapoints unit test stubs""" @@ -29,24 +26,24 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> SpotPricesDatapoints: """Test SpotPricesDatapoints include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `SpotPricesDatapoints` """ - model = equinix_metal.models.spot_prices_datapoints.SpotPricesDatapoints() # noqa: E501 - if include_optional : + model = SpotPricesDatapoints() + if include_optional: return SpotPricesDatapoints( datapoints = [ [ 1.337 ] - ], + ], href = '' ) - else : + else: return SpotPricesDatapoints( ) """ diff --git a/equinix_metal/test/test_spot_prices_history_report.py b/equinix_metal/test/test_spot_prices_history_report.py index ee9f1fc9..85fe4ffe 100644 --- a/equinix_metal/test/test_spot_prices_history_report.py +++ b/equinix_metal/test/test_spot_prices_history_report.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.spot_prices_history_report import SpotPricesHistoryReport # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.spot_prices_history_report import SpotPricesHistoryReport class TestSpotPricesHistoryReport(unittest.TestCase): """SpotPricesHistoryReport unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> SpotPricesHistoryReport: """Test SpotPricesHistoryReport include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `SpotPricesHistoryReport` """ - model = equinix_metal.models.spot_prices_history_report.SpotPricesHistoryReport() # noqa: E501 - if include_optional : + model = SpotPricesHistoryReport() + if include_optional: return SpotPricesHistoryReport( - href = '', + href = '', prices_history = equinix_metal.models.spot_prices_datapoints.SpotPricesDatapoints( datapoints = [ [ @@ -48,7 +45,7 @@ def make_instance(self, include_optional): ], href = '', ) ) - else : + else: return SpotPricesHistoryReport( ) """ diff --git a/equinix_metal/test/test_spot_prices_per_baremetal.py b/equinix_metal/test/test_spot_prices_per_baremetal.py index 0179d4d0..cb4a5540 100644 --- a/equinix_metal/test/test_spot_prices_per_baremetal.py +++ b/equinix_metal/test/test_spot_prices_per_baremetal.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.spot_prices_per_baremetal import SpotPricesPerBaremetal # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.spot_prices_per_baremetal import SpotPricesPerBaremetal class TestSpotPricesPerBaremetal(unittest.TestCase): """SpotPricesPerBaremetal unit test stubs""" @@ -29,20 +26,20 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> SpotPricesPerBaremetal: """Test SpotPricesPerBaremetal include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `SpotPricesPerBaremetal` """ - model = equinix_metal.models.spot_prices_per_baremetal.SpotPricesPerBaremetal() # noqa: E501 - if include_optional : + model = SpotPricesPerBaremetal() + if include_optional: return SpotPricesPerBaremetal( - href = '', + href = '', price = 1.337 ) - else : + else: return SpotPricesPerBaremetal( ) """ diff --git a/equinix_metal/test/test_spot_prices_per_facility.py b/equinix_metal/test/test_spot_prices_per_facility.py index 28cc7644..a0360583 100644 --- a/equinix_metal/test/test_spot_prices_per_facility.py +++ b/equinix_metal/test/test_spot_prices_per_facility.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.spot_prices_per_facility import SpotPricesPerFacility # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.spot_prices_per_facility import SpotPricesPerFacility class TestSpotPricesPerFacility(unittest.TestCase): """SpotPricesPerFacility unit test stubs""" @@ -29,46 +26,46 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> SpotPricesPerFacility: """Test SpotPricesPerFacility include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `SpotPricesPerFacility` """ - model = equinix_metal.models.spot_prices_per_facility.SpotPricesPerFacility() # noqa: E501 - if include_optional : + model = SpotPricesPerFacility() + if include_optional: return SpotPricesPerFacility( baremetal_0 = equinix_metal.models.spot_prices_per_baremetal.SpotPricesPerBaremetal( href = '', - price = 1.337, ), + price = 1.337, ), baremetal_1 = equinix_metal.models.spot_prices_per_baremetal.SpotPricesPerBaremetal( href = '', - price = 1.337, ), + price = 1.337, ), baremetal_2 = equinix_metal.models.spot_prices_per_baremetal.SpotPricesPerBaremetal( href = '', - price = 1.337, ), + price = 1.337, ), baremetal_2a = equinix_metal.models.spot_prices_per_baremetal.SpotPricesPerBaremetal( href = '', - price = 1.337, ), + price = 1.337, ), baremetal_2a2 = equinix_metal.models.spot_prices_per_baremetal.SpotPricesPerBaremetal( href = '', - price = 1.337, ), + price = 1.337, ), baremetal_3 = equinix_metal.models.spot_prices_per_baremetal.SpotPricesPerBaremetal( href = '', - price = 1.337, ), + price = 1.337, ), baremetal_s = equinix_metal.models.spot_prices_per_baremetal.SpotPricesPerBaremetal( href = '', - price = 1.337, ), + price = 1.337, ), c2_medium_x86 = equinix_metal.models.spot_prices_per_baremetal.SpotPricesPerBaremetal( href = '', - price = 1.337, ), - href = '', + price = 1.337, ), + href = '', m2_xlarge_x86 = equinix_metal.models.spot_prices_per_baremetal.SpotPricesPerBaremetal( href = '', price = 1.337, ) ) - else : + else: return SpotPricesPerFacility( ) """ diff --git a/equinix_metal/test/test_spot_prices_per_new_facility.py b/equinix_metal/test/test_spot_prices_per_new_facility.py index fa775929..7f6eb09a 100644 --- a/equinix_metal/test/test_spot_prices_per_new_facility.py +++ b/equinix_metal/test/test_spot_prices_per_new_facility.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.spot_prices_per_new_facility import SpotPricesPerNewFacility # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.spot_prices_per_new_facility import SpotPricesPerNewFacility class TestSpotPricesPerNewFacility(unittest.TestCase): """SpotPricesPerNewFacility unit test stubs""" @@ -29,22 +26,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> SpotPricesPerNewFacility: """Test SpotPricesPerNewFacility include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `SpotPricesPerNewFacility` """ - model = equinix_metal.models.spot_prices_per_new_facility.SpotPricesPerNewFacility() # noqa: E501 - if include_optional : + model = SpotPricesPerNewFacility() + if include_optional: return SpotPricesPerNewFacility( baremetal_1e = equinix_metal.models.spot_prices_per_baremetal.SpotPricesPerBaremetal( href = '', - price = 1.337, ), + price = 1.337, ), href = '' ) - else : + else: return SpotPricesPerNewFacility( ) """ diff --git a/equinix_metal/test/test_spot_prices_report.py b/equinix_metal/test/test_spot_prices_report.py index b49832b8..9a356c33 100644 --- a/equinix_metal/test/test_spot_prices_report.py +++ b/equinix_metal/test/test_spot_prices_report.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.spot_prices_report import SpotPricesReport # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.spot_prices_report import SpotPricesReport class TestSpotPricesReport(unittest.TestCase): """SpotPricesReport unit test stubs""" @@ -29,15 +26,15 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> SpotPricesReport: """Test SpotPricesReport include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `SpotPricesReport` """ - model = equinix_metal.models.spot_prices_report.SpotPricesReport() # noqa: E501 - if include_optional : + model = SpotPricesReport() + if include_optional: return SpotPricesReport( ams1 = equinix_metal.models.spot_prices_per_facility.SpotPricesPerFacility( baremetal_0 = equinix_metal.models.spot_prices_per_baremetal.SpotPricesPerBaremetal( @@ -53,17 +50,17 @@ def make_instance(self, include_optional): baremetal_s = , c2/medium/x86 = , href = '', - m2/xlarge/x86 = , ), + m2/xlarge/x86 = , ), atl1 = equinix_metal.models.spot_prices_per_new_facility.SpotPricesPerNewFacility( baremetal_1e = equinix_metal.models.spot_prices_per_baremetal.SpotPricesPerBaremetal( href = '', price = 1.337, ), - href = '', ), + href = '', ), dfw1 = equinix_metal.models.spot_prices_per_new_facility.SpotPricesPerNewFacility( baremetal_1e = equinix_metal.models.spot_prices_per_baremetal.SpotPricesPerBaremetal( href = '', price = 1.337, ), - href = '', ), + href = '', ), ewr1 = equinix_metal.models.spot_prices_per_facility.SpotPricesPerFacility( baremetal_0 = equinix_metal.models.spot_prices_per_baremetal.SpotPricesPerBaremetal( href = '', @@ -78,23 +75,23 @@ def make_instance(self, include_optional): baremetal_s = , c2/medium/x86 = , href = '', - m2/xlarge/x86 = , ), + m2/xlarge/x86 = , ), fra1 = equinix_metal.models.spot_prices_per_new_facility.SpotPricesPerNewFacility( baremetal_1e = equinix_metal.models.spot_prices_per_baremetal.SpotPricesPerBaremetal( href = '', price = 1.337, ), - href = '', ), - href = '', + href = '', ), + href = '', iad1 = equinix_metal.models.spot_prices_per_new_facility.SpotPricesPerNewFacility( baremetal_1e = equinix_metal.models.spot_prices_per_baremetal.SpotPricesPerBaremetal( href = '', price = 1.337, ), - href = '', ), + href = '', ), lax1 = equinix_metal.models.spot_prices_per_new_facility.SpotPricesPerNewFacility( baremetal_1e = equinix_metal.models.spot_prices_per_baremetal.SpotPricesPerBaremetal( href = '', price = 1.337, ), - href = '', ), + href = '', ), nrt1 = equinix_metal.models.spot_prices_per_facility.SpotPricesPerFacility( baremetal_0 = equinix_metal.models.spot_prices_per_baremetal.SpotPricesPerBaremetal( href = '', @@ -109,22 +106,22 @@ def make_instance(self, include_optional): baremetal_s = , c2/medium/x86 = , href = '', - m2/xlarge/x86 = , ), + m2/xlarge/x86 = , ), ord1 = equinix_metal.models.spot_prices_per_new_facility.SpotPricesPerNewFacility( baremetal_1e = equinix_metal.models.spot_prices_per_baremetal.SpotPricesPerBaremetal( href = '', price = 1.337, ), - href = '', ), + href = '', ), sea1 = equinix_metal.models.spot_prices_per_new_facility.SpotPricesPerNewFacility( baremetal_1e = equinix_metal.models.spot_prices_per_baremetal.SpotPricesPerBaremetal( href = '', price = 1.337, ), - href = '', ), + href = '', ), sin1 = equinix_metal.models.spot_prices_per_new_facility.SpotPricesPerNewFacility( baremetal_1e = equinix_metal.models.spot_prices_per_baremetal.SpotPricesPerBaremetal( href = '', price = 1.337, ), - href = '', ), + href = '', ), sjc1 = equinix_metal.models.spot_prices_per_facility.SpotPricesPerFacility( baremetal_0 = equinix_metal.models.spot_prices_per_baremetal.SpotPricesPerBaremetal( href = '', @@ -139,19 +136,19 @@ def make_instance(self, include_optional): baremetal_s = , c2/medium/x86 = , href = '', - m2/xlarge/x86 = , ), + m2/xlarge/x86 = , ), syd1 = equinix_metal.models.spot_prices_per_new_facility.SpotPricesPerNewFacility( baremetal_1e = equinix_metal.models.spot_prices_per_baremetal.SpotPricesPerBaremetal( href = '', price = 1.337, ), - href = '', ), + href = '', ), yyz1 = equinix_metal.models.spot_prices_per_new_facility.SpotPricesPerNewFacility( baremetal_1e = equinix_metal.models.spot_prices_per_baremetal.SpotPricesPerBaremetal( href = '', price = 1.337, ), href = '', ) ) - else : + else: return SpotPricesReport( ) """ diff --git a/equinix_metal/test/test_ssh_key.py b/equinix_metal/test/test_ssh_key.py index 53f224cd..c607e9ba 100644 --- a/equinix_metal/test/test_ssh_key.py +++ b/equinix_metal/test/test_ssh_key.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.ssh_key import SSHKey # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.ssh_key import SSHKey class TestSSHKey(unittest.TestCase): """SSHKey unit test stubs""" @@ -29,30 +26,30 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> SSHKey: """Test SSHKey include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `SSHKey` """ - model = equinix_metal.models.ssh_key.SSHKey() # noqa: E501 - if include_optional : + model = SSHKey() + if include_optional: return SSHKey( - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), entity = equinix_metal.models.href.Href( - href = '', ), - fingerprint = '', - href = '', - id = '', - key = '', - label = '', + href = '', ), + fingerprint = '', + href = '', + id = '', + key = '', + label = '', tags = [ '' - ], + ], updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f') ) - else : + else: return SSHKey( ) """ diff --git a/equinix_metal/test/test_ssh_key_create_input.py b/equinix_metal/test/test_ssh_key_create_input.py index 8df3c9d8..9ba16344 100644 --- a/equinix_metal/test/test_ssh_key_create_input.py +++ b/equinix_metal/test/test_ssh_key_create_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.ssh_key_create_input import SSHKeyCreateInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.ssh_key_create_input import SSHKeyCreateInput class TestSSHKeyCreateInput(unittest.TestCase): """SSHKeyCreateInput unit test stubs""" @@ -29,27 +26,27 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> SSHKeyCreateInput: """Test SSHKeyCreateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `SSHKeyCreateInput` """ - model = equinix_metal.models.ssh_key_create_input.SSHKeyCreateInput() # noqa: E501 - if include_optional : + model = SSHKeyCreateInput() + if include_optional: return SSHKeyCreateInput( - href = '', + href = '', instances_ids = [ '' - ], - key = '', - label = '', + ], + key = '', + label = '', tags = [ '' ] ) - else : + else: return SSHKeyCreateInput( ) """ diff --git a/equinix_metal/test/test_ssh_key_input.py b/equinix_metal/test/test_ssh_key_input.py index 65e754aa..f08ece90 100644 --- a/equinix_metal/test/test_ssh_key_input.py +++ b/equinix_metal/test/test_ssh_key_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.ssh_key_input import SSHKeyInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.ssh_key_input import SSHKeyInput class TestSSHKeyInput(unittest.TestCase): """SSHKeyInput unit test stubs""" @@ -29,24 +26,24 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> SSHKeyInput: """Test SSHKeyInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `SSHKeyInput` """ - model = equinix_metal.models.ssh_key_input.SSHKeyInput() # noqa: E501 - if include_optional : + model = SSHKeyInput() + if include_optional: return SSHKeyInput( - href = '', - key = '', - label = '', + href = '', + key = '', + label = '', tags = [ '' ] ) - else : + else: return SSHKeyInput( ) """ diff --git a/equinix_metal/test/test_ssh_key_list.py b/equinix_metal/test/test_ssh_key_list.py index f0ea3548..7f5a6ff9 100644 --- a/equinix_metal/test/test_ssh_key_list.py +++ b/equinix_metal/test/test_ssh_key_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.ssh_key_list import SSHKeyList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.ssh_key_list import SSHKeyList class TestSSHKeyList(unittest.TestCase): """SSHKeyList unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> SSHKeyList: """Test SSHKeyList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `SSHKeyList` """ - model = equinix_metal.models.ssh_key_list.SSHKeyList() # noqa: E501 - if include_optional : + model = SSHKeyList() + if include_optional: return SSHKeyList( - href = '', + href = '', ssh_keys = [ equinix_metal.models.ssh_key.SSHKey( created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), @@ -56,7 +53,7 @@ def make_instance(self, include_optional): updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), ) ] ) - else : + else: return SSHKeyList( ) """ diff --git a/equinix_metal/test/test_ssh_keys_api.py b/equinix_metal/test/test_ssh_keys_api.py index ac2427f7..b2f73eaa 100644 --- a/equinix_metal/test/test_ssh_keys_api.py +++ b/equinix_metal/test/test_ssh_keys_api.py @@ -15,73 +15,71 @@ import unittest -import equinix_metal -from equinix_metal.api.ssh_keys_api import SSHKeysApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.ssh_keys_api import SSHKeysApi class TestSSHKeysApi(unittest.TestCase): """SSHKeysApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.ssh_keys_api.SSHKeysApi() # noqa: E501 + def setUp(self) -> None: + self.api = SSHKeysApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_create_project_ssh_key(self): + def test_create_project_ssh_key(self) -> None: """Test case for create_project_ssh_key - Create a ssh key for the given project # noqa: E501 + Create a ssh key for the given project """ pass - def test_create_ssh_key(self): + def test_create_ssh_key(self) -> None: """Test case for create_ssh_key - Create a ssh key for the current user # noqa: E501 + Create a ssh key for the current user """ pass - def test_delete_ssh_key(self): + def test_delete_ssh_key(self) -> None: """Test case for delete_ssh_key - Delete the ssh key # noqa: E501 + Delete the ssh key """ pass - def test_find_device_ssh_keys(self): + def test_find_device_ssh_keys(self) -> None: """Test case for find_device_ssh_keys - Retrieve a device's ssh keys # noqa: E501 + Retrieve a device's ssh keys """ pass - def test_find_project_ssh_keys(self): + def test_find_project_ssh_keys(self) -> None: """Test case for find_project_ssh_keys - Retrieve a project's ssh keys # noqa: E501 + Retrieve a project's ssh keys """ pass - def test_find_ssh_key_by_id(self): + def test_find_ssh_key_by_id(self) -> None: """Test case for find_ssh_key_by_id - Retrieve a ssh key # noqa: E501 + Retrieve a ssh key """ pass - def test_find_ssh_keys(self): + def test_find_ssh_keys(self) -> None: """Test case for find_ssh_keys - Retrieve all ssh keys # noqa: E501 + Retrieve all ssh keys """ pass - def test_update_ssh_key(self): + def test_update_ssh_key(self) -> None: """Test case for update_ssh_key - Update the ssh key # noqa: E501 + Update the ssh key """ pass diff --git a/equinix_metal/test/test_storage.py b/equinix_metal/test/test_storage.py index 96063bf6..37e95f7d 100644 --- a/equinix_metal/test/test_storage.py +++ b/equinix_metal/test/test_storage.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.storage import Storage # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.storage import Storage class TestStorage(unittest.TestCase): """Storage unit test stubs""" @@ -29,15 +26,15 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Storage: """Test Storage include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Storage` """ - model = equinix_metal.models.storage.Storage() # noqa: E501 - if include_optional : + model = Storage() + if include_optional: return Storage( disks = [ equinix_metal.models.disk.Disk( @@ -51,7 +48,7 @@ def make_instance(self, include_optional): size = '', ) ], wipe_table = True, ) - ], + ], filesystems = [ equinix_metal.models.filesystem.Filesystem( href = '', @@ -63,8 +60,8 @@ def make_instance(self, include_optional): '' ], point = '', ), ) - ], - href = '', + ], + href = '', raid = [ equinix_metal.models.raid.Raid( devices = [ @@ -75,7 +72,7 @@ def make_instance(self, include_optional): name = '', ) ] ) - else : + else: return Storage( ) """ diff --git a/equinix_metal/test/test_support_request_api.py b/equinix_metal/test/test_support_request_api.py index 35b4fc70..a9bb4df4 100644 --- a/equinix_metal/test/test_support_request_api.py +++ b/equinix_metal/test/test_support_request_api.py @@ -15,24 +15,22 @@ import unittest -import equinix_metal -from equinix_metal.api.support_request_api import SupportRequestApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.support_request_api import SupportRequestApi class TestSupportRequestApi(unittest.TestCase): """SupportRequestApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.support_request_api.SupportRequestApi() # noqa: E501 + def setUp(self) -> None: + self.api = SupportRequestApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_request_suppert(self): + def test_request_suppert(self) -> None: """Test case for request_suppert - Create a support ticket # noqa: E501 + Create a support ticket """ pass diff --git a/equinix_metal/test/test_support_request_input.py b/equinix_metal/test/test_support_request_input.py index 9b186ece..f11ac26b 100644 --- a/equinix_metal/test/test_support_request_input.py +++ b/equinix_metal/test/test_support_request_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.support_request_input import SupportRequestInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.support_request_input import SupportRequestInput class TestSupportRequestInput(unittest.TestCase): """SupportRequestInput unit test stubs""" @@ -29,24 +26,24 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> SupportRequestInput: """Test SupportRequestInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `SupportRequestInput` """ - model = equinix_metal.models.support_request_input.SupportRequestInput() # noqa: E501 - if include_optional : + model = SupportRequestInput() + if include_optional: return SupportRequestInput( - device_id = '', - href = '', - message = '', - priority = 'urgent', - project_id = '', + device_id = '', + href = '', + message = '', + priority = 'urgent', + project_id = '', subject = '' ) - else : + else: return SupportRequestInput( message = '', subject = '', diff --git a/equinix_metal/test/test_transfer_request.py b/equinix_metal/test/test_transfer_request.py index 9e4ed5d3..08f67bb5 100644 --- a/equinix_metal/test/test_transfer_request.py +++ b/equinix_metal/test/test_transfer_request.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.transfer_request import TransferRequest # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.transfer_request import TransferRequest class TestTransferRequest(unittest.TestCase): """TransferRequest unit test stubs""" @@ -29,26 +26,26 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> TransferRequest: """Test TransferRequest include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `TransferRequest` """ - model = equinix_metal.models.transfer_request.TransferRequest() # noqa: E501 - if include_optional : + model = TransferRequest() + if include_optional: return TransferRequest( - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - href = '', - id = '', + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + href = '', + id = '', project = equinix_metal.models.href.Href( - href = '', ), + href = '', ), target_organization = equinix_metal.models.href.Href( - href = '', ), + href = '', ), updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f') ) - else : + else: return TransferRequest( ) """ diff --git a/equinix_metal/test/test_transfer_request_input.py b/equinix_metal/test/test_transfer_request_input.py index e7df9f74..520e7aee 100644 --- a/equinix_metal/test/test_transfer_request_input.py +++ b/equinix_metal/test/test_transfer_request_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.transfer_request_input import TransferRequestInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.transfer_request_input import TransferRequestInput class TestTransferRequestInput(unittest.TestCase): """TransferRequestInput unit test stubs""" @@ -29,20 +26,20 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> TransferRequestInput: """Test TransferRequestInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `TransferRequestInput` """ - model = equinix_metal.models.transfer_request_input.TransferRequestInput() # noqa: E501 - if include_optional : + model = TransferRequestInput() + if include_optional: return TransferRequestInput( - href = '', + href = '', target_organization_id = '' ) - else : + else: return TransferRequestInput( ) """ diff --git a/equinix_metal/test/test_transfer_request_list.py b/equinix_metal/test/test_transfer_request_list.py index 9627c11d..8a4b35dd 100644 --- a/equinix_metal/test/test_transfer_request_list.py +++ b/equinix_metal/test/test_transfer_request_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.transfer_request_list import TransferRequestList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.transfer_request_list import TransferRequestList class TestTransferRequestList(unittest.TestCase): """TransferRequestList unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> TransferRequestList: """Test TransferRequestList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `TransferRequestList` """ - model = equinix_metal.models.transfer_request_list.TransferRequestList() # noqa: E501 - if include_optional : + model = TransferRequestList() + if include_optional: return TransferRequestList( - href = '', + href = '', transfers = [ equinix_metal.models.transfer_request.TransferRequest( created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), @@ -52,7 +49,7 @@ def make_instance(self, include_optional): updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), ) ] ) - else : + else: return TransferRequestList( ) """ diff --git a/equinix_metal/test/test_transfer_requests_api.py b/equinix_metal/test/test_transfer_requests_api.py index 6a6b9734..4994bc19 100644 --- a/equinix_metal/test/test_transfer_requests_api.py +++ b/equinix_metal/test/test_transfer_requests_api.py @@ -15,38 +15,36 @@ import unittest -import equinix_metal -from equinix_metal.api.transfer_requests_api import TransferRequestsApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.transfer_requests_api import TransferRequestsApi class TestTransferRequestsApi(unittest.TestCase): """TransferRequestsApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.transfer_requests_api.TransferRequestsApi() # noqa: E501 + def setUp(self) -> None: + self.api = TransferRequestsApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_accept_transfer_request(self): + def test_accept_transfer_request(self) -> None: """Test case for accept_transfer_request - Accept a transfer request # noqa: E501 + Accept a transfer request """ pass - def test_decline_transfer_request(self): + def test_decline_transfer_request(self) -> None: """Test case for decline_transfer_request - Decline a transfer request # noqa: E501 + Decline a transfer request """ pass - def test_find_transfer_request_by_id(self): + def test_find_transfer_request_by_id(self) -> None: """Test case for find_transfer_request_by_id - View a transfer request # noqa: E501 + View a transfer request """ pass diff --git a/equinix_metal/test/test_two_factor_auth_api.py b/equinix_metal/test/test_two_factor_auth_api.py index d7472b4b..fee506bf 100644 --- a/equinix_metal/test/test_two_factor_auth_api.py +++ b/equinix_metal/test/test_two_factor_auth_api.py @@ -15,45 +15,43 @@ import unittest -import equinix_metal -from equinix_metal.api.two_factor_auth_api import TwoFactorAuthApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.two_factor_auth_api import TwoFactorAuthApi class TestTwoFactorAuthApi(unittest.TestCase): """TwoFactorAuthApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.two_factor_auth_api.TwoFactorAuthApi() # noqa: E501 + def setUp(self) -> None: + self.api = TwoFactorAuthApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_disable_tfa_app(self): + def test_disable_tfa_app(self) -> None: """Test case for disable_tfa_app - Disable two factor authentication # noqa: E501 + Disable two factor authentication """ pass - def test_disable_tfa_sms(self): + def test_disable_tfa_sms(self) -> None: """Test case for disable_tfa_sms - Disable two factor authentication # noqa: E501 + Disable two factor authentication """ pass - def test_enable_tfa_app(self): + def test_enable_tfa_app(self) -> None: """Test case for enable_tfa_app - Enable two factor auth using app # noqa: E501 + Enable two factor auth using app """ pass - def test_enable_tfa_sms(self): + def test_enable_tfa_sms(self) -> None: """Test case for enable_tfa_sms - Enable two factor auth using sms # noqa: E501 + Enable two factor auth using sms """ pass diff --git a/equinix_metal/test/test_update_email_input.py b/equinix_metal/test/test_update_email_input.py index 4146ce98..03bf1cf9 100644 --- a/equinix_metal/test/test_update_email_input.py +++ b/equinix_metal/test/test_update_email_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.update_email_input import UpdateEmailInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.update_email_input import UpdateEmailInput class TestUpdateEmailInput(unittest.TestCase): """UpdateEmailInput unit test stubs""" @@ -29,20 +26,20 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> UpdateEmailInput: """Test UpdateEmailInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `UpdateEmailInput` """ - model = equinix_metal.models.update_email_input.UpdateEmailInput() # noqa: E501 - if include_optional : + model = UpdateEmailInput() + if include_optional: return UpdateEmailInput( - default = True, + default = True, href = '' ) - else : + else: return UpdateEmailInput( ) """ diff --git a/equinix_metal/test/test_usages_api.py b/equinix_metal/test/test_usages_api.py index 06adbe50..337e079c 100644 --- a/equinix_metal/test/test_usages_api.py +++ b/equinix_metal/test/test_usages_api.py @@ -15,31 +15,29 @@ import unittest -import equinix_metal -from equinix_metal.api.usages_api import UsagesApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.usages_api import UsagesApi class TestUsagesApi(unittest.TestCase): """UsagesApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.usages_api.UsagesApi() # noqa: E501 + def setUp(self) -> None: + self.api = UsagesApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_find_device_usages(self): + def test_find_device_usages(self) -> None: """Test case for find_device_usages - Retrieve all usages for device # noqa: E501 + Retrieve all usages for device """ pass - def test_find_project_usage(self): + def test_find_project_usage(self) -> None: """Test case for find_project_usage - Retrieve all usages for project # noqa: E501 + Retrieve all usages for project """ pass diff --git a/equinix_metal/test/test_user.py b/equinix_metal/test/test_user.py index fe7ed5a3..3aa0f1f7 100644 --- a/equinix_metal/test/test_user.py +++ b/equinix_metal/test/test_user.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.user import User # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.user import User class TestUser(unittest.TestCase): """User unit test stubs""" @@ -29,43 +26,43 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> User: """Test User include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `User` """ - model = equinix_metal.models.user.User() # noqa: E501 - if include_optional : + model = User() + if include_optional: return User( - avatar_thumb_url = '', - avatar_url = '', - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - customdata = equinix_metal.models.customdata.customdata(), - default_organization_id = '', - default_project_id = '', - email = '', + avatar_thumb_url = '', + avatar_url = '', + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + customdata = equinix_metal.models.customdata.customdata(), + default_organization_id = '', + default_project_id = '', + email = '', emails = [ equinix_metal.models.href.Href( href = '', ) - ], - first_name = '', - fraud_score = '', - full_name = '', - href = '', - id = '', - last_login_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - last_name = '', - max_organizations = 56, - max_projects = 56, - phone_number = '', - short_id = '', - timezone = '', - two_factor_auth = '', + ], + first_name = '', + fraud_score = '', + full_name = '', + href = '', + id = '', + last_login_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + last_name = '', + max_organizations = 56, + max_projects = 56, + phone_number = '', + short_id = '', + timezone = '', + two_factor_auth = '', updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f') ) - else : + else: return User( ) """ diff --git a/equinix_metal/test/test_user_create_input.py b/equinix_metal/test/test_user_create_input.py index 040d8adb..8fe60b02 100644 --- a/equinix_metal/test/test_user_create_input.py +++ b/equinix_metal/test/test_user_create_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.user_create_input import UserCreateInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.user_create_input import UserCreateInput class TestUserCreateInput(unittest.TestCase): """UserCreateInput unit test stubs""" @@ -29,41 +26,41 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> UserCreateInput: """Test UserCreateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `UserCreateInput` """ - model = equinix_metal.models.user_create_input.UserCreateInput() # noqa: E501 - if include_optional : + model = UserCreateInput() + if include_optional: return UserCreateInput( - avatar = bytes(b'blah'), - company_name = '', - company_url = '', - customdata = None, + avatar = bytes(b'blah'), + company_name = '', + company_url = '', + customdata = None, emails = [ equinix_metal.models.email_input.EmailInput( address = '', default = True, href = '', ) - ], - first_name = '', - href = '', - invitation_id = '', - last_name = '', - level = '', - nonce = '', - password = '', - phone_number = '', - social_accounts = None, - timezone = '', - title = '', - two_factor_auth = '', + ], + first_name = '', + href = '', + invitation_id = '', + last_name = '', + level = '', + nonce = '', + password = '', + phone_number = '', + social_accounts = None, + timezone = '', + title = '', + two_factor_auth = '', verified_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f') ) - else : + else: return UserCreateInput( emails = [ equinix_metal.models.email_input.EmailInput( diff --git a/equinix_metal/test/test_user_limited.py b/equinix_metal/test/test_user_limited.py index bc3bc0bf..058b96ff 100644 --- a/equinix_metal/test/test_user_limited.py +++ b/equinix_metal/test/test_user_limited.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.user_limited import UserLimited # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.user_limited import UserLimited class TestUserLimited(unittest.TestCase): """UserLimited unit test stubs""" @@ -29,23 +26,23 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> UserLimited: """Test UserLimited include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `UserLimited` """ - model = equinix_metal.models.user_limited.UserLimited() # noqa: E501 - if include_optional : + model = UserLimited() + if include_optional: return UserLimited( - avatar_thumb_url = '', - avatar_url = '', - full_name = '', - href = '', + avatar_thumb_url = '', + avatar_url = '', + full_name = '', + href = '', id = '' ) - else : + else: return UserLimited( id = '', ) diff --git a/equinix_metal/test/test_user_list.py b/equinix_metal/test/test_user_list.py index 7b37995b..42235dab 100644 --- a/equinix_metal/test/test_user_list.py +++ b/equinix_metal/test/test_user_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.user_list import UserList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.user_list import UserList class TestUserList(unittest.TestCase): """UserList unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> UserList: """Test UserList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `UserList` """ - model = equinix_metal.models.user_list.UserList() # noqa: E501 - if include_optional : + model = UserList() + if include_optional: return UserList( - href = '', + href = '', meta = equinix_metal.models.meta.Meta( current_page = 56, first = equinix_metal.models.href.Href( @@ -51,7 +48,7 @@ def make_instance(self, include_optional): next = , previous = , self = , - total = 56, ), + total = 56, ), users = [ equinix_metal.models.user.User( avatar_thumb_url = '', @@ -81,7 +78,7 @@ def make_instance(self, include_optional): updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), ) ] ) - else : + else: return UserList( ) """ diff --git a/equinix_metal/test/test_user_lite.py b/equinix_metal/test/test_user_lite.py index 7bf255fa..15d46aa3 100644 --- a/equinix_metal/test/test_user_lite.py +++ b/equinix_metal/test/test_user_lite.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.user_lite import UserLite # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.user_lite import UserLite class TestUserLite(unittest.TestCase): """UserLite unit test stubs""" @@ -29,28 +26,28 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> UserLite: """Test UserLite include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `UserLite` """ - model = equinix_metal.models.user_lite.UserLite() # noqa: E501 - if include_optional : + model = UserLite() + if include_optional: return UserLite( - avatar_thumb_url = '', - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - email = '', - first_name = '', - full_name = '', - href = '', - id = '', - last_name = '', - short_id = '', + avatar_thumb_url = '', + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + email = '', + first_name = '', + full_name = '', + href = '', + id = '', + last_name = '', + short_id = '', updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f') ) - else : + else: return UserLite( id = '', short_id = '', diff --git a/equinix_metal/test/test_user_update_input.py b/equinix_metal/test/test_user_update_input.py index ed397048..6351649e 100644 --- a/equinix_metal/test/test_user_update_input.py +++ b/equinix_metal/test/test_user_update_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.user_update_input import UserUpdateInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.user_update_input import UserUpdateInput class TestUserUpdateInput(unittest.TestCase): """UserUpdateInput unit test stubs""" @@ -29,25 +26,25 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> UserUpdateInput: """Test UserUpdateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `UserUpdateInput` """ - model = equinix_metal.models.user_update_input.UserUpdateInput() # noqa: E501 - if include_optional : + model = UserUpdateInput() + if include_optional: return UserUpdateInput( - customdata = None, - first_name = '', - href = '', - last_name = '', - password = '', - phone_number = '', + customdata = None, + first_name = '', + href = '', + last_name = '', + password = '', + phone_number = '', timezone = '' ) - else : + else: return UserUpdateInput( ) """ diff --git a/equinix_metal/test/test_user_verification_tokens_api.py b/equinix_metal/test/test_user_verification_tokens_api.py index 4b2f1f95..615afb0d 100644 --- a/equinix_metal/test/test_user_verification_tokens_api.py +++ b/equinix_metal/test/test_user_verification_tokens_api.py @@ -15,31 +15,29 @@ import unittest -import equinix_metal -from equinix_metal.api.user_verification_tokens_api import UserVerificationTokensApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.user_verification_tokens_api import UserVerificationTokensApi class TestUserVerificationTokensApi(unittest.TestCase): """UserVerificationTokensApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.user_verification_tokens_api.UserVerificationTokensApi() # noqa: E501 + def setUp(self) -> None: + self.api = UserVerificationTokensApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_consume_verification_request(self): + def test_consume_verification_request(self) -> None: """Test case for consume_verification_request - Verify a user using an email verification token # noqa: E501 + Verify a user using an email verification token """ pass - def test_create_validation_request(self): + def test_create_validation_request(self) -> None: """Test case for create_validation_request - Create an email verification request # noqa: E501 + Create an email verification request """ pass diff --git a/equinix_metal/test/test_userdata.py b/equinix_metal/test/test_userdata.py index b1de0010..51c9ae78 100644 --- a/equinix_metal/test/test_userdata.py +++ b/equinix_metal/test/test_userdata.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.userdata import Userdata # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.userdata import Userdata class TestUserdata(unittest.TestCase): """Userdata unit test stubs""" @@ -29,20 +26,20 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Userdata: """Test Userdata include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Userdata` """ - model = equinix_metal.models.userdata.Userdata() # noqa: E501 - if include_optional : + model = Userdata() + if include_optional: return Userdata( - href = '', + href = '', userdata = '' ) - else : + else: return Userdata( ) """ diff --git a/equinix_metal/test/test_userdata_api.py b/equinix_metal/test/test_userdata_api.py index ed5c1e16..e8032c22 100644 --- a/equinix_metal/test/test_userdata_api.py +++ b/equinix_metal/test/test_userdata_api.py @@ -15,24 +15,22 @@ import unittest -import equinix_metal -from equinix_metal.api.userdata_api import UserdataApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.userdata_api import UserdataApi class TestUserdataApi(unittest.TestCase): """UserdataApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.userdata_api.UserdataApi() # noqa: E501 + def setUp(self) -> None: + self.api = UserdataApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_validate_userdata(self): + def test_validate_userdata(self) -> None: """Test case for validate_userdata - Validate user data # noqa: E501 + Validate user data """ pass diff --git a/equinix_metal/test/test_users_api.py b/equinix_metal/test/test_users_api.py index 24c0c97f..495cfea9 100644 --- a/equinix_metal/test/test_users_api.py +++ b/equinix_metal/test/test_users_api.py @@ -15,59 +15,57 @@ import unittest -import equinix_metal -from equinix_metal.api.users_api import UsersApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.users_api import UsersApi class TestUsersApi(unittest.TestCase): """UsersApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.users_api.UsersApi() # noqa: E501 + def setUp(self) -> None: + self.api = UsersApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_create_user(self): + def test_create_user(self) -> None: """Test case for create_user - Create a user # noqa: E501 + Create a user """ pass - def test_find_current_user(self): + def test_find_current_user(self) -> None: """Test case for find_current_user - Retrieve the current user # noqa: E501 + Retrieve the current user """ pass - def test_find_invitations(self): + def test_find_invitations(self) -> None: """Test case for find_invitations - Retrieve current user invitations # noqa: E501 + Retrieve current user invitations """ pass - def test_find_user_by_id(self): + def test_find_user_by_id(self) -> None: """Test case for find_user_by_id - Retrieve a user # noqa: E501 + Retrieve a user """ pass - def test_find_user_customdata(self): + def test_find_user_customdata(self) -> None: """Test case for find_user_customdata - Retrieve the custom metadata of a user # noqa: E501 + Retrieve the custom metadata of a user """ pass - def test_find_users(self): + def test_find_users(self) -> None: """Test case for find_users - Retrieve all users # noqa: E501 + Retrieve all users """ pass @@ -78,10 +76,10 @@ def test_find_users_all_pages(self): """ pass - def test_update_current_user(self): + def test_update_current_user(self) -> None: """Test case for update_current_user - Update the current user # noqa: E501 + Update the current user """ pass diff --git a/equinix_metal/test/test_verify_email.py b/equinix_metal/test/test_verify_email.py index b9f85dfe..29a9c9eb 100644 --- a/equinix_metal/test/test_verify_email.py +++ b/equinix_metal/test/test_verify_email.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.verify_email import VerifyEmail # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.verify_email import VerifyEmail class TestVerifyEmail(unittest.TestCase): """VerifyEmail unit test stubs""" @@ -29,20 +26,20 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> VerifyEmail: """Test VerifyEmail include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `VerifyEmail` """ - model = equinix_metal.models.verify_email.VerifyEmail() # noqa: E501 - if include_optional : + model = VerifyEmail() + if include_optional: return VerifyEmail( - href = '', + href = '', user_token = '' ) - else : + else: return VerifyEmail( user_token = '', ) diff --git a/equinix_metal/test/test_virtual_circuit.py b/equinix_metal/test/test_virtual_circuit.py index 9986dc12..60cb08c9 100644 --- a/equinix_metal/test/test_virtual_circuit.py +++ b/equinix_metal/test/test_virtual_circuit.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.virtual_circuit import VirtualCircuit # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.virtual_circuit import VirtualCircuit class TestVirtualCircuit(unittest.TestCase): """VirtualCircuit unit test stubs""" @@ -29,43 +26,43 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> VirtualCircuit: """Test VirtualCircuit include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `VirtualCircuit` """ - model = equinix_metal.models.virtual_circuit.VirtualCircuit() # noqa: E501 - if include_optional : + model = VirtualCircuit() + if include_optional: return VirtualCircuit( - bill = True, - bill_type = 'metal_billed', - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - description = '', - href = '', - id = '', - name = '', - nni_vlan = 56, + bill = True, + bill_type = 'metal_billed', + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + description = '', + href = '', + id = '', + name = '', + nni_vlan = 56, port = equinix_metal.models.href.Href( - href = '', ), + href = '', ), project = equinix_metal.models.href.Href( - href = '', ), - speed = 56, - status = 'pending', + href = '', ), + speed = 56, + status = 'pending', tags = [ '' - ], - type = 'vlan', - updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + ], + type = 'vlan', + updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), virtual_network = equinix_metal.models.href.Href( - href = '', ), - vnid = 56, - customer_ip = '12.0.0.2', - md5 = '', - metal_ip = '12.0.0.1', - peer_asn = 56, - subnet = '12.0.0.0/30', + href = '', ), + vnid = 56, + customer_ip = '12.0.0.2', + md5 = '', + metal_ip = '12.0.0.1', + peer_asn = 56, + subnet = '12.0.0.0/30', vrf = equinix_metal.models.vrf.Vrf( bgp_dynamic_neighbors_bfd_enabled = True, bgp_dynamic_neighbors_enabled = True, @@ -184,7 +181,7 @@ def make_instance(self, include_optional): updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), ), ) ], ) ) - else : + else: return VirtualCircuit( vrf = equinix_metal.models.vrf.Vrf( bgp_dynamic_neighbors_bfd_enabled = True, diff --git a/equinix_metal/test/test_virtual_circuit_create_input.py b/equinix_metal/test/test_virtual_circuit_create_input.py index df0d5434..083d2303 100644 --- a/equinix_metal/test/test_virtual_circuit_create_input.py +++ b/equinix_metal/test/test_virtual_circuit_create_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.virtual_circuit_create_input import VirtualCircuitCreateInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.virtual_circuit_create_input import VirtualCircuitCreateInput class TestVirtualCircuitCreateInput(unittest.TestCase): """VirtualCircuitCreateInput unit test stubs""" @@ -29,34 +26,34 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> VirtualCircuitCreateInput: """Test VirtualCircuitCreateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `VirtualCircuitCreateInput` """ - model = equinix_metal.models.virtual_circuit_create_input.VirtualCircuitCreateInput() # noqa: E501 - if include_optional : + model = VirtualCircuitCreateInput() + if include_optional: return VirtualCircuitCreateInput( - description = '', - href = '', - name = '', - nni_vlan = 2, - project_id = '', - speed = '', + description = '', + href = '', + name = '', + nni_vlan = 2, + project_id = '', + speed = '', tags = [ '' - ], - vnid = '', - customer_ip = '12.0.0.2', - md5 = 'jUR,rZ#UM/?R,Fp^l6$ARjeJk C>i H'qT\\{i H'qT\\{ VirtualCircuitList: """Test VirtualCircuitList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `VirtualCircuitList` """ - model = equinix_metal.models.virtual_circuit_list.VirtualCircuitList() # noqa: E501 - if include_optional : + model = VirtualCircuitList() + if include_optional: return VirtualCircuitList( - href = '', + href = '', virtual_circuits = [ null ] ) - else : + else: return VirtualCircuitList( ) """ diff --git a/equinix_metal/test/test_virtual_circuit_update_input.py b/equinix_metal/test/test_virtual_circuit_update_input.py index 85a0d9bc..dc5308c1 100644 --- a/equinix_metal/test/test_virtual_circuit_update_input.py +++ b/equinix_metal/test/test_virtual_circuit_update_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.virtual_circuit_update_input import VirtualCircuitUpdateInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.virtual_circuit_update_input import VirtualCircuitUpdateInput class TestVirtualCircuitUpdateInput(unittest.TestCase): """VirtualCircuitUpdateInput unit test stubs""" @@ -29,31 +26,31 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> VirtualCircuitUpdateInput: """Test VirtualCircuitUpdateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `VirtualCircuitUpdateInput` """ - model = equinix_metal.models.virtual_circuit_update_input.VirtualCircuitUpdateInput() # noqa: E501 - if include_optional : + model = VirtualCircuitUpdateInput() + if include_optional: return VirtualCircuitUpdateInput( - description = '', - href = '', - name = '', - speed = '', + description = '', + href = '', + name = '', + speed = '', tags = [ '' - ], - vnid = '', - customer_ip = '12.0.0.2', - md5 = 'jUR,rZ#UM/?R,Fp^l6$ARjeJk C>i H'qT\\{i H'qT\\{ VirtualNetwork: """Test VirtualNetwork include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `VirtualNetwork` """ - model = equinix_metal.models.virtual_network.VirtualNetwork() # noqa: E501 - if include_optional : + model = VirtualNetwork() + if include_optional: return VirtualNetwork( assigned_to = equinix_metal.models.href.Href( - href = '', ), - assigned_to_virtual_circuit = True, - description = '', + href = '', ), + assigned_to_virtual_circuit = True, + description = '', facility = equinix_metal.models.href.Href( - href = '', ), - href = '', - id = '', + href = '', ), + href = '', + id = '', instances = [ equinix_metal.models.href.Href( href = '', ) - ], + ], metal_gateways = [ equinix_metal.models.metal_gateway_lite.MetalGatewayLite( created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), @@ -60,16 +57,16 @@ def make_instance(self, include_optional): state = 'ready', updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), vlan = 1001, ) - ], + ], metro = equinix_metal.models.href.Href( - href = '', ), - metro_code = '', + href = '', ), + metro_code = '', tags = [ '' - ], + ], vxlan = 56 ) - else : + else: return VirtualNetwork( ) """ diff --git a/equinix_metal/test/test_virtual_network_create_input.py b/equinix_metal/test/test_virtual_network_create_input.py index 8380baff..c037605f 100644 --- a/equinix_metal/test/test_virtual_network_create_input.py +++ b/equinix_metal/test/test_virtual_network_create_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.virtual_network_create_input import VirtualNetworkCreateInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.virtual_network_create_input import VirtualNetworkCreateInput class TestVirtualNetworkCreateInput(unittest.TestCase): """VirtualNetworkCreateInput unit test stubs""" @@ -29,26 +26,26 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> VirtualNetworkCreateInput: """Test VirtualNetworkCreateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `VirtualNetworkCreateInput` """ - model = equinix_metal.models.virtual_network_create_input.VirtualNetworkCreateInput() # noqa: E501 - if include_optional : + model = VirtualNetworkCreateInput() + if include_optional: return VirtualNetworkCreateInput( - description = '', - facility = '', - href = '', - metro = '', + description = '', + facility = '', + href = '', + metro = '', tags = [ '' - ], + ], vxlan = 1099 ) - else : + else: return VirtualNetworkCreateInput( ) """ diff --git a/equinix_metal/test/test_virtual_network_list.py b/equinix_metal/test/test_virtual_network_list.py index 6b06cd5a..3ceb4b2b 100644 --- a/equinix_metal/test/test_virtual_network_list.py +++ b/equinix_metal/test/test_virtual_network_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.virtual_network_list import VirtualNetworkList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.virtual_network_list import VirtualNetworkList class TestVirtualNetworkList(unittest.TestCase): """VirtualNetworkList unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> VirtualNetworkList: """Test VirtualNetworkList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `VirtualNetworkList` """ - model = equinix_metal.models.virtual_network_list.VirtualNetworkList() # noqa: E501 - if include_optional : + model = VirtualNetworkList() + if include_optional: return VirtualNetworkList( - href = '', + href = '', virtual_networks = [ equinix_metal.models.virtual_network.VirtualNetwork( assigned_to = equinix_metal.models.href.Href( @@ -71,7 +68,7 @@ def make_instance(self, include_optional): vxlan = 56, ) ] ) - else : + else: return VirtualNetworkList( ) """ diff --git a/equinix_metal/test/test_vlan_csp_connection_create_input.py b/equinix_metal/test/test_vlan_csp_connection_create_input.py index 9ea97a08..2a0c1235 100644 --- a/equinix_metal/test/test_vlan_csp_connection_create_input.py +++ b/equinix_metal/test/test_vlan_csp_connection_create_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.vlan_csp_connection_create_input import VlanCSPConnectionCreateInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.vlan_csp_connection_create_input import VlanCSPConnectionCreateInput class TestVlanCSPConnectionCreateInput(unittest.TestCase): """VlanCSPConnectionCreateInput unit test stubs""" @@ -29,31 +26,31 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> VlanCSPConnectionCreateInput: """Test VlanCSPConnectionCreateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `VlanCSPConnectionCreateInput` """ - model = equinix_metal.models.vlan_csp_connection_create_input.VlanCSPConnectionCreateInput() # noqa: E501 - if include_optional : + model = VlanCSPConnectionCreateInput() + if include_optional: return VlanCSPConnectionCreateInput( - contact_email = '', - description = '', - fabric_provider = None, - href = '', - metro = '', - name = '', - project = '', - speed = '10000000000', + contact_email = '', + description = '', + fabric_provider = None, + href = '', + metro = '', + name = '', + project = '', + speed = '10000000000', tags = [ '' - ], - type = 'shared_port_vlan_to_csp', + ], + type = 'shared_port_vlan_to_csp', vlans = [1000,1001] ) - else : + else: return VlanCSPConnectionCreateInput( fabric_provider = None, metro = '', diff --git a/equinix_metal/test/test_vlan_csp_connection_create_input_fabric_provider.py b/equinix_metal/test/test_vlan_csp_connection_create_input_fabric_provider.py index d3c1556f..31122e96 100644 --- a/equinix_metal/test/test_vlan_csp_connection_create_input_fabric_provider.py +++ b/equinix_metal/test/test_vlan_csp_connection_create_input_fabric_provider.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.vlan_csp_connection_create_input_fabric_provider import VlanCSPConnectionCreateInputFabricProvider # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.vlan_csp_connection_create_input_fabric_provider import VlanCSPConnectionCreateInputFabricProvider class TestVlanCSPConnectionCreateInputFabricProvider(unittest.TestCase): """VlanCSPConnectionCreateInputFabricProvider unit test stubs""" @@ -29,22 +26,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> VlanCSPConnectionCreateInputFabricProvider: """Test VlanCSPConnectionCreateInputFabricProvider include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `VlanCSPConnectionCreateInputFabricProvider` """ - model = equinix_metal.models.vlan_csp_connection_create_input_fabric_provider.VlanCSPConnectionCreateInputFabricProvider() # noqa: E501 - if include_optional : + model = VlanCSPConnectionCreateInputFabricProvider() + if include_optional: return VlanCSPConnectionCreateInputFabricProvider( - account_id = '129312', - href = '', - location = 'us-west-1', + account_id = '129312', + href = '', + location = 'us-west-1', type = 'CSP_AWS' ) - else : + else: return VlanCSPConnectionCreateInputFabricProvider( account_id = '129312', type = 'CSP_AWS', diff --git a/equinix_metal/test/test_vlan_fabric_vc_create_input.py b/equinix_metal/test/test_vlan_fabric_vc_create_input.py index 83be09ed..5a13ec82 100644 --- a/equinix_metal/test/test_vlan_fabric_vc_create_input.py +++ b/equinix_metal/test/test_vlan_fabric_vc_create_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.vlan_fabric_vc_create_input import VlanFabricVcCreateInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.vlan_fabric_vc_create_input import VlanFabricVcCreateInput class TestVlanFabricVcCreateInput(unittest.TestCase): """VlanFabricVcCreateInput unit test stubs""" @@ -29,32 +26,32 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> VlanFabricVcCreateInput: """Test VlanFabricVcCreateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `VlanFabricVcCreateInput` """ - model = equinix_metal.models.vlan_fabric_vc_create_input.VlanFabricVcCreateInput() # noqa: E501 - if include_optional : + model = VlanFabricVcCreateInput() + if include_optional: return VlanFabricVcCreateInput( - contact_email = '', - description = '', - href = '', - metro = '', - name = '', - project = '', - redundancy = '', - service_token_type = 'a_side', - speed = '10000000000', + contact_email = '', + description = '', + href = '', + metro = '', + name = '', + project = '', + redundancy = '', + service_token_type = 'a_side', + speed = '10000000000', tags = [ '' - ], - type = 'shared', + ], + type = 'shared', vlans = [1000,1001] ) - else : + else: return VlanFabricVcCreateInput( metro = '', name = '', diff --git a/equinix_metal/test/test_vlan_virtual_circuit.py b/equinix_metal/test/test_vlan_virtual_circuit.py index 5505ea3a..321cce7d 100644 --- a/equinix_metal/test/test_vlan_virtual_circuit.py +++ b/equinix_metal/test/test_vlan_virtual_circuit.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.vlan_virtual_circuit import VlanVirtualCircuit # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.vlan_virtual_circuit import VlanVirtualCircuit class TestVlanVirtualCircuit(unittest.TestCase): """VlanVirtualCircuit unit test stubs""" @@ -29,40 +26,40 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> VlanVirtualCircuit: """Test VlanVirtualCircuit include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `VlanVirtualCircuit` """ - model = equinix_metal.models.vlan_virtual_circuit.VlanVirtualCircuit() # noqa: E501 - if include_optional : + model = VlanVirtualCircuit() + if include_optional: return VlanVirtualCircuit( - bill = True, - bill_type = 'metal_billed', - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - description = '', - href = '', - id = '', - name = '', - nni_vlan = 56, + bill = True, + bill_type = 'metal_billed', + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + description = '', + href = '', + id = '', + name = '', + nni_vlan = 56, port = equinix_metal.models.href.Href( - href = '', ), + href = '', ), project = equinix_metal.models.href.Href( - href = '', ), - speed = 56, - status = 'pending', + href = '', ), + speed = 56, + status = 'pending', tags = [ '' - ], - type = 'vlan', - updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + ], + type = 'vlan', + updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), virtual_network = equinix_metal.models.href.Href( - href = '', ), + href = '', ), vnid = 56 ) - else : + else: return VlanVirtualCircuit( ) """ diff --git a/equinix_metal/test/test_vlan_virtual_circuit_create_input.py b/equinix_metal/test/test_vlan_virtual_circuit_create_input.py index 85a16f20..fc497da8 100644 --- a/equinix_metal/test/test_vlan_virtual_circuit_create_input.py +++ b/equinix_metal/test/test_vlan_virtual_circuit_create_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.vlan_virtual_circuit_create_input import VlanVirtualCircuitCreateInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.vlan_virtual_circuit_create_input import VlanVirtualCircuitCreateInput class TestVlanVirtualCircuitCreateInput(unittest.TestCase): """VlanVirtualCircuitCreateInput unit test stubs""" @@ -29,28 +26,28 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> VlanVirtualCircuitCreateInput: """Test VlanVirtualCircuitCreateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `VlanVirtualCircuitCreateInput` """ - model = equinix_metal.models.vlan_virtual_circuit_create_input.VlanVirtualCircuitCreateInput() # noqa: E501 - if include_optional : + model = VlanVirtualCircuitCreateInput() + if include_optional: return VlanVirtualCircuitCreateInput( - description = '', - href = '', - name = '', - nni_vlan = 2, - project_id = '', - speed = '', + description = '', + href = '', + name = '', + nni_vlan = 2, + project_id = '', + speed = '', tags = [ '' - ], + ], vnid = '' ) - else : + else: return VlanVirtualCircuitCreateInput( project_id = '', ) diff --git a/equinix_metal/test/test_vlan_virtual_circuit_update_input.py b/equinix_metal/test/test_vlan_virtual_circuit_update_input.py index 0ef9af1a..fd9a0d5d 100644 --- a/equinix_metal/test/test_vlan_virtual_circuit_update_input.py +++ b/equinix_metal/test/test_vlan_virtual_circuit_update_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.vlan_virtual_circuit_update_input import VlanVirtualCircuitUpdateInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.vlan_virtual_circuit_update_input import VlanVirtualCircuitUpdateInput class TestVlanVirtualCircuitUpdateInput(unittest.TestCase): """VlanVirtualCircuitUpdateInput unit test stubs""" @@ -29,26 +26,26 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> VlanVirtualCircuitUpdateInput: """Test VlanVirtualCircuitUpdateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `VlanVirtualCircuitUpdateInput` """ - model = equinix_metal.models.vlan_virtual_circuit_update_input.VlanVirtualCircuitUpdateInput() # noqa: E501 - if include_optional : + model = VlanVirtualCircuitUpdateInput() + if include_optional: return VlanVirtualCircuitUpdateInput( - description = '', - href = '', - name = '', - speed = '', + description = '', + href = '', + name = '', + speed = '', tags = [ '' - ], + ], vnid = '' ) - else : + else: return VlanVirtualCircuitUpdateInput( ) """ diff --git a/equinix_metal/test/test_vlans_api.py b/equinix_metal/test/test_vlans_api.py index 8a4b5fcf..a7a396a3 100644 --- a/equinix_metal/test/test_vlans_api.py +++ b/equinix_metal/test/test_vlans_api.py @@ -15,45 +15,43 @@ import unittest -import equinix_metal -from equinix_metal.api.vlans_api import VLANsApi # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.api.vlans_api import VLANsApi class TestVLANsApi(unittest.TestCase): """VLANsApi unit test stubs""" - def setUp(self): - self.api = equinix_metal.api.vlans_api.VLANsApi() # noqa: E501 + def setUp(self) -> None: + self.api = VLANsApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_create_virtual_network(self): + def test_create_virtual_network(self) -> None: """Test case for create_virtual_network - Create a virtual network # noqa: E501 + Create a virtual network """ pass - def test_delete_virtual_network(self): + def test_delete_virtual_network(self) -> None: """Test case for delete_virtual_network - Delete a virtual network # noqa: E501 + Delete a virtual network """ pass - def test_find_virtual_networks(self): + def test_find_virtual_networks(self) -> None: """Test case for find_virtual_networks - Retrieve all virtual networks # noqa: E501 + Retrieve all virtual networks """ pass - def test_get_virtual_network(self): + def test_get_virtual_network(self) -> None: """Test case for get_virtual_network - Get a virtual network # noqa: E501 + Get a virtual network """ pass diff --git a/equinix_metal/test/test_vrf.py b/equinix_metal/test/test_vrf.py index a394f553..a6e5ccb2 100644 --- a/equinix_metal/test/test_vrf.py +++ b/equinix_metal/test/test_vrf.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.vrf import Vrf # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.vrf import Vrf class TestVrf(unittest.TestCase): """Vrf unit test stubs""" @@ -29,21 +26,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Vrf: """Test Vrf include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Vrf` """ - model = equinix_metal.models.vrf.Vrf() # noqa: E501 - if include_optional : + model = Vrf() + if include_optional: return Vrf( - bgp_dynamic_neighbors_bfd_enabled = True, - bgp_dynamic_neighbors_enabled = True, - bgp_dynamic_neighbors_export_route_map = True, - bill = True, - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + bgp_dynamic_neighbors_bfd_enabled = True, + bgp_dynamic_neighbors_enabled = True, + bgp_dynamic_neighbors_export_route_map = True, + bill = True, + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), created_by = equinix_metal.models.user.User( avatar_thumb_url = '', avatar_url = '', @@ -69,21 +66,21 @@ def make_instance(self, include_optional): short_id = '', timezone = '', two_factor_auth = '', - updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), ), - description = '', - href = '', - id = '', + updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), ), + description = '', + href = '', + id = '', ip_ranges = [ '' - ], - local_asn = 56, + ], + local_asn = 56, metro = equinix_metal.models.metro.Metro( code = '', country = '', href = '', id = '', - name = '', ), - name = '', + name = '', ), + name = '', project = equinix_metal.models.project.Project( backend_transfer_enabled = True, bgp_config = equinix_metal.models.href.Href( @@ -120,11 +117,11 @@ def make_instance(self, include_optional): updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), volumes = [ - ], ), + ], ), tags = [ '' - ], - updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + ], + updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), virtual_circuits = [ equinix_metal.models.vrf_virtual_circuit.VrfVirtualCircuit( created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), @@ -197,7 +194,7 @@ def make_instance(self, include_optional): updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), ), ) ] ) - else : + else: return Vrf( ) """ diff --git a/equinix_metal/test/test_vrf_create_input.py b/equinix_metal/test/test_vrf_create_input.py index 84dd41ea..d93f05b1 100644 --- a/equinix_metal/test/test_vrf_create_input.py +++ b/equinix_metal/test/test_vrf_create_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.vrf_create_input import VrfCreateInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.vrf_create_input import VrfCreateInput class TestVrfCreateInput(unittest.TestCase): """VrfCreateInput unit test stubs""" @@ -29,32 +26,32 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> VrfCreateInput: """Test VrfCreateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `VrfCreateInput` """ - model = equinix_metal.models.vrf_create_input.VrfCreateInput() # noqa: E501 - if include_optional : + model = VrfCreateInput() + if include_optional: return VrfCreateInput( - bgp_dynamic_neighbors_bfd_enabled = True, - bgp_dynamic_neighbors_enabled = True, - bgp_dynamic_neighbors_export_route_map = True, - description = '', - href = '', + bgp_dynamic_neighbors_bfd_enabled = True, + bgp_dynamic_neighbors_enabled = True, + bgp_dynamic_neighbors_export_route_map = True, + description = '', + href = '', ip_ranges = [ '' - ], - local_asn = 56, - metro = '', - name = '', + ], + local_asn = 56, + metro = '', + name = '', tags = [ '' ] ) - else : + else: return VrfCreateInput( metro = '', name = '', diff --git a/equinix_metal/test/test_vrf_fabric_vc_create_input.py b/equinix_metal/test/test_vrf_fabric_vc_create_input.py index 360eb599..3cec25d5 100644 --- a/equinix_metal/test/test_vrf_fabric_vc_create_input.py +++ b/equinix_metal/test/test_vrf_fabric_vc_create_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.vrf_fabric_vc_create_input import VrfFabricVcCreateInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.vrf_fabric_vc_create_input import VrfFabricVcCreateInput class TestVrfFabricVcCreateInput(unittest.TestCase): """VrfFabricVcCreateInput unit test stubs""" @@ -29,34 +26,34 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> VrfFabricVcCreateInput: """Test VrfFabricVcCreateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `VrfFabricVcCreateInput` """ - model = equinix_metal.models.vrf_fabric_vc_create_input.VrfFabricVcCreateInput() # noqa: E501 - if include_optional : + model = VrfFabricVcCreateInput() + if include_optional: return VrfFabricVcCreateInput( - contact_email = '', - description = '', - href = '', - metro = '', - name = '', - project = '', - redundancy = '', - service_token_type = 'a_side', - speed = '10000000000', + contact_email = '', + description = '', + href = '', + metro = '', + name = '', + project = '', + redundancy = '', + service_token_type = 'a_side', + speed = '10000000000', tags = [ '' - ], - type = 'shared', + ], + type = 'shared', vrfs = [ '' ] ) - else : + else: return VrfFabricVcCreateInput( metro = '', name = '', diff --git a/equinix_metal/test/test_vrf_ip_reservation.py b/equinix_metal/test/test_vrf_ip_reservation.py index a95c1b7d..2d80fd19 100644 --- a/equinix_metal/test/test_vrf_ip_reservation.py +++ b/equinix_metal/test/test_vrf_ip_reservation.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.vrf_ip_reservation import VrfIpReservation # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.vrf_ip_reservation import VrfIpReservation class TestVrfIpReservation(unittest.TestCase): """VrfIpReservation unit test stubs""" @@ -29,30 +26,30 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> VrfIpReservation: """Test VrfIpReservation include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `VrfIpReservation` """ - model = equinix_metal.models.vrf_ip_reservation.VrfIpReservation() # noqa: E501 - if include_optional : + model = VrfIpReservation() + if include_optional: return VrfIpReservation( - address = '', - address_family = 56, - bill = True, - cidr = 56, - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + address = '', + address_family = 56, + bill = True, + cidr = 56, + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), created_by = equinix_metal.models.href.Href( - href = '', ), - customdata = equinix_metal.models.customdata.customdata(), - details = '', - gateway = '', - href = '', - id = '', - manageable = True, - management = True, + href = '', ), + customdata = equinix_metal.models.customdata.customdata(), + details = '', + gateway = '', + href = '', + id = '', + manageable = True, + management = True, metal_gateway = equinix_metal.models.metal_gateway_lite.MetalGatewayLite( created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), gateway_address = '10.1.2.1/27', @@ -60,15 +57,15 @@ def make_instance(self, include_optional): id = '', state = 'ready', updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - vlan = 1001, ), + vlan = 1001, ), metro = equinix_metal.models.metro.Metro( code = '', country = '', href = '', id = '', - name = '', ), - netmask = '', - network = '', + name = '', ), + netmask = '', + network = '', project = equinix_metal.models.project.Project( backend_transfer_enabled = True, bgp_config = equinix_metal.models.href.Href( @@ -105,7 +102,7 @@ def make_instance(self, include_optional): updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), volumes = [ - ], ), + ], ), project_lite = equinix_metal.models.project.Project( backend_transfer_enabled = True, bgp_config = equinix_metal.models.href.Href( @@ -142,13 +139,13 @@ def make_instance(self, include_optional): updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), volumes = [ - ], ), - public = True, - state = '', + ], ), + public = True, + state = '', tags = [ '' - ], - type = 'vrf', + ], + type = 'vrf', vrf = equinix_metal.models.vrf.Vrf( bgp_dynamic_neighbors_bfd_enabled = True, bgp_dynamic_neighbors_enabled = True, @@ -267,7 +264,7 @@ def make_instance(self, include_optional): updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), ), ) ], ) ) - else : + else: return VrfIpReservation( type = 'vrf', vrf = equinix_metal.models.vrf.Vrf( diff --git a/equinix_metal/test/test_vrf_ip_reservation_create_input.py b/equinix_metal/test/test_vrf_ip_reservation_create_input.py index d17409a7..a72d3519 100644 --- a/equinix_metal/test/test_vrf_ip_reservation_create_input.py +++ b/equinix_metal/test/test_vrf_ip_reservation_create_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.vrf_ip_reservation_create_input import VrfIpReservationCreateInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.vrf_ip_reservation_create_input import VrfIpReservationCreateInput class TestVrfIpReservationCreateInput(unittest.TestCase): """VrfIpReservationCreateInput unit test stubs""" @@ -29,28 +26,28 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> VrfIpReservationCreateInput: """Test VrfIpReservationCreateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `VrfIpReservationCreateInput` """ - model = equinix_metal.models.vrf_ip_reservation_create_input.VrfIpReservationCreateInput() # noqa: E501 - if include_optional : + model = VrfIpReservationCreateInput() + if include_optional: return VrfIpReservationCreateInput( - cidr = 16, - customdata = None, - details = '', - href = '', - network = '10.1.2.0', + cidr = 16, + customdata = None, + details = '', + href = '', + network = '10.1.2.0', tags = [ '' - ], - type = 'vrf', + ], + type = 'vrf', vrf_id = '' ) - else : + else: return VrfIpReservationCreateInput( cidr = 16, network = '10.1.2.0', diff --git a/equinix_metal/test/test_vrf_ip_reservation_list.py b/equinix_metal/test/test_vrf_ip_reservation_list.py index a6fa1608..1cd712d9 100644 --- a/equinix_metal/test/test_vrf_ip_reservation_list.py +++ b/equinix_metal/test/test_vrf_ip_reservation_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.vrf_ip_reservation_list import VrfIpReservationList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.vrf_ip_reservation_list import VrfIpReservationList class TestVrfIpReservationList(unittest.TestCase): """VrfIpReservationList unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> VrfIpReservationList: """Test VrfIpReservationList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `VrfIpReservationList` """ - model = equinix_metal.models.vrf_ip_reservation_list.VrfIpReservationList() # noqa: E501 - if include_optional : + model = VrfIpReservationList() + if include_optional: return VrfIpReservationList( - href = '', + href = '', ip_addresses = [ equinix_metal.models.vrf_ip_reservation.VrfIpReservation( address = '', @@ -173,7 +170,7 @@ def make_instance(self, include_optional): ], ), ) ] ) - else : + else: return VrfIpReservationList( ) """ diff --git a/equinix_metal/test/test_vrf_list.py b/equinix_metal/test/test_vrf_list.py index 902e5b03..75fd882a 100644 --- a/equinix_metal/test/test_vrf_list.py +++ b/equinix_metal/test/test_vrf_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.vrf_list import VrfList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.vrf_list import VrfList class TestVrfList(unittest.TestCase): """VrfList unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> VrfList: """Test VrfList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `VrfList` """ - model = equinix_metal.models.vrf_list.VrfList() # noqa: E501 - if include_optional : + model = VrfList() + if include_optional: return VrfList( - href = '', + href = '', vrfs = [ equinix_metal.models.vrf.Vrf( bgp_dynamic_neighbors_bfd_enabled = True, @@ -160,7 +157,7 @@ def make_instance(self, include_optional): ], ) ] ) - else : + else: return VrfList( ) """ diff --git a/equinix_metal/test/test_vrf_metal_gateway.py b/equinix_metal/test/test_vrf_metal_gateway.py index 26aedd99..62df023e 100644 --- a/equinix_metal/test/test_vrf_metal_gateway.py +++ b/equinix_metal/test/test_vrf_metal_gateway.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.vrf_metal_gateway import VrfMetalGateway # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.vrf_metal_gateway import VrfMetalGateway class TestVrfMetalGateway(unittest.TestCase): """VrfMetalGateway unit test stubs""" @@ -29,21 +26,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> VrfMetalGateway: """Test VrfMetalGateway include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `VrfMetalGateway` """ - model = equinix_metal.models.vrf_metal_gateway.VrfMetalGateway() # noqa: E501 - if include_optional : + model = VrfMetalGateway() + if include_optional: return VrfMetalGateway( - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), created_by = equinix_metal.models.href.Href( - href = '', ), - href = '', - id = '', + href = '', ), + href = '', + id = '', ip_reservation = equinix_metal.models.vrf_ip_reservation.VrfIpReservation( address = '', address_family = 56, @@ -173,7 +170,7 @@ def make_instance(self, include_optional): local_asn = 56, name = '', updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), ), ) - ], ), ), + ], ), ), project = equinix_metal.models.project.Project( backend_transfer_enabled = True, bgp_config = equinix_metal.models.href.Href( @@ -210,9 +207,9 @@ def make_instance(self, include_optional): updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), volumes = [ - ], ), - state = 'ready', - updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + ], ), + state = 'ready', + updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), virtual_network = equinix_metal.models.virtual_network.VirtualNetwork( assigned_to = equinix_metal.models.href.Href( href = '', ), @@ -240,7 +237,7 @@ def make_instance(self, include_optional): tags = [ '' ], - vxlan = 56, ), + vxlan = 56, ), vrf = equinix_metal.models.vrf.Vrf( bgp_dynamic_neighbors_bfd_enabled = True, bgp_dynamic_neighbors_enabled = True, @@ -359,7 +356,7 @@ def make_instance(self, include_optional): updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), ), ) ], ) ) - else : + else: return VrfMetalGateway( ) """ diff --git a/equinix_metal/test/test_vrf_metal_gateway_create_input.py b/equinix_metal/test/test_vrf_metal_gateway_create_input.py index 8c6f4e6d..16586374 100644 --- a/equinix_metal/test/test_vrf_metal_gateway_create_input.py +++ b/equinix_metal/test/test_vrf_metal_gateway_create_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.vrf_metal_gateway_create_input import VrfMetalGatewayCreateInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.vrf_metal_gateway_create_input import VrfMetalGatewayCreateInput class TestVrfMetalGatewayCreateInput(unittest.TestCase): """VrfMetalGatewayCreateInput unit test stubs""" @@ -29,21 +26,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> VrfMetalGatewayCreateInput: """Test VrfMetalGatewayCreateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `VrfMetalGatewayCreateInput` """ - model = equinix_metal.models.vrf_metal_gateway_create_input.VrfMetalGatewayCreateInput() # noqa: E501 - if include_optional : + model = VrfMetalGatewayCreateInput() + if include_optional: return VrfMetalGatewayCreateInput( - href = '', - ip_reservation_id = '', + href = '', + ip_reservation_id = '', virtual_network_id = '' ) - else : + else: return VrfMetalGatewayCreateInput( ip_reservation_id = '', virtual_network_id = '', diff --git a/equinix_metal/test/test_vrf_route.py b/equinix_metal/test/test_vrf_route.py index a3e361b1..eb4d9fa5 100644 --- a/equinix_metal/test/test_vrf_route.py +++ b/equinix_metal/test/test_vrf_route.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.vrf_route import VrfRoute # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.vrf_route import VrfRoute class TestVrfRoute(unittest.TestCase): """VrfRoute unit test stubs""" @@ -29,19 +26,19 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> VrfRoute: """Test VrfRoute include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `VrfRoute` """ - model = equinix_metal.models.vrf_route.VrfRoute() # noqa: E501 - if include_optional : + model = VrfRoute() + if include_optional: return VrfRoute( - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - href = '/routes/e1ff9c2b-051a-4688-965f-153e274f77e0', - id = 'e1ff9c2b-051a-4688-965f-153e274f77e0', + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + href = '/routes/e1ff9c2b-051a-4688-965f-153e274f77e0', + id = 'e1ff9c2b-051a-4688-965f-153e274f77e0', metal_gateway = equinix_metal.models.vrf_metal_gateway.VrfMetalGateway( created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), created_by = equinix_metal.models.href.Href( @@ -201,15 +198,15 @@ def make_instance(self, include_optional): ], metro_code = '', vxlan = 56, ), - vrf = , ), - next_hop = '192.168.1.254', - prefix = '0.0.0.0/0', - status = 'active', + vrf = , ), + next_hop = '192.168.1.254', + prefix = '0.0.0.0/0', + status = 'active', tags = [ '' - ], - type = 'static', - updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + ], + type = 'static', + updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), virtual_network = equinix_metal.models.virtual_network.VirtualNetwork( assigned_to = equinix_metal.models.href.Href( href = '', ), @@ -237,7 +234,7 @@ def make_instance(self, include_optional): tags = [ '' ], - vxlan = 56, ), + vxlan = 56, ), vrf = equinix_metal.models.vrf.Vrf( bgp_dynamic_neighbors_bfd_enabled = True, bgp_dynamic_neighbors_enabled = True, @@ -356,7 +353,7 @@ def make_instance(self, include_optional): updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), ), ) ], ) ) - else : + else: return VrfRoute( ) """ diff --git a/equinix_metal/test/test_vrf_route_create_input.py b/equinix_metal/test/test_vrf_route_create_input.py index 0546cf6f..86ec5e17 100644 --- a/equinix_metal/test/test_vrf_route_create_input.py +++ b/equinix_metal/test/test_vrf_route_create_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.vrf_route_create_input import VrfRouteCreateInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.vrf_route_create_input import VrfRouteCreateInput class TestVrfRouteCreateInput(unittest.TestCase): """VrfRouteCreateInput unit test stubs""" @@ -29,24 +26,24 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> VrfRouteCreateInput: """Test VrfRouteCreateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `VrfRouteCreateInput` """ - model = equinix_metal.models.vrf_route_create_input.VrfRouteCreateInput() # noqa: E501 - if include_optional : + model = VrfRouteCreateInput() + if include_optional: return VrfRouteCreateInput( - href = '', - next_hop = '192.168.1.254', - prefix = '0.0.0.0/0', + href = '', + next_hop = '192.168.1.254', + prefix = '0.0.0.0/0', tags = [ '' ] ) - else : + else: return VrfRouteCreateInput( next_hop = '192.168.1.254', prefix = '0.0.0.0/0', diff --git a/equinix_metal/test/test_vrf_route_list.py b/equinix_metal/test/test_vrf_route_list.py index 48e57ab2..f4e3748e 100644 --- a/equinix_metal/test/test_vrf_route_list.py +++ b/equinix_metal/test/test_vrf_route_list.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.vrf_route_list import VrfRouteList # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.vrf_route_list import VrfRouteList class TestVrfRouteList(unittest.TestCase): """VrfRouteList unit test stubs""" @@ -29,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> VrfRouteList: """Test VrfRouteList include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `VrfRouteList` """ - model = equinix_metal.models.vrf_route_list.VrfRouteList() # noqa: E501 - if include_optional : + model = VrfRouteList() + if include_optional: return VrfRouteList( - href = '', + href = '', meta = equinix_metal.models.meta.Meta( current_page = 56, first = equinix_metal.models.href.Href( @@ -51,7 +48,7 @@ def make_instance(self, include_optional): next = , previous = , self = , - total = 56, ), + total = 56, ), routes = [ equinix_metal.models.vrf_route.VrfRoute( created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), @@ -225,7 +222,7 @@ def make_instance(self, include_optional): vrf = , ) ] ) - else : + else: return VrfRouteList( ) """ diff --git a/equinix_metal/test/test_vrf_route_update_input.py b/equinix_metal/test/test_vrf_route_update_input.py index 9c0ab4de..af996015 100644 --- a/equinix_metal/test/test_vrf_route_update_input.py +++ b/equinix_metal/test/test_vrf_route_update_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.vrf_route_update_input import VrfRouteUpdateInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.vrf_route_update_input import VrfRouteUpdateInput class TestVrfRouteUpdateInput(unittest.TestCase): """VrfRouteUpdateInput unit test stubs""" @@ -29,24 +26,24 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> VrfRouteUpdateInput: """Test VrfRouteUpdateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `VrfRouteUpdateInput` """ - model = equinix_metal.models.vrf_route_update_input.VrfRouteUpdateInput() # noqa: E501 - if include_optional : + model = VrfRouteUpdateInput() + if include_optional: return VrfRouteUpdateInput( - href = '', - next_hop = '192.168.1.254', - prefix = '0.0.0.0/0', + href = '', + next_hop = '192.168.1.254', + prefix = '0.0.0.0/0', tags = [ '' ] ) - else : + else: return VrfRouteUpdateInput( ) """ diff --git a/equinix_metal/test/test_vrf_update_input.py b/equinix_metal/test/test_vrf_update_input.py index 581614d5..6e0f1c59 100644 --- a/equinix_metal/test/test_vrf_update_input.py +++ b/equinix_metal/test/test_vrf_update_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.vrf_update_input import VrfUpdateInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.vrf_update_input import VrfUpdateInput class TestVrfUpdateInput(unittest.TestCase): """VrfUpdateInput unit test stubs""" @@ -29,31 +26,31 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> VrfUpdateInput: """Test VrfUpdateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `VrfUpdateInput` """ - model = equinix_metal.models.vrf_update_input.VrfUpdateInput() # noqa: E501 - if include_optional : + model = VrfUpdateInput() + if include_optional: return VrfUpdateInput( - bgp_dynamic_neighbors_bfd_enabled = True, - bgp_dynamic_neighbors_enabled = True, - bgp_dynamic_neighbors_export_route_map = True, - description = '', - href = '', + bgp_dynamic_neighbors_bfd_enabled = True, + bgp_dynamic_neighbors_enabled = True, + bgp_dynamic_neighbors_export_route_map = True, + description = '', + href = '', ip_ranges = [ '' - ], - local_asn = 56, - name = '', + ], + local_asn = 56, + name = '', tags = [ '' ] ) - else : + else: return VrfUpdateInput( ) """ diff --git a/equinix_metal/test/test_vrf_virtual_circuit.py b/equinix_metal/test/test_vrf_virtual_circuit.py index 7ca51a04..eea4ec78 100644 --- a/equinix_metal/test/test_vrf_virtual_circuit.py +++ b/equinix_metal/test/test_vrf_virtual_circuit.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.vrf_virtual_circuit import VrfVirtualCircuit # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.vrf_virtual_circuit import VrfVirtualCircuit class TestVrfVirtualCircuit(unittest.TestCase): """VrfVirtualCircuit unit test stubs""" @@ -29,38 +26,38 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> VrfVirtualCircuit: """Test VrfVirtualCircuit include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `VrfVirtualCircuit` """ - model = equinix_metal.models.vrf_virtual_circuit.VrfVirtualCircuit() # noqa: E501 - if include_optional : + model = VrfVirtualCircuit() + if include_optional: return VrfVirtualCircuit( - created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - customer_ip = '12.0.0.2', - description = '', - href = '', - id = '', - md5 = '', - metal_ip = '12.0.0.1', - name = '', - nni_vlan = 56, - peer_asn = 56, + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + customer_ip = '12.0.0.2', + description = '', + href = '', + id = '', + md5 = '', + metal_ip = '12.0.0.1', + name = '', + nni_vlan = 56, + peer_asn = 56, port = equinix_metal.models.href.Href( - href = '', ), + href = '', ), project = equinix_metal.models.href.Href( - href = '', ), - speed = 56, - status = 'pending', - subnet = '12.0.0.0/30', + href = '', ), + speed = 56, + status = 'pending', + subnet = '12.0.0.0/30', tags = [ '' - ], - type = 'vrf', - updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + ], + type = 'vrf', + updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), vrf = equinix_metal.models.vrf.Vrf( bgp_dynamic_neighbors_bfd_enabled = True, bgp_dynamic_neighbors_enabled = True, @@ -179,7 +176,7 @@ def make_instance(self, include_optional): updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), ), ) ], ) ) - else : + else: return VrfVirtualCircuit( vrf = equinix_metal.models.vrf.Vrf( bgp_dynamic_neighbors_bfd_enabled = True, diff --git a/equinix_metal/test/test_vrf_virtual_circuit_create_input.py b/equinix_metal/test/test_vrf_virtual_circuit_create_input.py index 087610fe..cf42eb91 100644 --- a/equinix_metal/test/test_vrf_virtual_circuit_create_input.py +++ b/equinix_metal/test/test_vrf_virtual_circuit_create_input.py @@ -14,11 +14,8 @@ import unittest -import datetime -import equinix_metal -from equinix_metal.models.vrf_virtual_circuit_create_input import VrfVirtualCircuitCreateInput # noqa: E501 -from equinix_metal.rest import ApiException +from equinix_metal.models.vrf_virtual_circuit_create_input import VrfVirtualCircuitCreateInput class TestVrfVirtualCircuitCreateInput(unittest.TestCase): """VrfVirtualCircuitCreateInput unit test stubs""" @@ -29,33 +26,33 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> VrfVirtualCircuitCreateInput: """Test VrfVirtualCircuitCreateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `VrfVirtualCircuitCreateInput` """ - model = equinix_metal.models.vrf_virtual_circuit_create_input.VrfVirtualCircuitCreateInput() # noqa: E501 - if include_optional : + model = VrfVirtualCircuitCreateInput() + if include_optional: return VrfVirtualCircuitCreateInput( - customer_ip = '12.0.0.2', - description = '', - href = '', - md5 = 'jUR,rZ#UM/?R,Fp^l6$ARjeJk C>i H'qT\\{i H'qT\\{ VrfVirtualCircuitUpdateInput: """Test VrfVirtualCircuitUpdateInput include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `VrfVirtualCircuitUpdateInput` """ - model = equinix_metal.models.vrf_virtual_circuit_update_input.VrfVirtualCircuitUpdateInput() # noqa: E501 - if include_optional : + model = VrfVirtualCircuitUpdateInput() + if include_optional: return VrfVirtualCircuitUpdateInput( - customer_ip = '12.0.0.2', - description = '', - href = '', - md5 = 'jUR,rZ#UM/?R,Fp^l6$ARjeJk C>i H'qT\\{i H'qT\\{ None: + self.api = VRFsApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_bgp_dynamic_neighbors_id_get(self): + def test_bgp_dynamic_neighbors_id_get(self) -> None: """Test case for bgp_dynamic_neighbors_id_get - Retrieve a BGP Dynamic Neighbor # noqa: E501 + Retrieve a BGP Dynamic Neighbor """ pass - def test_create_bgp_dynamic_neighbor(self): + def test_create_bgp_dynamic_neighbor(self) -> None: """Test case for create_bgp_dynamic_neighbor - Create a VRF BGP Dynamic Neighbor range # noqa: E501 + Create a VRF BGP Dynamic Neighbor range """ pass - def test_create_vrf(self): + def test_create_vrf(self) -> None: """Test case for create_vrf - Create a new VRF in the specified project # noqa: E501 + Create a new VRF in the specified project """ pass - def test_create_vrf_route(self): + def test_create_vrf_route(self) -> None: """Test case for create_vrf_route - Create a VRF route # noqa: E501 + Create a VRF route """ pass - def test_delete_bgp_dynamic_neighbor_by_id(self): + def test_delete_bgp_dynamic_neighbor_by_id(self) -> None: """Test case for delete_bgp_dynamic_neighbor_by_id - Delete a VRF BGP Dynamic Neighbor # noqa: E501 + Delete a VRF BGP Dynamic Neighbor """ pass - def test_delete_vrf(self): + def test_delete_vrf(self) -> None: """Test case for delete_vrf - Delete the VRF # noqa: E501 + Delete the VRF """ pass - def test_delete_vrf_route_by_id(self): + def test_delete_vrf_route_by_id(self) -> None: """Test case for delete_vrf_route_by_id - Delete a VRF Route # noqa: E501 + Delete a VRF Route """ pass - def test_find_vrf_by_id(self): + def test_find_vrf_by_id(self) -> None: """Test case for find_vrf_by_id - Retrieve a VRF # noqa: E501 + Retrieve a VRF """ pass - def test_find_vrf_ip_reservation(self): + def test_find_vrf_ip_reservation(self) -> None: """Test case for find_vrf_ip_reservation - Retrieve all VRF IP Reservations in the VRF # noqa: E501 + Retrieve all VRF IP Reservations in the VRF """ pass - def test_find_vrf_ip_reservations(self): + def test_find_vrf_ip_reservations(self) -> None: """Test case for find_vrf_ip_reservations - Retrieve all VRF IP Reservations in the VRF # noqa: E501 + Retrieve all VRF IP Reservations in the VRF """ pass - def test_find_vrf_route_by_id(self): + def test_find_vrf_route_by_id(self) -> None: """Test case for find_vrf_route_by_id - Retrieve a VRF Route # noqa: E501 + Retrieve a VRF Route """ pass - def test_find_vrfs(self): + def test_find_vrfs(self) -> None: """Test case for find_vrfs - Retrieve all VRFs in the project # noqa: E501 + Retrieve all VRFs in the project """ pass - def test_get_bgp_dynamic_neighbors(self): + def test_get_bgp_dynamic_neighbors(self) -> None: """Test case for get_bgp_dynamic_neighbors - List BGP Dynamic Neighbors # noqa: E501 + List BGP Dynamic Neighbors """ pass - def test_get_vrf_routes(self): + def test_get_vrf_routes(self) -> None: """Test case for get_vrf_routes - Retrieve all routes in the VRF # noqa: E501 + Retrieve all routes in the VRF """ pass - def test_update_vrf(self): + def test_update_vrf(self) -> None: """Test case for update_vrf - Update the VRF # noqa: E501 + Update the VRF """ pass - def test_update_vrf_route_by_id(self): + def test_update_vrf_route_by_id(self) -> None: """Test case for update_vrf_route_by_id - Update a VRF Route # noqa: E501 + Update a VRF Route """ pass diff --git a/metal_openapi.fixed.yaml b/metal_openapi.fixed.yaml index d2cdaac3..baf24e2a 100644 --- a/metal_openapi.fixed.yaml +++ b/metal_openapi.fixed.yaml @@ -906,9 +906,6 @@ components: should be 'dedicated'. enum: - dedicated - - shared - - shared_port_vlan - - shared_port_vlan_to_csp type: string use_case: description: The intended use case of the dedicated port. @@ -2228,7 +2225,6 @@ components: - public_ipv4 - private_ipv4 - public_ipv6 - - vrf type: string required: - type @@ -5307,7 +5303,6 @@ components: type: enum: - vlan - - vrf type: string updated_at: format: date-time diff --git a/oas3.stitched/.openapi-generator/VERSION b/oas3.stitched/.openapi-generator/VERSION index 41225218..ba7f754d 100644 --- a/oas3.stitched/.openapi-generator/VERSION +++ b/oas3.stitched/.openapi-generator/VERSION @@ -1 +1 @@ -7.0.0 \ No newline at end of file +7.4.0 diff --git a/oas3.stitched/metal_openapi.yaml b/oas3.stitched/metal_openapi.yaml index f4b29153..523093af 100644 --- a/oas3.stitched/metal_openapi.yaml +++ b/oas3.stitched/metal_openapi.yaml @@ -13324,9 +13324,6 @@ components: \ should be 'dedicated'." enum: - dedicated - - shared - - shared_port_vlan - - shared_port_vlan_to_csp type: string use_case: description: The intended use case of the dedicated port. @@ -14361,7 +14358,6 @@ components: - public_ipv4 - private_ipv4 - public_ipv6 - - vrf type: string required: - type @@ -16689,7 +16685,6 @@ components: type: enum: - vlan - - vrf type: string virtual_network: $ref: '#/components/schemas/Href' diff --git a/templates/api.mustache b/templates/api.mustache index 70bde21e..6c0d22e5 100644 --- a/templates/api.mustache +++ b/templates/api.mustache @@ -1,54 +1,36 @@ # coding: utf-8 {{>partial_header}} - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError -from typing_extensions import Annotated{{#asyncio}} -from typing import overload, Optional, Union, Awaitable{{/asyncio}} +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated {{#imports}} {{import}} {{/imports}} -from {{packageName}}.api_client import ApiClient +from {{packageName}}.api_client import ApiClient, RequestSerialized from {{packageName}}.api_response import ApiResponse -from {{packageName}}.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from {{packageName}}.rest import RESTResponseType {{#operations}} -class {{classname}}(object): +class {{classname}}: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() self.api_client = api_client {{#operation}} - -{{#asyncio}} - @overload - async def {{operationId}}(self, {{#allParams}}{{paramName}} : {{{vendorExtensions.x-py-typing}}}{{^required}} = None{{/required}}, {{/allParams}}**kwargs) -> {{{returnType}}}{{^returnType}}None{{/returnType}}: # noqa: E501 - ... - - @overload - def {{operationId}}(self, {{#allParams}}{{paramName}} : {{{vendorExtensions.x-py-typing}}}{{^required}} = None{{/required}}, {{/allParams}}async_req: Optional[bool]=True, **kwargs) -> {{{returnType}}}{{^returnType}}None{{/returnType}}: # noqa: E501 - ... - -{{/asyncio}} {{#vendorExtensions}} {{#x-equinix-metal-paginated-property}} - @validate_arguments + @validate_call def {{operationId}}_all_pages(self, {{#allParams}}{{^vendorExtensions.x-equinix-metal-page-param}}{{paramName}} : {{{vendorExtensions.x-py-typing}}}{{^required}} = None{{/required}}, {{/vendorExtensions.x-equinix-metal-page-param}}{{/allParams}}{{#asyncio}}async_req: Optional[bool]=None, {{/asyncio}}**kwargs) -> {{#asyncio}}Union[{{{returnType}}}{{^returnType}}None{{/returnType}}, Awaitable[{{{returnType}}}{{^returnType}}None{{/returnType}}]]{{/asyncio}}{{^asyncio}}{{{returnType}}}{{^returnType}}None{{/returnType}}{{/asyncio}}: # noqa: E501 """{{#isDeprecated}}(Deprecated) {{/isDeprecated}}{{{summary}}}{{^summary}}{{operationId}}{{/summary}} # noqa: E501 @@ -91,271 +73,210 @@ class {{classname}}(object): if page_response.meta.next is None: break page += 1 - + return all_pages {{/x-equinix-metal-paginated-property}} {{/vendorExtensions}} - @validate_arguments - def {{operationId}}(self, {{#allParams}}{{paramName}} : {{{vendorExtensions.x-py-typing}}}{{^required}} = None{{/required}}, {{/allParams}}{{#asyncio}}async_req: Optional[bool]=None, {{/asyncio}}**kwargs) -> {{#asyncio}}Union[{{{returnType}}}{{^returnType}}None{{/returnType}}, Awaitable[{{{returnType}}}{{^returnType}}None{{/returnType}}]]{{/asyncio}}{{^asyncio}}{{{returnType}}}{{^returnType}}None{{/returnType}}{{/asyncio}}: # noqa: E501 - """{{#isDeprecated}}(Deprecated) {{/isDeprecated}}{{{summary}}}{{^summary}}{{operationId}}{{/summary}} # noqa: E501 + @validate_call + {{#asyncio}}async {{/asyncio}}def {{operationId}}{{>partial_api_args}} -> {{{returnType}}}{{^returnType}}None{{/returnType}}: +{{>partial_api}} + response_data = {{#asyncio}}await {{/asyncio}}self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + {{#asyncio}}await {{/asyncio}}response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data -{{#notes}} - {{{.}}} # noqa: E501 -{{/notes}} - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.{{operationId}}({{#allParams}}{{paramName}}, {{/allParams}}async_req=True) - >>> result = thread.get() - -{{#allParams}} - :param {{paramName}}:{{#description}} {{{.}}}{{/description}}{{#required}} (required){{/required}}{{#optional}}(optional){{/optional}} - :type {{paramName}}: {{dataType}}{{#optional}}, optional{{/optional}} -{{/allParams}} - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: {{returnType}}{{^returnType}}None{{/returnType}} - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the {{operationId}}_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") -{{#asyncio}} - if async_req is not None: - kwargs['async_req'] = async_req -{{/asyncio}} - return self.{{operationId}}_with_http_info({{#allParams}}{{paramName}}, {{/allParams}}**kwargs) # noqa: E501 - - @validate_arguments - def {{operationId}}_with_http_info(self, {{#allParams}}{{paramName}} : {{{vendorExtensions.x-py-typing}}}{{^required}} = None{{/required}}, {{/allParams}}**kwargs) -> ApiResponse: # noqa: E501 - """{{#isDeprecated}}(Deprecated) {{/isDeprecated}}{{{summary}}}{{^summary}}{{operationId}}{{/summary}} # noqa: E501 + @validate_call + {{#asyncio}}async {{/asyncio}}def {{operationId}}_with_http_info{{>partial_api_args}} -> ApiResponse[{{{returnType}}}{{^returnType}}None{{/returnType}}]: +{{>partial_api}} + response_data = {{#asyncio}}await {{/asyncio}}self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + {{#asyncio}}await {{/asyncio}}response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) -{{#notes}} - {{{.}}} # noqa: E501 -{{/notes}} - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.{{operationId}}_with_http_info({{#allParams}}{{paramName}}, {{/allParams}}async_req=True) - >>> result = thread.get() + @validate_call + {{#asyncio}}async {{/asyncio}}def {{operationId}}_without_preload_content{{>partial_api_args}} -> RESTResponseType: +{{>partial_api}} + response_data = {{#asyncio}}await {{/asyncio}}self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response -{{#allParams}} - :param {{paramName}}:{{#description}} {{{.}}}{{/description}}{{#required}} (required){{/required}}{{#optional}}(optional){{/optional}} - :type {{paramName}}: {{dataType}}{{#optional}}, optional{{/optional}} -{{/allParams}} - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: {{#returnType}}tuple({{.}}, status_code(int), headers(HTTPHeaderDict)){{/returnType}}{{^returnType}}None{{/returnType}} - """ - {{#isDeprecated}} - warnings.warn("{{{httpMethod}}} {{{path}}} is deprecated.", DeprecationWarning) + def _{{operationId}}_serialize( + self, + {{#allParams}} + {{paramName}}, + {{/allParams}} + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - {{/isDeprecated}} {{#servers.0}} - _hosts = [ -{{#servers}} - '{{{url}}}'{{^-last}},{{/-last}} -{{/servers}} + _hosts = [{{#servers}} + '{{{url}}}'{{^-last}},{{/-last}}{{/servers}} ] - _host = _hosts[0] - if kwargs.get('_host_index'): - _host_index = int(kwargs.get('_host_index')) - if _host_index < 0 or _host_index >= len(_hosts): - raise ApiValueError( - "Invalid host index. Must be 0 <= index < %s" - % len(_host) - ) - _host = _hosts[_host_index] + _host = _hosts[_host_index] + {{/servers.0}} + {{^servers.0}} + _host = None {{/servers.0}} - _params = locals() - - _all_params = [ -{{#allParams}} - '{{paramName}}'{{^-last}},{{/-last}} -{{/allParams}} - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params{{#servers.0}} and _key != "_host_index"{{/servers.0}}: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method {{operationId}}" % _key - ) - _params[_key] = _val - del _params['kwargs'] + _collection_formats: Dict[str, str] = { + {{#allParams}} + {{#isArray}} + '{{baseName}}': '{{collectionFormat}}', + {{/isArray}} + {{/allParams}} + } - _collection_formats = {} + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None # process the path parameters - _path_params = {} {{#pathParams}} - if _params['{{paramName}}']: - _path_params['{{baseName}}'] = _params['{{paramName}}'] - {{#isArray}} - _collection_formats['{{baseName}}'] = '{{collectionFormat}}' - {{/isArray}} - + if {{paramName}} is not None: + _path_params['{{baseName}}'] = {{paramName}}{{#isEnumRef}}.value{{/isEnumRef}} {{/pathParams}} - # process the query parameters - _query_params = [] {{#queryParams}} - if _params.get('{{paramName}}') is not None: # noqa: E501 + if {{paramName}} is not None: {{#isDateTime}} - if isinstance(_params['{{paramName}}'], datetime): - _query_params.append(('{{baseName}}', _params['{{paramName}}'].strftime(self.api_client.configuration.datetime_format))) + if isinstance({{paramName}}, datetime): + _query_params.append( + ( + '{{baseName}}', + {{paramName}}.strftime( + self.api_client.configuration.datetime_format + ) + ) + ) else: - _query_params.append(('{{baseName}}', _params['{{paramName}}'])) + _query_params.append(('{{baseName}}', {{paramName}})) {{/isDateTime}} - {{^isDateTime}} {{#isDate}} - if isinstance(_params['{{paramName}}'], date): - _query_params.append(('{{baseName}}', _params['{{paramName}}'].strftime(self.api_client.configuration.date_format))) + if isinstance({{paramName}}, date): + _query_params.append( + ( + '{{baseName}}', + {{paramName}}.strftime( + self.api_client.configuration.date_format + ) + ) + ) else: - _query_params.append(('{{baseName}}', _params['{{paramName}}'])) + _query_params.append(('{{baseName}}', {{paramName}})) {{/isDate}} - {{^isDate}} - _query_params.append(('{{baseName}}', _params['{{paramName}}']{{#isEnumRef}}.value{{/isEnumRef}})) - {{/isDate}} - {{/isDateTime}} - {{#isArray}} - _collection_formats['{{baseName}}'] = '{{collectionFormat}}' - {{/isArray}} - + {{^isDateTime}}{{^isDate}} + _query_params.append(('{{baseName}}', {{paramName}}{{#isEnumRef}}.value{{/isEnumRef}})) + {{/isDate}}{{/isDateTime}} {{/queryParams}} # process the header parameters - _header_params = dict(_params.get('_headers', {})) {{#headerParams}} - if _params['{{paramName}}']: - _header_params['{{baseName}}'] = _params['{{paramName}}'] - {{#isArray}} - _collection_formats['{{baseName}}'] = '{{collectionFormat}}' - {{/isArray}} - + if {{paramName}} is not None: + _header_params['{{baseName}}'] = {{paramName}} {{/headerParams}} # process the form parameters - _form_params = [] - _files = {} {{#formParams}} - if _params['{{paramName}}']: - {{^isFile}} - _form_params.append(('{{{baseName}}}', _params['{{paramName}}'])) - {{/isFile}} + if {{paramName}} is not None: {{#isFile}} - _files['{{{baseName}}}'] = _params['{{paramName}}'] + _files['{{{baseName}}}'] = {{paramName}} + {{/isFile}} + {{^isFile}} + _form_params.append(('{{{baseName}}}', {{paramName}})) {{/isFile}} - {{#isArray}} - _collection_formats['{{{baseName}}}'] = '{{collectionFormat}}' - {{/isArray}} - {{/formParams}} # process the body parameter - _body_params = None {{#bodyParam}} - if _params['{{paramName}}'] is not None: - _body_params = _params['{{paramName}}'] + if {{paramName}} is not None: {{#isBinary}} # convert to byte array if the input is a file name (str) - if isinstance(_body_params, str): - with io.open(_body_params, "rb") as _fp: - _body_params_from_file = _fp.read() - _body_params = _body_params_from_file + if isinstance({{paramName}}, str): + with open({{paramName}}, "rb") as _fp: + _body_params = _fp.read() + else: + _body_params = {{paramName}} + {{/isBinary}} + {{^isBinary}} + _body_params = {{paramName}} {{/isBinary}} - {{/bodyParam}} + + {{#constantParams}} + {{#isQueryParam}} + # Set client side default value of Query Param "{{baseName}}". + _query_params['{{baseName}}'] = {{#_enum}}'{{{.}}}'{{/_enum}} + {{/isQueryParam}} + {{#isHeaderParam}} + # Set client side default value of Header Param "{{baseName}}". + _header_params['{{baseName}}'] = {{#_enum}}'{{{.}}}'{{/_enum}} + {{/isHeaderParam}} + {{/constantParams}} + {{#hasProduces}} # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - [{{#produces}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/produces}}]) # noqa: E501 - + [{{#produces}} + '{{{mediaType}}}'{{^-last}}, {{/-last}}{{/produces}} + ] + ) {{/hasProduces}} + {{#hasConsumes}} # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - [{{#consumes}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/consumes}}])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list - + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [{{#consumes}} + '{{{mediaType}}}'{{^-last}}, {{/-last}}{{/consumes}} + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type {{/hasConsumes}} + # authentication setting - _auth_settings = [{{#authMethods}}'{{name}}'{{^-last}}, {{/-last}}{{/authMethods}}] # noqa: E501 - - {{#returnType}} - {{#responses}} - {{#-first}} - _response_types_map = { - {{/-first}} - {{^isWildcard}} - '{{code}}': {{#dataType}}"{{.}}"{{/dataType}}{{^dataType}}None{{/dataType}}, - {{/isWildcard}} - {{#-last}} - } - {{/-last}} - {{/responses}} - {{/returnType}} - {{^returnType}} - _response_types_map = {} - {{/returnType}} - - return self.api_client.call_api( - '{{{path}}}', '{{httpMethod}}', - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [{{#authMethods}} + '{{name}}'{{^-last}}, {{/-last}}{{/authMethods}} + ] + + return self.api_client.param_serialize( + method='{{httpMethod}}', + resource_path='{{{path}}}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - {{#servers.0}} - _host=_host, - {{/servers.0}} collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) + _host=_host, + _request_auth=_request_auth + ) + + {{/operation}} {{/operations}} diff --git a/templates/api_doc.mustache b/templates/api_doc.mustache index 6ef28d31..47e349f3 100644 --- a/templates/api_doc.mustache +++ b/templates/api_doc.mustache @@ -42,6 +42,7 @@ Method | HTTP request | Description {{> api_doc_example }} ### Parameters + {{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}} Name | Type | Description | Notes ------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}} @@ -63,6 +64,7 @@ Name | Type | Description | Notes {{#responses.0}} ### HTTP response details + | Status code | Description | Response headers | |-------------|-------------|------------------| {{#responses}} @@ -71,13 +73,10 @@ Name | Type | Description | Notes {{/responses.0}} [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - {{#vendorExtensions.x-equinix-metal-paginated-property}} # **{{{operationId}}}_all_pages** > {{#returnType}}{{{.}}} {{/returnType}}{{{operationId}}}_all_pages({{#allParams}}{{^vendorExtensions.x-equinix-metal-page-param}}{{#required}}{{{paramName}}}{{/required}}{{^required}}{{{paramName}}}={{{paramName}}}{{/required}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-equinix-metal-page-param}}{{/allParams}}) - Just like [**{{operationId}}**]({{classname}}.md#{{operationId}}) but fetches resources from all pages. This method doesn't take `page` parameter. Other parameters, return type and other characteristics are the same as in [**{{operationId}}**]({{classname}}.md#{{operationId}}). - {{/vendorExtensions.x-equinix-metal-paginated-property}} {{/operation}} {{/operations}} diff --git a/templates/api_test.mustache b/templates/api_test.mustache index 3557f0cb..165d28d7 100644 --- a/templates/api_test.mustache +++ b/templates/api_test.mustache @@ -4,26 +4,24 @@ import unittest -import {{packageName}} -from {{apiPackage}}.{{classFilename}} import {{classname}} # noqa: E501 -from {{packageName}}.rest import ApiException +from {{apiPackage}}.{{classFilename}} import {{classname}} class {{#operations}}Test{{classname}}(unittest.TestCase): """{{classname}} unit test stubs""" - def setUp(self): - self.api = {{apiPackage}}.{{classFilename}}.{{classname}}() # noqa: E501 + def setUp(self) -> None: + self.api = {{classname}}() - def tearDown(self): + def tearDown(self) -> None: pass {{#operation}} - def test_{{operationId}}(self): + def test_{{operationId}}(self) -> None: """Test case for {{{operationId}}} {{#summary}} - {{{.}}} # noqa: E501 + {{{.}}} {{/summary}} """ pass @@ -39,7 +37,7 @@ class {{#operations}}Test{{classname}}(unittest.TestCase): pass {{/vendorExtensions.x-equinix-metal-paginated-property}} -{{/operation}} + {{/operation}} {{/operations}} if __name__ == '__main__':