evcloud 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- evcloud/__init__.py +802 -0
- evcloud/_default_clients.py +30 -0
- evcloud/client.py +200 -0
- evcloud/core/__init__.py +67 -0
- evcloud/core/api_error.py +23 -0
- evcloud/core/client_wrapper.py +108 -0
- evcloud/core/datetime_utils.py +70 -0
- evcloud/core/file.py +67 -0
- evcloud/core/force_multipart.py +18 -0
- evcloud/core/http_client.py +840 -0
- evcloud/core/http_response.py +59 -0
- evcloud/core/http_sse/__init__.py +9 -0
- evcloud/core/http_sse/_api.py +112 -0
- evcloud/core/http_sse/_decoders.py +61 -0
- evcloud/core/http_sse/_exceptions.py +7 -0
- evcloud/core/http_sse/_models.py +17 -0
- evcloud/core/jsonable_encoder.py +120 -0
- evcloud/core/logging.py +107 -0
- evcloud/core/pagination.py +82 -0
- evcloud/core/parse_error.py +36 -0
- evcloud/core/pydantic_utilities.py +634 -0
- evcloud/core/query_encoder.py +58 -0
- evcloud/core/remove_none_from_dict.py +11 -0
- evcloud/core/request_options.py +35 -0
- evcloud/core/serialization.py +276 -0
- evcloud/cpo/__init__.py +31 -0
- evcloud/cpo/cdrs/__init__.py +4 -0
- evcloud/cpo/cdrs/client.py +311 -0
- evcloud/cpo/cdrs/raw_client.py +592 -0
- evcloud/cpo/charge_points/__init__.py +7 -0
- evcloud/cpo/charge_points/client.py +1436 -0
- evcloud/cpo/charge_points/raw_client.py +2809 -0
- evcloud/cpo/charge_points/types/__init__.py +7 -0
- evcloud/cpo/charge_points/types/list_charge_points_request_ocpp_version.py +5 -0
- evcloud/cpo/client.py +62 -0
- evcloud/cpo/connectors/__init__.py +4 -0
- evcloud/cpo/connectors/client.py +698 -0
- evcloud/cpo/connectors/raw_client.py +1457 -0
- evcloud/cpo/evses/__init__.py +4 -0
- evcloud/cpo/evses/client.py +691 -0
- evcloud/cpo/evses/raw_client.py +1457 -0
- evcloud/cpo/health/__init__.py +4 -0
- evcloud/cpo/health/client.py +100 -0
- evcloud/cpo/health/raw_client.py +192 -0
- evcloud/cpo/locations/__init__.py +4 -0
- evcloud/cpo/locations/client.py +1021 -0
- evcloud/cpo/locations/raw_client.py +1887 -0
- evcloud/cpo/raw_client.py +13 -0
- evcloud/cpo/sessions/__init__.py +7 -0
- evcloud/cpo/sessions/client.py +430 -0
- evcloud/cpo/sessions/raw_client.py +889 -0
- evcloud/cpo/sessions/types/__init__.py +8 -0
- evcloud/cpo/sessions/types/list_sessions_request_billing_state.py +5 -0
- evcloud/cpo/sessions/types/list_sessions_request_status.py +7 -0
- evcloud/cpo/tariffs/__init__.py +17 -0
- evcloud/cpo/tariffs/client.py +1232 -0
- evcloud/cpo/tariffs/raw_client.py +2526 -0
- evcloud/cpo/tariffs/types/__init__.py +15 -0
- evcloud/cpo/tariffs/types/list_tariffs_request_type.py +7 -0
- evcloud/cpo/tariffs/types/tariff_create_ocpi_version.py +5 -0
- evcloud/cpo/tariffs/types/tariff_create_preauthorize_amount.py +5 -0
- evcloud/cpo/tariffs/types/tariff_patch_preauthorize_amount.py +5 -0
- evcloud/emsp/__init__.py +55 -0
- evcloud/emsp/cdrs/__init__.py +4 -0
- evcloud/emsp/cdrs/client.py +300 -0
- evcloud/emsp/cdrs/raw_client.py +610 -0
- evcloud/emsp/chargers/__init__.py +7 -0
- evcloud/emsp/chargers/client.py +167 -0
- evcloud/emsp/chargers/raw_client.py +331 -0
- evcloud/emsp/chargers/types/__init__.py +11 -0
- evcloud/emsp/chargers/types/resolve_chargers_response.py +53 -0
- evcloud/emsp/client.py +77 -0
- evcloud/emsp/commands/__init__.py +7 -0
- evcloud/emsp/commands/client.py +516 -0
- evcloud/emsp/commands/raw_client.py +979 -0
- evcloud/emsp/commands/types/__init__.py +7 -0
- evcloud/emsp/commands/types/send_commands_request_command.py +7 -0
- evcloud/emsp/emp_identities/__init__.py +4 -0
- evcloud/emsp/emp_identities/client.py +548 -0
- evcloud/emsp/emp_identities/raw_client.py +1277 -0
- evcloud/emsp/evses/__init__.py +4 -0
- evcloud/emsp/evses/client.py +154 -0
- evcloud/emsp/evses/raw_client.py +288 -0
- evcloud/emsp/health/__init__.py +4 -0
- evcloud/emsp/health/client.py +100 -0
- evcloud/emsp/health/raw_client.py +192 -0
- evcloud/emsp/locations/__init__.py +4 -0
- evcloud/emsp/locations/client.py +1386 -0
- evcloud/emsp/locations/raw_client.py +2903 -0
- evcloud/emsp/networks/__init__.py +7 -0
- evcloud/emsp/networks/client.py +1615 -0
- evcloud/emsp/networks/raw_client.py +3725 -0
- evcloud/emsp/networks/types/__init__.py +9 -0
- evcloud/emsp/networks/types/list_networks_request_network_type.py +5 -0
- evcloud/emsp/networks/types/list_rules_networks_request_validity.py +5 -0
- evcloud/emsp/networks/types/network_rule_create_request_rule_type.py +5 -0
- evcloud/emsp/raw_client.py +13 -0
- evcloud/emsp/sessions/__init__.py +4 -0
- evcloud/emsp/sessions/client.py +300 -0
- evcloud/emsp/sessions/raw_client.py +610 -0
- evcloud/emsp/tariffs/__init__.py +7 -0
- evcloud/emsp/tariffs/client.py +421 -0
- evcloud/emsp/tariffs/raw_client.py +883 -0
- evcloud/emsp/tariffs/types/__init__.py +8 -0
- evcloud/emsp/tariffs/types/estimate_request_kwh.py +5 -0
- evcloud/emsp/tariffs/types/estimate_request_minutes.py +5 -0
- evcloud/emsp/tenant/__init__.py +4 -0
- evcloud/emsp/tenant/client.py +328 -0
- evcloud/emsp/tenant/raw_client.py +869 -0
- evcloud/emsp/token_groups/__init__.py +7 -0
- evcloud/emsp/token_groups/client.py +1256 -0
- evcloud/emsp/token_groups/raw_client.py +3288 -0
- evcloud/emsp/token_groups/types/__init__.py +7 -0
- evcloud/emsp/token_groups/types/remove_token_token_groups_request_type.py +5 -0
- evcloud/emsp/tokens/__init__.py +7 -0
- evcloud/emsp/tokens/client.py +1298 -0
- evcloud/emsp/tokens/raw_client.py +2947 -0
- evcloud/emsp/tokens/types/__init__.py +10 -0
- evcloud/emsp/tokens/types/list_tokens_request_status.py +7 -0
- evcloud/emsp/tokens/types/list_tokens_request_type.py +5 -0
- evcloud/emsp/tokens/types/token_update_default_profile_type.py +5 -0
- evcloud/emsp/tokens/types/token_update_whitelist.py +5 -0
- evcloud/energy/__init__.py +8 -0
- evcloud/energy/client.py +47 -0
- evcloud/energy/control_requests/__init__.py +7 -0
- evcloud/energy/control_requests/client.py +399 -0
- evcloud/energy/control_requests/raw_client.py +835 -0
- evcloud/energy/control_requests/types/__init__.py +7 -0
- evcloud/energy/control_requests/types/list_control_requests_request_result.py +15 -0
- evcloud/energy/health/__init__.py +4 -0
- evcloud/energy/health/client.py +100 -0
- evcloud/energy/health/raw_client.py +192 -0
- evcloud/energy/power_measurements/__init__.py +4 -0
- evcloud/energy/power_measurements/client.py +254 -0
- evcloud/energy/power_measurements/raw_client.py +527 -0
- evcloud/energy/raw_client.py +13 -0
- evcloud/environment.py +7 -0
- evcloud/errors/__init__.py +25 -0
- evcloud/errors/bad_gateway_error.py +11 -0
- evcloud/errors/bad_request_error.py +11 -0
- evcloud/errors/conflict_error.py +11 -0
- evcloud/errors/forbidden_error.py +11 -0
- evcloud/errors/gateway_timeout_error.py +11 -0
- evcloud/errors/not_found_error.py +11 -0
- evcloud/errors/too_many_requests_error.py +11 -0
- evcloud/errors/unauthorized_error.py +11 -0
- evcloud/errors/unprocessable_entity_error.py +11 -0
- evcloud/health/__init__.py +4 -0
- evcloud/health/client.py +99 -0
- evcloud/health/raw_client.py +100 -0
- evcloud/ocpi/__init__.py +123 -0
- evcloud/ocpi/client.py +56 -0
- evcloud/ocpi/cpo_data/__init__.py +31 -0
- evcloud/ocpi/cpo_data/client.py +1553 -0
- evcloud/ocpi/cpo_data/raw_client.py +3119 -0
- evcloud/ocpi/cpo_data/types/__init__.py +29 -0
- evcloud/ocpi/cpo_data/types/cancel_reservation_cpo_data_request_version.py +5 -0
- evcloud/ocpi/cpo_data/types/create_cdr_cpo_data_request_version.py +5 -0
- evcloud/ocpi/cpo_data/types/delete_tariff_cpo_data_request_version.py +5 -0
- evcloud/ocpi/cpo_data/types/send_active_charging_profile_cpo_data_request_version.py +5 -0
- evcloud/ocpi/cpo_data/types/update_connector_cpo_data_request_version.py +5 -0
- evcloud/ocpi/cpo_data/types/update_evse_status_cpo_data_request_version.py +5 -0
- evcloud/ocpi/cpo_data/types/update_location_cpo_data_request_version.py +5 -0
- evcloud/ocpi/cpo_data/types/update_session_cpo_data_request_version.py +5 -0
- evcloud/ocpi/cpo_data/types/upsert_location_cpo_data_request_version.py +5 -0
- evcloud/ocpi/cpo_data/types/upsert_session_cpo_data_request_version.py +5 -0
- evcloud/ocpi/cpo_data/types/upsert_tariff_cpo_data_request_version.py +5 -0
- evcloud/ocpi/credentials/__init__.py +31 -0
- evcloud/ocpi/credentials/client.py +750 -0
- evcloud/ocpi/credentials/raw_client.py +1537 -0
- evcloud/ocpi/credentials/types/__init__.py +29 -0
- evcloud/ocpi/credentials/types/partner_versions_pull_request_partner_token_encoding.py +5 -0
- evcloud/ocpi/credentials/types/pull_versions_credentials_request_role.py +5 -0
- evcloud/ocpi/credentials/types/pull_versions_credentials_request_version.py +5 -0
- evcloud/ocpi/credentials/types/rotate_credentials_request_role.py +5 -0
- evcloud/ocpi/credentials/types/rotate_credentials_request_version.py +5 -0
- evcloud/ocpi/credentials/types/start_handshake_credentials_request_role.py +5 -0
- evcloud/ocpi/credentials/types/start_handshake_credentials_request_version.py +5 -0
- evcloud/ocpi/credentials/types/status_credentials_request_role.py +5 -0
- evcloud/ocpi/credentials/types/status_credentials_request_version.py +5 -0
- evcloud/ocpi/credentials/types/unregister_credentials_request_role.py +5 -0
- evcloud/ocpi/credentials/types/unregister_credentials_request_version.py +5 -0
- evcloud/ocpi/emsp/__init__.py +27 -0
- evcloud/ocpi/emsp/client.py +1142 -0
- evcloud/ocpi/emsp/raw_client.py +2209 -0
- evcloud/ocpi/emsp/types/__init__.py +25 -0
- evcloud/ocpi/emsp/types/charging_preferences_request_profile_type.py +5 -0
- evcloud/ocpi/emsp/types/clear_charging_profile_emsp_request_version.py +5 -0
- evcloud/ocpi/emsp/types/get_active_charging_profile_emsp_request_version.py +5 -0
- evcloud/ocpi/emsp/types/send_command_emsp_request_command.py +7 -0
- evcloud/ocpi/emsp/types/send_command_emsp_request_version.py +5 -0
- evcloud/ocpi/emsp/types/set_charging_preferences_emsp_request_version.py +5 -0
- evcloud/ocpi/emsp/types/set_charging_profile_emsp_request_version.py +5 -0
- evcloud/ocpi/emsp/types/update_token_emsp_request_version.py +5 -0
- evcloud/ocpi/emsp/types/upsert_token_emsp_request_version.py +5 -0
- evcloud/ocpi/invites/__init__.py +19 -0
- evcloud/ocpi/invites/client.py +385 -0
- evcloud/ocpi/invites/raw_client.py +887 -0
- evcloud/ocpi/invites/types/__init__.py +17 -0
- evcloud/ocpi/invites/types/partner_invite_create_request_gateway_role.py +5 -0
- evcloud/ocpi/invites/types/partner_invite_create_request_role.py +5 -0
- evcloud/ocpi/invites/types/partner_invite_create_request_version.py +5 -0
- evcloud/ocpi/invites/types/partner_invite_update_request_gateway_role.py +5 -0
- evcloud/ocpi/invites/types/partner_invite_update_request_version.py +5 -0
- evcloud/ocpi/partners/__init__.py +7 -0
- evcloud/ocpi/partners/client.py +581 -0
- evcloud/ocpi/partners/raw_client.py +1340 -0
- evcloud/ocpi/partners/types/__init__.py +8 -0
- evcloud/ocpi/partners/types/partner_register_request_ocpi_version.py +5 -0
- evcloud/ocpi/partners/types/partner_update_request_ocpi_version.py +5 -0
- evcloud/ocpi/raw_client.py +13 -0
- evcloud/ocpi/sync/__init__.py +33 -0
- evcloud/ocpi/sync/client.py +1701 -0
- evcloud/ocpi/sync/raw_client.py +3685 -0
- evcloud/ocpi/sync/types/__init__.py +31 -0
- evcloud/ocpi/sync/types/pull_cdrs_sync_request_version.py +5 -0
- evcloud/ocpi/sync/types/pull_hub_client_info_as_cpo_sync_request_version.py +5 -0
- evcloud/ocpi/sync/types/pull_hub_client_info_as_emsp_sync_request_version.py +5 -0
- evcloud/ocpi/sync/types/pull_locations_sync_request_version.py +5 -0
- evcloud/ocpi/sync/types/pull_sessions_sync_request_version.py +5 -0
- evcloud/ocpi/sync/types/pull_tariffs_sync_request_version.py +5 -0
- evcloud/ocpi/sync/types/pull_tokens_sync_request_version.py +5 -0
- evcloud/ocpi/sync/types/push_cdr_sync_request_version.py +5 -0
- evcloud/ocpi/sync/types/push_location_sync_request_version.py +5 -0
- evcloud/ocpi/sync/types/push_session_sync_request_version.py +5 -0
- evcloud/ocpi/sync/types/push_tariff_sync_request_version.py +5 -0
- evcloud/ocpi/sync/types/push_token_sync_request_version.py +5 -0
- evcloud/py.typed +0 -0
- evcloud/types/__init__.py +759 -0
- evcloud/types/access_mode.py +5 -0
- evcloud/types/asset_connector.py +26 -0
- evcloud/types/asset_updated_event.py +29 -0
- evcloud/types/availability_page.py +26 -0
- evcloud/types/batch_response.py +26 -0
- evcloud/types/batch_response_missing_item.py +7 -0
- evcloud/types/cdr_event.py +41 -0
- evcloud/types/cdr_out.py +75 -0
- evcloud/types/cdr_out_auth_method.py +7 -0
- evcloud/types/cdr_out_auth_method_zero.py +5 -0
- evcloud/types/cdr_out_origin.py +7 -0
- evcloud/types/cdr_out_origin_zero.py +5 -0
- evcloud/types/cdr_page.py +27 -0
- evcloud/types/cdr_write_response.py +26 -0
- evcloud/types/charge_point_created_out.py +74 -0
- evcloud/types/charge_point_created_out_access_mode.py +7 -0
- evcloud/types/charge_point_created_out_access_mode_zero.py +5 -0
- evcloud/types/charge_point_created_out_pricing.py +7 -0
- evcloud/types/charge_point_created_out_pricing_zero.py +5 -0
- evcloud/types/charge_point_created_out_site_type.py +7 -0
- evcloud/types/charge_point_created_out_site_type_zero.py +5 -0
- evcloud/types/charge_point_out.py +73 -0
- evcloud/types/charge_point_out_access_mode.py +7 -0
- evcloud/types/charge_point_out_access_mode_zero.py +5 -0
- evcloud/types/charge_point_out_pricing.py +7 -0
- evcloud/types/charge_point_out_pricing_zero.py +5 -0
- evcloud/types/charge_point_out_site_type.py +7 -0
- evcloud/types/charge_point_out_site_type_zero.py +5 -0
- evcloud/types/charge_point_page.py +27 -0
- evcloud/types/charging_preferences_response.py +28 -0
- evcloud/types/charging_preferences_response_result.py +10 -0
- evcloud/types/charging_profile.py +30 -0
- evcloud/types/charging_profile_charging_rate_unit.py +5 -0
- evcloud/types/charging_profile_period.py +31 -0
- evcloud/types/charging_profile_response.py +32 -0
- evcloud/types/cluster_page.py +26 -0
- evcloud/types/command_accepted.py +30 -0
- evcloud/types/command_accepted_route.py +53 -0
- evcloud/types/command_accepted_route_own.py +28 -0
- evcloud/types/command_accepted_route_own_ocpi_version.py +7 -0
- evcloud/types/command_accepted_route_own_ocpi_version_zero.py +5 -0
- evcloud/types/command_accepted_route_roaming.py +30 -0
- evcloud/types/command_accepted_route_roaming_ocpi_version.py +7 -0
- evcloud/types/command_accepted_route_roaming_ocpi_version_zero.py +5 -0
- evcloud/types/command_accepted_status.py +7 -0
- evcloud/types/command_accepted_status_zero.py +20 -0
- evcloud/types/command_page.py +26 -0
- evcloud/types/command_record.py +40 -0
- evcloud/types/command_record_command.py +7 -0
- evcloud/types/command_record_command_zero.py +7 -0
- evcloud/types/command_record_route.py +53 -0
- evcloud/types/command_record_route_own.py +28 -0
- evcloud/types/command_record_route_own_ocpi_version.py +7 -0
- evcloud/types/command_record_route_own_ocpi_version_zero.py +5 -0
- evcloud/types/command_record_route_roaming.py +30 -0
- evcloud/types/command_record_route_roaming_ocpi_version.py +7 -0
- evcloud/types/command_record_route_roaming_ocpi_version_zero.py +5 -0
- evcloud/types/command_record_status.py +7 -0
- evcloud/types/command_record_status_zero.py +20 -0
- evcloud/types/command_response_out.py +26 -0
- evcloud/types/command_response_out_result.py +7 -0
- evcloud/types/command_response_out_result_zero.py +7 -0
- evcloud/types/command_result_event.py +39 -0
- evcloud/types/command_result_event_module.py +5 -0
- evcloud/types/command_result_event_protocol.py +5 -0
- evcloud/types/command_result_event_status.py +5 -0
- evcloud/types/command_send_response.py +31 -0
- evcloud/types/command_token.py +36 -0
- evcloud/types/connector_format.py +5 -0
- evcloud/types/connector_page.py +27 -0
- evcloud/types/connector_status_event.py +29 -0
- evcloud/types/connector_write_response.py +27 -0
- evcloud/types/control_action.py +5 -0
- evcloud/types/control_request_page.py +27 -0
- evcloud/types/control_request_response.py +38 -0
- evcloud/types/control_request_response_action.py +7 -0
- evcloud/types/control_request_response_action_zero.py +7 -0
- evcloud/types/control_request_response_result.py +7 -0
- evcloud/types/control_request_response_result_zero.py +15 -0
- evcloud/types/control_request_response_unit.py +7 -0
- evcloud/types/control_request_response_unit_zero.py +5 -0
- evcloud/types/control_response_event.py +38 -0
- evcloud/types/control_response_event_action.py +5 -0
- evcloud/types/control_response_event_result.py +15 -0
- evcloud/types/control_response_event_unit.py +5 -0
- evcloud/types/cpo_connector_out.py +58 -0
- evcloud/types/cpo_connector_out_format.py +7 -0
- evcloud/types/cpo_connector_out_format_zero.py +5 -0
- evcloud/types/cpo_connector_out_ocpi_status.py +7 -0
- evcloud/types/cpo_connector_out_ocpi_status_zero.py +10 -0
- evcloud/types/cpo_connector_out_power_type.py +7 -0
- evcloud/types/cpo_connector_out_power_type_zero.py +7 -0
- evcloud/types/cpo_evse_out.py +61 -0
- evcloud/types/cpo_evse_out_origin.py +7 -0
- evcloud/types/cpo_evse_out_origin_zero.py +5 -0
- evcloud/types/cpo_evse_out_status.py +7 -0
- evcloud/types/cpo_evse_out_status_zero.py +10 -0
- evcloud/types/credentials_handshake_request.py +44 -0
- evcloud/types/credentials_handshake_request_partner_token_encoding.py +5 -0
- evcloud/types/credentials_handshake_response.py +32 -0
- evcloud/types/credentials_handshake_response_action.py +7 -0
- evcloud/types/credentials_handshake_response_version.py +5 -0
- evcloud/types/deliver_event_response.py +23 -0
- evcloud/types/delivery_drift_event.py +30 -0
- evcloud/types/display_text.py +24 -0
- evcloud/types/effective_cpo.py +27 -0
- evcloud/types/effective_cpo_source.py +7 -0
- evcloud/types/effective_cpo_source_zero.py +5 -0
- evcloud/types/effective_view_response.py +29 -0
- evcloud/types/emp_identity_out.py +35 -0
- evcloud/types/emp_identity_out_status.py +7 -0
- evcloud/types/emp_identity_out_status_zero.py +5 -0
- evcloud/types/emp_identity_page.py +26 -0
- evcloud/types/emsp_cdr_out.py +41 -0
- evcloud/types/emsp_cdr_out_source.py +7 -0
- evcloud/types/emsp_cdr_out_source_zero.py +5 -0
- evcloud/types/emsp_cdr_page.py +26 -0
- evcloud/types/emsp_connector_out.py +30 -0
- evcloud/types/emsp_evse_out.py +32 -0
- evcloud/types/emsp_gateway_schema_commands_location_key.py +25 -0
- evcloud/types/emsp_gateway_schema_location_lookup_location_key.py +25 -0
- evcloud/types/emsp_gateway_schema_locations_location_out.py +47 -0
- evcloud/types/emsp_gateway_schema_locations_location_page.py +26 -0
- evcloud/types/emsp_gateway_schema_networks_location_out.py +37 -0
- evcloud/types/emsp_gateway_schema_networks_location_page.py +26 -0
- evcloud/types/emsp_session_out.py +41 -0
- evcloud/types/emsp_session_out_source.py +7 -0
- evcloud/types/emsp_session_out_source_zero.py +5 -0
- evcloud/types/emsp_session_page.py +26 -0
- evcloud/types/emsp_tariff_page.py +26 -0
- evcloud/types/energy_contract.py +24 -0
- evcloud/types/estimate_line.py +27 -0
- evcloud/types/estimate_line_type.py +7 -0
- evcloud/types/estimate_line_type_zero.py +5 -0
- evcloud/types/estimate_response.py +30 -0
- evcloud/types/event_type_list.py +24 -0
- evcloud/types/event_type_response.py +27 -0
- evcloud/types/event_type_response_type.py +7 -0
- evcloud/types/event_type_response_type_zero.py +27 -0
- evcloud/types/event_type_version.py +24 -0
- evcloud/types/evse_connector_status.py +26 -0
- evcloud/types/evse_page.py +27 -0
- evcloud/types/evse_parking.py +25 -0
- evcloud/types/evse_parking_evse_position.py +7 -0
- evcloud/types/evse_parking_evse_position_zero.py +5 -0
- evcloud/types/evse_status_event.py +31 -0
- evcloud/types/evse_status_out.py +32 -0
- evcloud/types/evse_status_write_response.py +28 -0
- evcloud/types/facility_count.py +24 -0
- evcloud/types/facility_page.py +26 -0
- evcloud/types/health_ok.py +24 -0
- evcloud/types/health_ok_status.py +7 -0
- evcloud/types/health_ok_status_zero.py +5 -0
- evcloud/types/http_error_response.py +29 -0
- evcloud/types/http_validation_error.py +24 -0
- evcloud/types/limit_unit.py +5 -0
- evcloud/types/location_availability.py +28 -0
- evcloud/types/location_availability_status.py +7 -0
- evcloud/types/location_availability_status_zero.py +7 -0
- evcloud/types/location_base.py +53 -0
- evcloud/types/location_base_parking_type.py +7 -0
- evcloud/types/location_base_parking_type_zero.py +8 -0
- evcloud/types/location_cluster.py +26 -0
- evcloud/types/location_detail.py +51 -0
- evcloud/types/location_key_input.py +25 -0
- evcloud/types/location_list.py +24 -0
- evcloud/types/location_out.py +79 -0
- evcloud/types/location_out_access_mode.py +7 -0
- evcloud/types/location_out_access_mode_zero.py +5 -0
- evcloud/types/location_out_ocpi_version.py +7 -0
- evcloud/types/location_out_ocpi_version_zero.py +5 -0
- evcloud/types/location_out_origin.py +7 -0
- evcloud/types/location_out_origin_zero.py +5 -0
- evcloud/types/location_out_parking_type.py +7 -0
- evcloud/types/location_out_parking_type_zero.py +8 -0
- evcloud/types/location_out_role.py +7 -0
- evcloud/types/location_out_role_zero.py +5 -0
- evcloud/types/location_out_site_type.py +7 -0
- evcloud/types/location_out_site_type_zero.py +5 -0
- evcloud/types/location_page.py +27 -0
- evcloud/types/location_summary.py +43 -0
- evcloud/types/location_updated_event.py +30 -0
- evcloud/types/location_write_response.py +26 -0
- evcloud/types/map_cluster.py +28 -0
- evcloud/types/map_page.py +29 -0
- evcloud/types/network_consumer.py +25 -0
- evcloud/types/network_consumer_page.py +26 -0
- evcloud/types/network_detail_response.py +49 -0
- evcloud/types/network_detail_response_network_type.py +7 -0
- evcloud/types/network_detail_response_network_type_zero.py +5 -0
- evcloud/types/network_detail_response_publish_state.py +7 -0
- evcloud/types/network_detail_response_publish_state_zero.py +7 -0
- evcloud/types/network_page.py +26 -0
- evcloud/types/network_priority_order.py +23 -0
- evcloud/types/network_response.py +46 -0
- evcloud/types/network_response_network_type.py +7 -0
- evcloud/types/network_response_network_type_zero.py +5 -0
- evcloud/types/network_response_publish_state.py +7 -0
- evcloud/types/network_response_publish_state_zero.py +5 -0
- evcloud/types/network_rule_page.py +26 -0
- evcloud/types/network_rule_response.py +33 -0
- evcloud/types/network_rule_response_rule_type.py +7 -0
- evcloud/types/network_rule_response_rule_type_zero.py +5 -0
- evcloud/types/ocpi_business_details.py +26 -0
- evcloud/types/ocpi_business_details_input.py +26 -0
- evcloud/types/ocpi_cdr_dimension.py +24 -0
- evcloud/types/ocpi_cdr_location.py +30 -0
- evcloud/types/ocpi_cdr_token.py +30 -0
- evcloud/types/ocpi_charging_period.py +27 -0
- evcloud/types/ocpi_display_text.py +24 -0
- evcloud/types/ocpi_energy_mix.py +29 -0
- evcloud/types/ocpi_energy_mix_input.py +29 -0
- evcloud/types/ocpi_energy_source.py +24 -0
- evcloud/types/ocpi_energy_source_input.py +24 -0
- evcloud/types/ocpi_environmental_impact.py +24 -0
- evcloud/types/ocpi_evse_parking.py +24 -0
- evcloud/types/ocpi_exceptional_period.py +25 -0
- evcloud/types/ocpi_geo_location.py +24 -0
- evcloud/types/ocpi_geo_location_in.py +24 -0
- evcloud/types/ocpi_image.py +28 -0
- evcloud/types/ocpi_image_input.py +28 -0
- evcloud/types/ocpi_opening_times.py +28 -0
- evcloud/types/ocpi_opening_times_input.py +28 -0
- evcloud/types/ocpi_parking_place.py +44 -0
- evcloud/types/ocpi_parking_place_input.py +44 -0
- evcloud/types/ocpi_price_component_input.py +28 -0
- evcloud/types/ocpi_price_component_input_price.py +5 -0
- evcloud/types/ocpi_price_component_input_vat.py +5 -0
- evcloud/types/ocpi_price_component_output.py +26 -0
- evcloud/types/ocpi_price_input.py +26 -0
- evcloud/types/ocpi_price_input_excl_vat.py +5 -0
- evcloud/types/ocpi_price_input_incl_vat.py +5 -0
- evcloud/types/ocpi_price_output.py +24 -0
- evcloud/types/ocpi_publish_token.py +27 -0
- evcloud/types/ocpi_regular_hours.py +25 -0
- evcloud/types/ocpi_regular_hours_input.py +25 -0
- evcloud/types/ocpi_related_location.py +26 -0
- evcloud/types/ocpi_signed_data.py +28 -0
- evcloud/types/ocpi_signed_value.py +25 -0
- evcloud/types/ocpi_status_schedule.py +26 -0
- evcloud/types/ocpi_tariff_element_input.py +26 -0
- evcloud/types/ocpi_tariff_element_output.py +26 -0
- evcloud/types/ocpi_tariff_restrictions_input.py +33 -0
- evcloud/types/ocpi_tariff_restrictions_input_max_kwh.py +5 -0
- evcloud/types/ocpi_tariff_restrictions_input_min_kwh.py +5 -0
- evcloud/types/ocpi_tariff_restrictions_output.py +31 -0
- evcloud/types/ocpi_tariff_snapshot.py +26 -0
- evcloud/types/ocpp_version.py +5 -0
- evcloud/types/page_info.py +24 -0
- evcloud/types/parking.py +45 -0
- evcloud/types/parking_direction.py +7 -0
- evcloud/types/parking_direction_zero.py +5 -0
- evcloud/types/parking_type.py +8 -0
- evcloud/types/parking_vehicle_types_item.py +7 -0
- evcloud/types/parking_vehicle_types_item_zero.py +18 -0
- evcloud/types/partner_invite_response.py +47 -0
- evcloud/types/partner_invite_response_action.py +5 -0
- evcloud/types/partner_invite_response_role.py +5 -0
- evcloud/types/partner_invite_response_version.py +5 -0
- evcloud/types/partner_invite_revoke_response.py +31 -0
- evcloud/types/partner_invite_revoke_response_role.py +5 -0
- evcloud/types/partner_response.py +41 -0
- evcloud/types/partner_response_ocpi_version.py +5 -0
- evcloud/types/partner_token_updated_event.py +35 -0
- evcloud/types/partner_versions_pull_response.py +29 -0
- evcloud/types/partner_versions_pull_response_code.py +8 -0
- evcloud/types/partner_versions_pull_response_version.py +5 -0
- evcloud/types/power_measurement.py +30 -0
- evcloud/types/power_measurement_event.py +30 -0
- evcloud/types/power_measurement_list.py +24 -0
- evcloud/types/power_type.py +5 -0
- evcloud/types/price_component.py +26 -0
- evcloud/types/price_limit.py +24 -0
- evcloud/types/pricing_mode.py +5 -0
- evcloud/types/queue_health.py +34 -0
- evcloud/types/reservation_cancel_response.py +25 -0
- evcloud/types/resolve_chargers_response_own.py +28 -0
- evcloud/types/resolve_chargers_response_own_ocpi_version.py +7 -0
- evcloud/types/resolve_chargers_response_own_ocpi_version_zero.py +5 -0
- evcloud/types/resolve_chargers_response_roaming.py +30 -0
- evcloud/types/resolve_chargers_response_roaming_ocpi_version.py +7 -0
- evcloud/types/resolve_chargers_response_roaming_ocpi_version_zero.py +5 -0
- evcloud/types/session_event.py +39 -0
- evcloud/types/session_out.py +60 -0
- evcloud/types/session_out_auth_method.py +7 -0
- evcloud/types/session_out_auth_method_zero.py +5 -0
- evcloud/types/session_out_billing_state.py +7 -0
- evcloud/types/session_out_billing_state_zero.py +5 -0
- evcloud/types/session_out_origin.py +7 -0
- evcloud/types/session_out_origin_zero.py +5 -0
- evcloud/types/session_out_status.py +7 -0
- evcloud/types/session_out_status_zero.py +7 -0
- evcloud/types/session_page.py +27 -0
- evcloud/types/session_write_response.py +27 -0
- evcloud/types/sharing_slot.py +25 -0
- evcloud/types/sharing_slot_input.py +25 -0
- evcloud/types/site_type.py +5 -0
- evcloud/types/sync_patch_request.py +26 -0
- evcloud/types/sync_pull_response.py +31 -0
- evcloud/types/sync_push_response.py +31 -0
- evcloud/types/sync_push_response_status.py +5 -0
- evcloud/types/tariff.py +42 -0
- evcloud/types/tariff_assignment_out.py +32 -0
- evcloud/types/tariff_assignment_page.py +27 -0
- evcloud/types/tariff_delete_response.py +26 -0
- evcloud/types/tariff_display.py +27 -0
- evcloud/types/tariff_element.py +26 -0
- evcloud/types/tariff_out.py +57 -0
- evcloud/types/tariff_out_origin.py +7 -0
- evcloud/types/tariff_out_origin_zero.py +5 -0
- evcloud/types/tariff_out_tax_included.py +7 -0
- evcloud/types/tariff_out_tax_included_zero.py +5 -0
- evcloud/types/tariff_out_type.py +7 -0
- evcloud/types/tariff_out_type_zero.py +7 -0
- evcloud/types/tariff_page.py +27 -0
- evcloud/types/tariff_restrictions.py +36 -0
- evcloud/types/tariff_summary.py +29 -0
- evcloud/types/tariff_tax_included.py +7 -0
- evcloud/types/tariff_tax_included_zero.py +5 -0
- evcloud/types/tariff_type.py +7 -0
- evcloud/types/tariff_updated_event.py +29 -0
- evcloud/types/tariff_write_response.py +26 -0
- evcloud/types/tax_included.py +5 -0
- evcloud/types/tenant_profile_out.py +31 -0
- evcloud/types/token_bulk_out.py +26 -0
- evcloud/types/token_create.py +46 -0
- evcloud/types/token_create_default_profile_type.py +5 -0
- evcloud/types/token_create_ocpi_version.py +5 -0
- evcloud/types/token_create_type.py +5 -0
- evcloud/types/token_create_whitelist.py +5 -0
- evcloud/types/token_event_data.py +47 -0
- evcloud/types/token_event_data_status.py +7 -0
- evcloud/types/token_event_data_type.py +5 -0
- evcloud/types/token_event_data_whitelist.py +5 -0
- evcloud/types/token_event_out.py +32 -0
- evcloud/types/token_event_out_event.py +7 -0
- evcloud/types/token_event_out_event_zero.py +7 -0
- evcloud/types/token_event_page.py +26 -0
- evcloud/types/token_failure_item.py +24 -0
- evcloud/types/token_group_action_out.py +27 -0
- evcloud/types/token_group_failure.py +24 -0
- evcloud/types/token_group_member_out.py +26 -0
- evcloud/types/token_group_network_out.py +35 -0
- evcloud/types/token_group_network_page.py +26 -0
- evcloud/types/token_group_out.py +31 -0
- evcloud/types/token_group_page.py +26 -0
- evcloud/types/token_out.py +55 -0
- evcloud/types/token_out_status.py +7 -0
- evcloud/types/token_out_status_zero.py +7 -0
- evcloud/types/token_out_type.py +7 -0
- evcloud/types/token_out_type_zero.py +5 -0
- evcloud/types/token_out_whitelist.py +7 -0
- evcloud/types/token_out_whitelist_zero.py +5 -0
- evcloud/types/token_page.py +26 -0
- evcloud/types/token_reason.py +23 -0
- evcloud/types/token_ref.py +26 -0
- evcloud/types/token_ref_ocpi_version.py +5 -0
- evcloud/types/token_write_response.py +28 -0
- evcloud/types/validation_error.py +28 -0
- evcloud/types/validation_error_loc_item.py +5 -0
- evcloud/types/webhook_delivery_page.py +27 -0
- evcloud/types/webhook_delivery_response.py +35 -0
- evcloud/types/webhook_page.py +27 -0
- evcloud/types/webhook_response.py +42 -0
- evcloud/types/webhook_response_event.py +7 -0
- evcloud/types/webhook_response_event_zero.py +27 -0
- evcloud/types/webhook_response_status.py +7 -0
- evcloud/types/webhook_response_status_zero.py +5 -0
- evcloud/types/webhook_test_result.py +25 -0
- evcloud/types/webhook_with_secret_response.py +43 -0
- evcloud/types/webhook_with_secret_response_event.py +7 -0
- evcloud/types/webhook_with_secret_response_event_zero.py +27 -0
- evcloud/types/webhook_with_secret_response_status.py +7 -0
- evcloud/types/webhook_with_secret_response_status_zero.py +5 -0
- evcloud/version.py +3 -0
- evcloud/webhooks/__init__.py +28 -0
- evcloud/webhooks/client.py +53 -0
- evcloud/webhooks/deliveries/__init__.py +4 -0
- evcloud/webhooks/deliveries/client.py +141 -0
- evcloud/webhooks/deliveries/raw_client.py +268 -0
- evcloud/webhooks/endpoints/__init__.py +17 -0
- evcloud/webhooks/endpoints/client.py +642 -0
- evcloud/webhooks/endpoints/raw_client.py +1521 -0
- evcloud/webhooks/endpoints/types/__init__.py +15 -0
- evcloud/webhooks/endpoints/types/list_endpoints_request_event_types_item.py +27 -0
- evcloud/webhooks/endpoints/types/webhook_create_request_api_version.py +5 -0
- evcloud/webhooks/endpoints/types/webhook_create_request_event.py +27 -0
- evcloud/webhooks/endpoints/types/webhook_update_request_status.py +5 -0
- evcloud/webhooks/event_types/__init__.py +7 -0
- evcloud/webhooks/event_types/client.py +176 -0
- evcloud/webhooks/event_types/raw_client.py +418 -0
- evcloud/webhooks/event_types/types/__init__.py +7 -0
- evcloud/webhooks/event_types/types/get_event_types_request_type.py +27 -0
- evcloud/webhooks/events/__init__.py +7 -0
- evcloud/webhooks/events/client.py +207 -0
- evcloud/webhooks/events/raw_client.py +355 -0
- evcloud/webhooks/events/types/__init__.py +8 -0
- evcloud/webhooks/events/types/deliver_event_request_data.py +33 -0
- evcloud/webhooks/events/types/deliver_event_request_event.py +27 -0
- evcloud/webhooks/health/__init__.py +4 -0
- evcloud/webhooks/health/client.py +161 -0
- evcloud/webhooks/health/raw_client.py +380 -0
- evcloud/webhooks/raw_client.py +13 -0
- evcloud-0.1.0.dist-info/METADATA +257 -0
- evcloud-0.1.0.dist-info/RECORD +635 -0
- evcloud-0.1.0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,3725 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import datetime as dt
|
|
4
|
+
import typing
|
|
5
|
+
from json.decoder import JSONDecodeError
|
|
6
|
+
|
|
7
|
+
from ...core.api_error import ApiError
|
|
8
|
+
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
9
|
+
from ...core.http_response import AsyncHttpResponse, HttpResponse
|
|
10
|
+
from ...core.jsonable_encoder import encode_path_param
|
|
11
|
+
from ...core.pagination import AsyncPager, SyncPager
|
|
12
|
+
from ...core.parse_error import ParsingError
|
|
13
|
+
from ...core.pydantic_utilities import parse_obj_as
|
|
14
|
+
from ...core.request_options import RequestOptions
|
|
15
|
+
from ...errors.bad_gateway_error import BadGatewayError
|
|
16
|
+
from ...errors.bad_request_error import BadRequestError
|
|
17
|
+
from ...errors.conflict_error import ConflictError
|
|
18
|
+
from ...errors.gateway_timeout_error import GatewayTimeoutError
|
|
19
|
+
from ...errors.not_found_error import NotFoundError
|
|
20
|
+
from ...errors.too_many_requests_error import TooManyRequestsError
|
|
21
|
+
from ...errors.unauthorized_error import UnauthorizedError
|
|
22
|
+
from ...errors.unprocessable_entity_error import UnprocessableEntityError
|
|
23
|
+
from ...types.effective_cpo import EffectiveCpo
|
|
24
|
+
from ...types.effective_view_response import EffectiveViewResponse
|
|
25
|
+
from ...types.emsp_gateway_schema_networks_location_out import EmspGatewaySchemaNetworksLocationOut
|
|
26
|
+
from ...types.emsp_gateway_schema_networks_location_page import EmspGatewaySchemaNetworksLocationPage
|
|
27
|
+
from ...types.http_error_response import HttpErrorResponse
|
|
28
|
+
from ...types.http_validation_error import HttpValidationError
|
|
29
|
+
from ...types.network_consumer import NetworkConsumer
|
|
30
|
+
from ...types.network_consumer_page import NetworkConsumerPage
|
|
31
|
+
from ...types.network_detail_response import NetworkDetailResponse
|
|
32
|
+
from ...types.network_page import NetworkPage
|
|
33
|
+
from ...types.network_response import NetworkResponse
|
|
34
|
+
from ...types.network_rule_page import NetworkRulePage
|
|
35
|
+
from ...types.network_rule_response import NetworkRuleResponse
|
|
36
|
+
from .types.list_networks_request_network_type import ListNetworksRequestNetworkType
|
|
37
|
+
from .types.list_rules_networks_request_validity import ListRulesNetworksRequestValidity
|
|
38
|
+
from .types.network_rule_create_request_rule_type import NetworkRuleCreateRequestRuleType
|
|
39
|
+
from pydantic import ValidationError
|
|
40
|
+
|
|
41
|
+
# this is used as the default value for optional parameters
|
|
42
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class RawNetworksClient:
|
|
46
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
47
|
+
self._client_wrapper = client_wrapper
|
|
48
|
+
|
|
49
|
+
def list(
|
|
50
|
+
self,
|
|
51
|
+
*,
|
|
52
|
+
network_type: typing.Optional[ListNetworksRequestNetworkType] = None,
|
|
53
|
+
parent_network_id: typing.Optional[int] = None,
|
|
54
|
+
published: typing.Optional[bool] = None,
|
|
55
|
+
after: typing.Optional[str] = None,
|
|
56
|
+
limit: typing.Optional[int] = None,
|
|
57
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
58
|
+
) -> SyncPager[NetworkResponse, NetworkPage]:
|
|
59
|
+
"""
|
|
60
|
+
Your base networks and the sub-networks that slice them.
|
|
61
|
+
|
|
62
|
+
Parameters
|
|
63
|
+
----------
|
|
64
|
+
network_type : typing.Optional[ListNetworksRequestNetworkType]
|
|
65
|
+
Only BASE or only TENANT (sub-)networks.
|
|
66
|
+
|
|
67
|
+
parent_network_id : typing.Optional[int]
|
|
68
|
+
Only sub-networks of this base network.
|
|
69
|
+
|
|
70
|
+
published : typing.Optional[bool]
|
|
71
|
+
Only published (true) or unpublished (false) networks.
|
|
72
|
+
|
|
73
|
+
after : typing.Optional[str]
|
|
74
|
+
Cursor: the previous page's ``pagination.end_cursor``. Omit it for the first page.
|
|
75
|
+
|
|
76
|
+
limit : typing.Optional[int]
|
|
77
|
+
Maximum rows per page (default 50, max 200).
|
|
78
|
+
|
|
79
|
+
request_options : typing.Optional[RequestOptions]
|
|
80
|
+
Request-specific configuration.
|
|
81
|
+
|
|
82
|
+
Returns
|
|
83
|
+
-------
|
|
84
|
+
SyncPager[NetworkResponse, NetworkPage]
|
|
85
|
+
One page of networks; ``pagination.has_next`` is false on the last page.
|
|
86
|
+
"""
|
|
87
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
88
|
+
"emsp/networks",
|
|
89
|
+
method="GET",
|
|
90
|
+
params={
|
|
91
|
+
"network_type": network_type,
|
|
92
|
+
"parent_network_id": parent_network_id,
|
|
93
|
+
"published": published,
|
|
94
|
+
"after": after,
|
|
95
|
+
"limit": limit,
|
|
96
|
+
},
|
|
97
|
+
request_options=request_options,
|
|
98
|
+
)
|
|
99
|
+
try:
|
|
100
|
+
if 200 <= _response.status_code < 300:
|
|
101
|
+
_parsed_response = typing.cast(
|
|
102
|
+
NetworkPage,
|
|
103
|
+
parse_obj_as(
|
|
104
|
+
type_=NetworkPage, # type: ignore
|
|
105
|
+
object_=_response.json(),
|
|
106
|
+
),
|
|
107
|
+
)
|
|
108
|
+
_items = _parsed_response.data
|
|
109
|
+
_has_next = False
|
|
110
|
+
_get_next = None
|
|
111
|
+
if _parsed_response.pagination is not None:
|
|
112
|
+
_parsed_next = _parsed_response.pagination.end_cursor
|
|
113
|
+
_has_next = _parsed_next is not None and _parsed_next != ""
|
|
114
|
+
_get_next = lambda: self.list(
|
|
115
|
+
network_type=network_type,
|
|
116
|
+
parent_network_id=parent_network_id,
|
|
117
|
+
published=published,
|
|
118
|
+
after=_parsed_next,
|
|
119
|
+
limit=limit,
|
|
120
|
+
request_options=request_options,
|
|
121
|
+
)
|
|
122
|
+
return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
|
|
123
|
+
if _response.status_code == 401:
|
|
124
|
+
raise UnauthorizedError(
|
|
125
|
+
headers=dict(_response.headers),
|
|
126
|
+
body=typing.cast(
|
|
127
|
+
HttpErrorResponse,
|
|
128
|
+
parse_obj_as(
|
|
129
|
+
type_=HttpErrorResponse, # type: ignore
|
|
130
|
+
object_=_response.json(),
|
|
131
|
+
),
|
|
132
|
+
),
|
|
133
|
+
)
|
|
134
|
+
if _response.status_code == 422:
|
|
135
|
+
raise UnprocessableEntityError(
|
|
136
|
+
headers=dict(_response.headers),
|
|
137
|
+
body=typing.cast(
|
|
138
|
+
HttpValidationError,
|
|
139
|
+
parse_obj_as(
|
|
140
|
+
type_=HttpValidationError, # type: ignore
|
|
141
|
+
object_=_response.json(),
|
|
142
|
+
),
|
|
143
|
+
),
|
|
144
|
+
)
|
|
145
|
+
if _response.status_code == 429:
|
|
146
|
+
raise TooManyRequestsError(
|
|
147
|
+
headers=dict(_response.headers),
|
|
148
|
+
body=typing.cast(
|
|
149
|
+
HttpErrorResponse,
|
|
150
|
+
parse_obj_as(
|
|
151
|
+
type_=HttpErrorResponse, # type: ignore
|
|
152
|
+
object_=_response.json(),
|
|
153
|
+
),
|
|
154
|
+
),
|
|
155
|
+
)
|
|
156
|
+
if _response.status_code == 502:
|
|
157
|
+
raise BadGatewayError(
|
|
158
|
+
headers=dict(_response.headers),
|
|
159
|
+
body=typing.cast(
|
|
160
|
+
HttpErrorResponse,
|
|
161
|
+
parse_obj_as(
|
|
162
|
+
type_=HttpErrorResponse, # type: ignore
|
|
163
|
+
object_=_response.json(),
|
|
164
|
+
),
|
|
165
|
+
),
|
|
166
|
+
)
|
|
167
|
+
if _response.status_code == 504:
|
|
168
|
+
raise GatewayTimeoutError(
|
|
169
|
+
headers=dict(_response.headers),
|
|
170
|
+
body=typing.cast(
|
|
171
|
+
HttpErrorResponse,
|
|
172
|
+
parse_obj_as(
|
|
173
|
+
type_=HttpErrorResponse, # type: ignore
|
|
174
|
+
object_=_response.json(),
|
|
175
|
+
),
|
|
176
|
+
),
|
|
177
|
+
)
|
|
178
|
+
_response_json = _response.json()
|
|
179
|
+
except JSONDecodeError:
|
|
180
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
181
|
+
except ValidationError as e:
|
|
182
|
+
raise ParsingError(
|
|
183
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
184
|
+
)
|
|
185
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
186
|
+
|
|
187
|
+
def create(
|
|
188
|
+
self,
|
|
189
|
+
*,
|
|
190
|
+
idempotency_key: str,
|
|
191
|
+
name: str,
|
|
192
|
+
parent_network_id: int,
|
|
193
|
+
cpo_ids: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
194
|
+
description: typing.Optional[str] = OMIT,
|
|
195
|
+
countries: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
196
|
+
power_types: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
197
|
+
parking_types: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
198
|
+
facilities: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
199
|
+
auto_accept_cpo_additions: typing.Optional[bool] = OMIT,
|
|
200
|
+
publicly_accessible: typing.Optional[bool] = OMIT,
|
|
201
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
202
|
+
) -> HttpResponse[NetworkResponse]:
|
|
203
|
+
"""
|
|
204
|
+
A named slice of one of your base networks: some of its CPOs, optionally filtered by country, power, parking and facilities.
|
|
205
|
+
|
|
206
|
+
Parameters
|
|
207
|
+
----------
|
|
208
|
+
idempotency_key : str
|
|
209
|
+
A unique key you choose for this call, e.g. a UUID. Retrying with the same key returns the first result instead of acting twice.
|
|
210
|
+
|
|
211
|
+
name : str
|
|
212
|
+
|
|
213
|
+
parent_network_id : int
|
|
214
|
+
|
|
215
|
+
cpo_ids : typing.Optional[typing.Sequence[str]]
|
|
216
|
+
|
|
217
|
+
description : typing.Optional[str]
|
|
218
|
+
|
|
219
|
+
countries : typing.Optional[typing.Sequence[str]]
|
|
220
|
+
|
|
221
|
+
power_types : typing.Optional[typing.Sequence[str]]
|
|
222
|
+
|
|
223
|
+
parking_types : typing.Optional[typing.Sequence[str]]
|
|
224
|
+
|
|
225
|
+
facilities : typing.Optional[typing.Sequence[str]]
|
|
226
|
+
|
|
227
|
+
auto_accept_cpo_additions : typing.Optional[bool]
|
|
228
|
+
|
|
229
|
+
publicly_accessible : typing.Optional[bool]
|
|
230
|
+
|
|
231
|
+
request_options : typing.Optional[RequestOptions]
|
|
232
|
+
Request-specific configuration.
|
|
233
|
+
|
|
234
|
+
Returns
|
|
235
|
+
-------
|
|
236
|
+
HttpResponse[NetworkResponse]
|
|
237
|
+
The created sub-network.
|
|
238
|
+
"""
|
|
239
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
240
|
+
"emsp/networks",
|
|
241
|
+
method="POST",
|
|
242
|
+
json={
|
|
243
|
+
"name": name,
|
|
244
|
+
"parent_network_id": parent_network_id,
|
|
245
|
+
"cpo_ids": cpo_ids,
|
|
246
|
+
"description": description,
|
|
247
|
+
"countries": countries,
|
|
248
|
+
"power_types": power_types,
|
|
249
|
+
"parking_types": parking_types,
|
|
250
|
+
"facilities": facilities,
|
|
251
|
+
"auto_accept_cpo_additions": auto_accept_cpo_additions,
|
|
252
|
+
"publicly_accessible": publicly_accessible,
|
|
253
|
+
},
|
|
254
|
+
headers={
|
|
255
|
+
"content-type": "application/json",
|
|
256
|
+
"Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None,
|
|
257
|
+
},
|
|
258
|
+
request_options=request_options,
|
|
259
|
+
omit=OMIT,
|
|
260
|
+
)
|
|
261
|
+
try:
|
|
262
|
+
if 200 <= _response.status_code < 300:
|
|
263
|
+
_data = typing.cast(
|
|
264
|
+
NetworkResponse,
|
|
265
|
+
parse_obj_as(
|
|
266
|
+
type_=NetworkResponse, # type: ignore
|
|
267
|
+
object_=_response.json(),
|
|
268
|
+
),
|
|
269
|
+
)
|
|
270
|
+
return HttpResponse(response=_response, data=_data)
|
|
271
|
+
if _response.status_code == 400:
|
|
272
|
+
raise BadRequestError(
|
|
273
|
+
headers=dict(_response.headers),
|
|
274
|
+
body=typing.cast(
|
|
275
|
+
HttpErrorResponse,
|
|
276
|
+
parse_obj_as(
|
|
277
|
+
type_=HttpErrorResponse, # type: ignore
|
|
278
|
+
object_=_response.json(),
|
|
279
|
+
),
|
|
280
|
+
),
|
|
281
|
+
)
|
|
282
|
+
if _response.status_code == 401:
|
|
283
|
+
raise UnauthorizedError(
|
|
284
|
+
headers=dict(_response.headers),
|
|
285
|
+
body=typing.cast(
|
|
286
|
+
HttpErrorResponse,
|
|
287
|
+
parse_obj_as(
|
|
288
|
+
type_=HttpErrorResponse, # type: ignore
|
|
289
|
+
object_=_response.json(),
|
|
290
|
+
),
|
|
291
|
+
),
|
|
292
|
+
)
|
|
293
|
+
if _response.status_code == 404:
|
|
294
|
+
raise NotFoundError(
|
|
295
|
+
headers=dict(_response.headers),
|
|
296
|
+
body=typing.cast(
|
|
297
|
+
HttpErrorResponse,
|
|
298
|
+
parse_obj_as(
|
|
299
|
+
type_=HttpErrorResponse, # type: ignore
|
|
300
|
+
object_=_response.json(),
|
|
301
|
+
),
|
|
302
|
+
),
|
|
303
|
+
)
|
|
304
|
+
if _response.status_code == 409:
|
|
305
|
+
raise ConflictError(
|
|
306
|
+
headers=dict(_response.headers),
|
|
307
|
+
body=typing.cast(
|
|
308
|
+
HttpErrorResponse,
|
|
309
|
+
parse_obj_as(
|
|
310
|
+
type_=HttpErrorResponse, # type: ignore
|
|
311
|
+
object_=_response.json(),
|
|
312
|
+
),
|
|
313
|
+
),
|
|
314
|
+
)
|
|
315
|
+
if _response.status_code == 422:
|
|
316
|
+
raise UnprocessableEntityError(
|
|
317
|
+
headers=dict(_response.headers),
|
|
318
|
+
body=typing.cast(
|
|
319
|
+
HttpValidationError,
|
|
320
|
+
parse_obj_as(
|
|
321
|
+
type_=HttpValidationError, # type: ignore
|
|
322
|
+
object_=_response.json(),
|
|
323
|
+
),
|
|
324
|
+
),
|
|
325
|
+
)
|
|
326
|
+
if _response.status_code == 429:
|
|
327
|
+
raise TooManyRequestsError(
|
|
328
|
+
headers=dict(_response.headers),
|
|
329
|
+
body=typing.cast(
|
|
330
|
+
HttpErrorResponse,
|
|
331
|
+
parse_obj_as(
|
|
332
|
+
type_=HttpErrorResponse, # type: ignore
|
|
333
|
+
object_=_response.json(),
|
|
334
|
+
),
|
|
335
|
+
),
|
|
336
|
+
)
|
|
337
|
+
if _response.status_code == 502:
|
|
338
|
+
raise BadGatewayError(
|
|
339
|
+
headers=dict(_response.headers),
|
|
340
|
+
body=typing.cast(
|
|
341
|
+
HttpErrorResponse,
|
|
342
|
+
parse_obj_as(
|
|
343
|
+
type_=HttpErrorResponse, # type: ignore
|
|
344
|
+
object_=_response.json(),
|
|
345
|
+
),
|
|
346
|
+
),
|
|
347
|
+
)
|
|
348
|
+
if _response.status_code == 504:
|
|
349
|
+
raise GatewayTimeoutError(
|
|
350
|
+
headers=dict(_response.headers),
|
|
351
|
+
body=typing.cast(
|
|
352
|
+
HttpErrorResponse,
|
|
353
|
+
parse_obj_as(
|
|
354
|
+
type_=HttpErrorResponse, # type: ignore
|
|
355
|
+
object_=_response.json(),
|
|
356
|
+
),
|
|
357
|
+
),
|
|
358
|
+
)
|
|
359
|
+
_response_json = _response.json()
|
|
360
|
+
except JSONDecodeError:
|
|
361
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
362
|
+
except ValidationError as e:
|
|
363
|
+
raise ParsingError(
|
|
364
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
365
|
+
)
|
|
366
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
367
|
+
|
|
368
|
+
def create_base(
|
|
369
|
+
self,
|
|
370
|
+
*,
|
|
371
|
+
idempotency_key: str,
|
|
372
|
+
emp_identity_id: int,
|
|
373
|
+
cpo_ids: typing.Sequence[str],
|
|
374
|
+
name: typing.Optional[str] = OMIT,
|
|
375
|
+
description: typing.Optional[str] = OMIT,
|
|
376
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
377
|
+
) -> HttpResponse[NetworkResponse]:
|
|
378
|
+
"""
|
|
379
|
+
Every CPO reachable through one of your roaming identities. Base networks are permanent.
|
|
380
|
+
|
|
381
|
+
Parameters
|
|
382
|
+
----------
|
|
383
|
+
idempotency_key : str
|
|
384
|
+
A unique key you choose for this call, e.g. a UUID. Retrying with the same key returns the first result instead of acting twice.
|
|
385
|
+
|
|
386
|
+
emp_identity_id : int
|
|
387
|
+
|
|
388
|
+
cpo_ids : typing.Sequence[str]
|
|
389
|
+
|
|
390
|
+
name : typing.Optional[str]
|
|
391
|
+
|
|
392
|
+
description : typing.Optional[str]
|
|
393
|
+
|
|
394
|
+
request_options : typing.Optional[RequestOptions]
|
|
395
|
+
Request-specific configuration.
|
|
396
|
+
|
|
397
|
+
Returns
|
|
398
|
+
-------
|
|
399
|
+
HttpResponse[NetworkResponse]
|
|
400
|
+
The created base network.
|
|
401
|
+
"""
|
|
402
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
403
|
+
"emsp/networks/base",
|
|
404
|
+
method="POST",
|
|
405
|
+
json={
|
|
406
|
+
"emp_identity_id": emp_identity_id,
|
|
407
|
+
"cpo_ids": cpo_ids,
|
|
408
|
+
"name": name,
|
|
409
|
+
"description": description,
|
|
410
|
+
},
|
|
411
|
+
headers={
|
|
412
|
+
"content-type": "application/json",
|
|
413
|
+
"Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None,
|
|
414
|
+
},
|
|
415
|
+
request_options=request_options,
|
|
416
|
+
omit=OMIT,
|
|
417
|
+
)
|
|
418
|
+
try:
|
|
419
|
+
if 200 <= _response.status_code < 300:
|
|
420
|
+
_data = typing.cast(
|
|
421
|
+
NetworkResponse,
|
|
422
|
+
parse_obj_as(
|
|
423
|
+
type_=NetworkResponse, # type: ignore
|
|
424
|
+
object_=_response.json(),
|
|
425
|
+
),
|
|
426
|
+
)
|
|
427
|
+
return HttpResponse(response=_response, data=_data)
|
|
428
|
+
if _response.status_code == 401:
|
|
429
|
+
raise UnauthorizedError(
|
|
430
|
+
headers=dict(_response.headers),
|
|
431
|
+
body=typing.cast(
|
|
432
|
+
HttpErrorResponse,
|
|
433
|
+
parse_obj_as(
|
|
434
|
+
type_=HttpErrorResponse, # type: ignore
|
|
435
|
+
object_=_response.json(),
|
|
436
|
+
),
|
|
437
|
+
),
|
|
438
|
+
)
|
|
439
|
+
if _response.status_code == 404:
|
|
440
|
+
raise NotFoundError(
|
|
441
|
+
headers=dict(_response.headers),
|
|
442
|
+
body=typing.cast(
|
|
443
|
+
HttpErrorResponse,
|
|
444
|
+
parse_obj_as(
|
|
445
|
+
type_=HttpErrorResponse, # type: ignore
|
|
446
|
+
object_=_response.json(),
|
|
447
|
+
),
|
|
448
|
+
),
|
|
449
|
+
)
|
|
450
|
+
if _response.status_code == 409:
|
|
451
|
+
raise ConflictError(
|
|
452
|
+
headers=dict(_response.headers),
|
|
453
|
+
body=typing.cast(
|
|
454
|
+
HttpErrorResponse,
|
|
455
|
+
parse_obj_as(
|
|
456
|
+
type_=HttpErrorResponse, # type: ignore
|
|
457
|
+
object_=_response.json(),
|
|
458
|
+
),
|
|
459
|
+
),
|
|
460
|
+
)
|
|
461
|
+
if _response.status_code == 422:
|
|
462
|
+
raise UnprocessableEntityError(
|
|
463
|
+
headers=dict(_response.headers),
|
|
464
|
+
body=typing.cast(
|
|
465
|
+
HttpValidationError,
|
|
466
|
+
parse_obj_as(
|
|
467
|
+
type_=HttpValidationError, # type: ignore
|
|
468
|
+
object_=_response.json(),
|
|
469
|
+
),
|
|
470
|
+
),
|
|
471
|
+
)
|
|
472
|
+
if _response.status_code == 429:
|
|
473
|
+
raise TooManyRequestsError(
|
|
474
|
+
headers=dict(_response.headers),
|
|
475
|
+
body=typing.cast(
|
|
476
|
+
HttpErrorResponse,
|
|
477
|
+
parse_obj_as(
|
|
478
|
+
type_=HttpErrorResponse, # type: ignore
|
|
479
|
+
object_=_response.json(),
|
|
480
|
+
),
|
|
481
|
+
),
|
|
482
|
+
)
|
|
483
|
+
if _response.status_code == 502:
|
|
484
|
+
raise BadGatewayError(
|
|
485
|
+
headers=dict(_response.headers),
|
|
486
|
+
body=typing.cast(
|
|
487
|
+
HttpErrorResponse,
|
|
488
|
+
parse_obj_as(
|
|
489
|
+
type_=HttpErrorResponse, # type: ignore
|
|
490
|
+
object_=_response.json(),
|
|
491
|
+
),
|
|
492
|
+
),
|
|
493
|
+
)
|
|
494
|
+
if _response.status_code == 504:
|
|
495
|
+
raise GatewayTimeoutError(
|
|
496
|
+
headers=dict(_response.headers),
|
|
497
|
+
body=typing.cast(
|
|
498
|
+
HttpErrorResponse,
|
|
499
|
+
parse_obj_as(
|
|
500
|
+
type_=HttpErrorResponse, # type: ignore
|
|
501
|
+
object_=_response.json(),
|
|
502
|
+
),
|
|
503
|
+
),
|
|
504
|
+
)
|
|
505
|
+
_response_json = _response.json()
|
|
506
|
+
except JSONDecodeError:
|
|
507
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
508
|
+
except ValidationError as e:
|
|
509
|
+
raise ParsingError(
|
|
510
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
511
|
+
)
|
|
512
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
513
|
+
|
|
514
|
+
def get_effective_view(
|
|
515
|
+
self,
|
|
516
|
+
*,
|
|
517
|
+
country: typing.Optional[str] = None,
|
|
518
|
+
after: typing.Optional[str] = None,
|
|
519
|
+
limit: typing.Optional[int] = None,
|
|
520
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
521
|
+
) -> SyncPager[EffectiveCpo, EffectiveViewResponse]:
|
|
522
|
+
"""
|
|
523
|
+
Each reachable CPO once: your own base networks first, then published networks in your ranking order.
|
|
524
|
+
|
|
525
|
+
Parameters
|
|
526
|
+
----------
|
|
527
|
+
country : typing.Optional[str]
|
|
528
|
+
Only CPOs of this OCPI country code, e.g. NL.
|
|
529
|
+
|
|
530
|
+
after : typing.Optional[str]
|
|
531
|
+
Cursor: the previous page's ``pagination.end_cursor``. Omit it for the first page.
|
|
532
|
+
|
|
533
|
+
limit : typing.Optional[int]
|
|
534
|
+
Maximum rows per page (default 50, max 200).
|
|
535
|
+
|
|
536
|
+
request_options : typing.Optional[RequestOptions]
|
|
537
|
+
Request-specific configuration.
|
|
538
|
+
|
|
539
|
+
Returns
|
|
540
|
+
-------
|
|
541
|
+
SyncPager[EffectiveCpo, EffectiveViewResponse]
|
|
542
|
+
One page of reachable CPOs, with counts per source.
|
|
543
|
+
"""
|
|
544
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
545
|
+
"emsp/network-effective-view",
|
|
546
|
+
method="GET",
|
|
547
|
+
params={
|
|
548
|
+
"country": country,
|
|
549
|
+
"after": after,
|
|
550
|
+
"limit": limit,
|
|
551
|
+
},
|
|
552
|
+
request_options=request_options,
|
|
553
|
+
)
|
|
554
|
+
try:
|
|
555
|
+
if 200 <= _response.status_code < 300:
|
|
556
|
+
_parsed_response = typing.cast(
|
|
557
|
+
EffectiveViewResponse,
|
|
558
|
+
parse_obj_as(
|
|
559
|
+
type_=EffectiveViewResponse, # type: ignore
|
|
560
|
+
object_=_response.json(),
|
|
561
|
+
),
|
|
562
|
+
)
|
|
563
|
+
_items = _parsed_response.data
|
|
564
|
+
_has_next = False
|
|
565
|
+
_get_next = None
|
|
566
|
+
if _parsed_response.pagination is not None:
|
|
567
|
+
_parsed_next = _parsed_response.pagination.end_cursor
|
|
568
|
+
_has_next = _parsed_next is not None and _parsed_next != ""
|
|
569
|
+
_get_next = lambda: self.get_effective_view(
|
|
570
|
+
country=country,
|
|
571
|
+
after=_parsed_next,
|
|
572
|
+
limit=limit,
|
|
573
|
+
request_options=request_options,
|
|
574
|
+
)
|
|
575
|
+
return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
|
|
576
|
+
if _response.status_code == 401:
|
|
577
|
+
raise UnauthorizedError(
|
|
578
|
+
headers=dict(_response.headers),
|
|
579
|
+
body=typing.cast(
|
|
580
|
+
HttpErrorResponse,
|
|
581
|
+
parse_obj_as(
|
|
582
|
+
type_=HttpErrorResponse, # type: ignore
|
|
583
|
+
object_=_response.json(),
|
|
584
|
+
),
|
|
585
|
+
),
|
|
586
|
+
)
|
|
587
|
+
if _response.status_code == 422:
|
|
588
|
+
raise UnprocessableEntityError(
|
|
589
|
+
headers=dict(_response.headers),
|
|
590
|
+
body=typing.cast(
|
|
591
|
+
HttpValidationError,
|
|
592
|
+
parse_obj_as(
|
|
593
|
+
type_=HttpValidationError, # type: ignore
|
|
594
|
+
object_=_response.json(),
|
|
595
|
+
),
|
|
596
|
+
),
|
|
597
|
+
)
|
|
598
|
+
if _response.status_code == 429:
|
|
599
|
+
raise TooManyRequestsError(
|
|
600
|
+
headers=dict(_response.headers),
|
|
601
|
+
body=typing.cast(
|
|
602
|
+
HttpErrorResponse,
|
|
603
|
+
parse_obj_as(
|
|
604
|
+
type_=HttpErrorResponse, # type: ignore
|
|
605
|
+
object_=_response.json(),
|
|
606
|
+
),
|
|
607
|
+
),
|
|
608
|
+
)
|
|
609
|
+
if _response.status_code == 502:
|
|
610
|
+
raise BadGatewayError(
|
|
611
|
+
headers=dict(_response.headers),
|
|
612
|
+
body=typing.cast(
|
|
613
|
+
HttpErrorResponse,
|
|
614
|
+
parse_obj_as(
|
|
615
|
+
type_=HttpErrorResponse, # type: ignore
|
|
616
|
+
object_=_response.json(),
|
|
617
|
+
),
|
|
618
|
+
),
|
|
619
|
+
)
|
|
620
|
+
if _response.status_code == 504:
|
|
621
|
+
raise GatewayTimeoutError(
|
|
622
|
+
headers=dict(_response.headers),
|
|
623
|
+
body=typing.cast(
|
|
624
|
+
HttpErrorResponse,
|
|
625
|
+
parse_obj_as(
|
|
626
|
+
type_=HttpErrorResponse, # type: ignore
|
|
627
|
+
object_=_response.json(),
|
|
628
|
+
),
|
|
629
|
+
),
|
|
630
|
+
)
|
|
631
|
+
_response_json = _response.json()
|
|
632
|
+
except JSONDecodeError:
|
|
633
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
634
|
+
except ValidationError as e:
|
|
635
|
+
raise ParsingError(
|
|
636
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
637
|
+
)
|
|
638
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
639
|
+
|
|
640
|
+
def get(
|
|
641
|
+
self, network_id: int, *, request_options: typing.Optional[RequestOptions] = None
|
|
642
|
+
) -> HttpResponse[NetworkDetailResponse]:
|
|
643
|
+
"""
|
|
644
|
+
With how many locations and EVSEs it reaches today and how many token groups use it.
|
|
645
|
+
|
|
646
|
+
Parameters
|
|
647
|
+
----------
|
|
648
|
+
network_id : int
|
|
649
|
+
The network's ``network_id``.
|
|
650
|
+
|
|
651
|
+
request_options : typing.Optional[RequestOptions]
|
|
652
|
+
Request-specific configuration.
|
|
653
|
+
|
|
654
|
+
Returns
|
|
655
|
+
-------
|
|
656
|
+
HttpResponse[NetworkDetailResponse]
|
|
657
|
+
The network with how many locations, EVSEs and token groups it has.
|
|
658
|
+
"""
|
|
659
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
660
|
+
f"emsp/networks/{encode_path_param(network_id)}",
|
|
661
|
+
method="GET",
|
|
662
|
+
request_options=request_options,
|
|
663
|
+
)
|
|
664
|
+
try:
|
|
665
|
+
if 200 <= _response.status_code < 300:
|
|
666
|
+
_data = typing.cast(
|
|
667
|
+
NetworkDetailResponse,
|
|
668
|
+
parse_obj_as(
|
|
669
|
+
type_=NetworkDetailResponse, # type: ignore
|
|
670
|
+
object_=_response.json(),
|
|
671
|
+
),
|
|
672
|
+
)
|
|
673
|
+
return HttpResponse(response=_response, data=_data)
|
|
674
|
+
if _response.status_code == 401:
|
|
675
|
+
raise UnauthorizedError(
|
|
676
|
+
headers=dict(_response.headers),
|
|
677
|
+
body=typing.cast(
|
|
678
|
+
HttpErrorResponse,
|
|
679
|
+
parse_obj_as(
|
|
680
|
+
type_=HttpErrorResponse, # type: ignore
|
|
681
|
+
object_=_response.json(),
|
|
682
|
+
),
|
|
683
|
+
),
|
|
684
|
+
)
|
|
685
|
+
if _response.status_code == 404:
|
|
686
|
+
raise NotFoundError(
|
|
687
|
+
headers=dict(_response.headers),
|
|
688
|
+
body=typing.cast(
|
|
689
|
+
HttpErrorResponse,
|
|
690
|
+
parse_obj_as(
|
|
691
|
+
type_=HttpErrorResponse, # type: ignore
|
|
692
|
+
object_=_response.json(),
|
|
693
|
+
),
|
|
694
|
+
),
|
|
695
|
+
)
|
|
696
|
+
if _response.status_code == 422:
|
|
697
|
+
raise UnprocessableEntityError(
|
|
698
|
+
headers=dict(_response.headers),
|
|
699
|
+
body=typing.cast(
|
|
700
|
+
HttpValidationError,
|
|
701
|
+
parse_obj_as(
|
|
702
|
+
type_=HttpValidationError, # type: ignore
|
|
703
|
+
object_=_response.json(),
|
|
704
|
+
),
|
|
705
|
+
),
|
|
706
|
+
)
|
|
707
|
+
if _response.status_code == 429:
|
|
708
|
+
raise TooManyRequestsError(
|
|
709
|
+
headers=dict(_response.headers),
|
|
710
|
+
body=typing.cast(
|
|
711
|
+
HttpErrorResponse,
|
|
712
|
+
parse_obj_as(
|
|
713
|
+
type_=HttpErrorResponse, # type: ignore
|
|
714
|
+
object_=_response.json(),
|
|
715
|
+
),
|
|
716
|
+
),
|
|
717
|
+
)
|
|
718
|
+
if _response.status_code == 502:
|
|
719
|
+
raise BadGatewayError(
|
|
720
|
+
headers=dict(_response.headers),
|
|
721
|
+
body=typing.cast(
|
|
722
|
+
HttpErrorResponse,
|
|
723
|
+
parse_obj_as(
|
|
724
|
+
type_=HttpErrorResponse, # type: ignore
|
|
725
|
+
object_=_response.json(),
|
|
726
|
+
),
|
|
727
|
+
),
|
|
728
|
+
)
|
|
729
|
+
if _response.status_code == 504:
|
|
730
|
+
raise GatewayTimeoutError(
|
|
731
|
+
headers=dict(_response.headers),
|
|
732
|
+
body=typing.cast(
|
|
733
|
+
HttpErrorResponse,
|
|
734
|
+
parse_obj_as(
|
|
735
|
+
type_=HttpErrorResponse, # type: ignore
|
|
736
|
+
object_=_response.json(),
|
|
737
|
+
),
|
|
738
|
+
),
|
|
739
|
+
)
|
|
740
|
+
_response_json = _response.json()
|
|
741
|
+
except JSONDecodeError:
|
|
742
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
743
|
+
except ValidationError as e:
|
|
744
|
+
raise ParsingError(
|
|
745
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
746
|
+
)
|
|
747
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
748
|
+
|
|
749
|
+
def delete(
|
|
750
|
+
self,
|
|
751
|
+
network_id: int,
|
|
752
|
+
*,
|
|
753
|
+
force: typing.Optional[bool] = None,
|
|
754
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
755
|
+
) -> HttpResponse[None]:
|
|
756
|
+
"""
|
|
757
|
+
Base networks cannot be deleted. A sub-network assigned to token groups needs ``force=true``.
|
|
758
|
+
|
|
759
|
+
Parameters
|
|
760
|
+
----------
|
|
761
|
+
network_id : int
|
|
762
|
+
The network's ``network_id``.
|
|
763
|
+
|
|
764
|
+
force : typing.Optional[bool]
|
|
765
|
+
Also remove the network from the token groups it is assigned to.
|
|
766
|
+
|
|
767
|
+
request_options : typing.Optional[RequestOptions]
|
|
768
|
+
Request-specific configuration.
|
|
769
|
+
|
|
770
|
+
Returns
|
|
771
|
+
-------
|
|
772
|
+
HttpResponse[None]
|
|
773
|
+
"""
|
|
774
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
775
|
+
f"emsp/networks/{encode_path_param(network_id)}",
|
|
776
|
+
method="DELETE",
|
|
777
|
+
params={
|
|
778
|
+
"force": force,
|
|
779
|
+
},
|
|
780
|
+
request_options=request_options,
|
|
781
|
+
)
|
|
782
|
+
try:
|
|
783
|
+
if 200 <= _response.status_code < 300:
|
|
784
|
+
return HttpResponse(response=_response, data=None)
|
|
785
|
+
if _response.status_code == 401:
|
|
786
|
+
raise UnauthorizedError(
|
|
787
|
+
headers=dict(_response.headers),
|
|
788
|
+
body=typing.cast(
|
|
789
|
+
HttpErrorResponse,
|
|
790
|
+
parse_obj_as(
|
|
791
|
+
type_=HttpErrorResponse, # type: ignore
|
|
792
|
+
object_=_response.json(),
|
|
793
|
+
),
|
|
794
|
+
),
|
|
795
|
+
)
|
|
796
|
+
if _response.status_code == 404:
|
|
797
|
+
raise NotFoundError(
|
|
798
|
+
headers=dict(_response.headers),
|
|
799
|
+
body=typing.cast(
|
|
800
|
+
HttpErrorResponse,
|
|
801
|
+
parse_obj_as(
|
|
802
|
+
type_=HttpErrorResponse, # type: ignore
|
|
803
|
+
object_=_response.json(),
|
|
804
|
+
),
|
|
805
|
+
),
|
|
806
|
+
)
|
|
807
|
+
if _response.status_code == 409:
|
|
808
|
+
raise ConflictError(
|
|
809
|
+
headers=dict(_response.headers),
|
|
810
|
+
body=typing.cast(
|
|
811
|
+
HttpErrorResponse,
|
|
812
|
+
parse_obj_as(
|
|
813
|
+
type_=HttpErrorResponse, # type: ignore
|
|
814
|
+
object_=_response.json(),
|
|
815
|
+
),
|
|
816
|
+
),
|
|
817
|
+
)
|
|
818
|
+
if _response.status_code == 422:
|
|
819
|
+
raise UnprocessableEntityError(
|
|
820
|
+
headers=dict(_response.headers),
|
|
821
|
+
body=typing.cast(
|
|
822
|
+
HttpValidationError,
|
|
823
|
+
parse_obj_as(
|
|
824
|
+
type_=HttpValidationError, # type: ignore
|
|
825
|
+
object_=_response.json(),
|
|
826
|
+
),
|
|
827
|
+
),
|
|
828
|
+
)
|
|
829
|
+
if _response.status_code == 429:
|
|
830
|
+
raise TooManyRequestsError(
|
|
831
|
+
headers=dict(_response.headers),
|
|
832
|
+
body=typing.cast(
|
|
833
|
+
HttpErrorResponse,
|
|
834
|
+
parse_obj_as(
|
|
835
|
+
type_=HttpErrorResponse, # type: ignore
|
|
836
|
+
object_=_response.json(),
|
|
837
|
+
),
|
|
838
|
+
),
|
|
839
|
+
)
|
|
840
|
+
if _response.status_code == 502:
|
|
841
|
+
raise BadGatewayError(
|
|
842
|
+
headers=dict(_response.headers),
|
|
843
|
+
body=typing.cast(
|
|
844
|
+
HttpErrorResponse,
|
|
845
|
+
parse_obj_as(
|
|
846
|
+
type_=HttpErrorResponse, # type: ignore
|
|
847
|
+
object_=_response.json(),
|
|
848
|
+
),
|
|
849
|
+
),
|
|
850
|
+
)
|
|
851
|
+
if _response.status_code == 504:
|
|
852
|
+
raise GatewayTimeoutError(
|
|
853
|
+
headers=dict(_response.headers),
|
|
854
|
+
body=typing.cast(
|
|
855
|
+
HttpErrorResponse,
|
|
856
|
+
parse_obj_as(
|
|
857
|
+
type_=HttpErrorResponse, # type: ignore
|
|
858
|
+
object_=_response.json(),
|
|
859
|
+
),
|
|
860
|
+
),
|
|
861
|
+
)
|
|
862
|
+
_response_json = _response.json()
|
|
863
|
+
except JSONDecodeError:
|
|
864
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
865
|
+
except ValidationError as e:
|
|
866
|
+
raise ParsingError(
|
|
867
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
868
|
+
)
|
|
869
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
870
|
+
|
|
871
|
+
def update(
|
|
872
|
+
self,
|
|
873
|
+
network_id: int,
|
|
874
|
+
*,
|
|
875
|
+
name: typing.Optional[str] = OMIT,
|
|
876
|
+
description: typing.Optional[str] = OMIT,
|
|
877
|
+
cpo_ids: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
878
|
+
publicly_accessible: typing.Optional[bool] = OMIT,
|
|
879
|
+
auto_accept_cpo_additions: typing.Optional[bool] = OMIT,
|
|
880
|
+
countries: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
881
|
+
power_types: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
882
|
+
parking_types: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
883
|
+
facilities: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
884
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
885
|
+
) -> HttpResponse[NetworkResponse]:
|
|
886
|
+
"""
|
|
887
|
+
Only the fields sent change. A base network's name and filters cannot change; its CPOs and access settings can.
|
|
888
|
+
|
|
889
|
+
Parameters
|
|
890
|
+
----------
|
|
891
|
+
network_id : int
|
|
892
|
+
The network's ``network_id``.
|
|
893
|
+
|
|
894
|
+
name : typing.Optional[str]
|
|
895
|
+
|
|
896
|
+
description : typing.Optional[str]
|
|
897
|
+
|
|
898
|
+
cpo_ids : typing.Optional[typing.Sequence[str]]
|
|
899
|
+
|
|
900
|
+
publicly_accessible : typing.Optional[bool]
|
|
901
|
+
|
|
902
|
+
auto_accept_cpo_additions : typing.Optional[bool]
|
|
903
|
+
|
|
904
|
+
countries : typing.Optional[typing.Sequence[str]]
|
|
905
|
+
|
|
906
|
+
power_types : typing.Optional[typing.Sequence[str]]
|
|
907
|
+
|
|
908
|
+
parking_types : typing.Optional[typing.Sequence[str]]
|
|
909
|
+
|
|
910
|
+
facilities : typing.Optional[typing.Sequence[str]]
|
|
911
|
+
|
|
912
|
+
request_options : typing.Optional[RequestOptions]
|
|
913
|
+
Request-specific configuration.
|
|
914
|
+
|
|
915
|
+
Returns
|
|
916
|
+
-------
|
|
917
|
+
HttpResponse[NetworkResponse]
|
|
918
|
+
The network after the update.
|
|
919
|
+
"""
|
|
920
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
921
|
+
f"emsp/networks/{encode_path_param(network_id)}",
|
|
922
|
+
method="PATCH",
|
|
923
|
+
json={
|
|
924
|
+
"name": name,
|
|
925
|
+
"description": description,
|
|
926
|
+
"cpo_ids": cpo_ids,
|
|
927
|
+
"publicly_accessible": publicly_accessible,
|
|
928
|
+
"auto_accept_cpo_additions": auto_accept_cpo_additions,
|
|
929
|
+
"countries": countries,
|
|
930
|
+
"power_types": power_types,
|
|
931
|
+
"parking_types": parking_types,
|
|
932
|
+
"facilities": facilities,
|
|
933
|
+
},
|
|
934
|
+
headers={
|
|
935
|
+
"content-type": "application/json",
|
|
936
|
+
},
|
|
937
|
+
request_options=request_options,
|
|
938
|
+
omit=OMIT,
|
|
939
|
+
)
|
|
940
|
+
try:
|
|
941
|
+
if 200 <= _response.status_code < 300:
|
|
942
|
+
_data = typing.cast(
|
|
943
|
+
NetworkResponse,
|
|
944
|
+
parse_obj_as(
|
|
945
|
+
type_=NetworkResponse, # type: ignore
|
|
946
|
+
object_=_response.json(),
|
|
947
|
+
),
|
|
948
|
+
)
|
|
949
|
+
return HttpResponse(response=_response, data=_data)
|
|
950
|
+
if _response.status_code == 400:
|
|
951
|
+
raise BadRequestError(
|
|
952
|
+
headers=dict(_response.headers),
|
|
953
|
+
body=typing.cast(
|
|
954
|
+
HttpErrorResponse,
|
|
955
|
+
parse_obj_as(
|
|
956
|
+
type_=HttpErrorResponse, # type: ignore
|
|
957
|
+
object_=_response.json(),
|
|
958
|
+
),
|
|
959
|
+
),
|
|
960
|
+
)
|
|
961
|
+
if _response.status_code == 401:
|
|
962
|
+
raise UnauthorizedError(
|
|
963
|
+
headers=dict(_response.headers),
|
|
964
|
+
body=typing.cast(
|
|
965
|
+
HttpErrorResponse,
|
|
966
|
+
parse_obj_as(
|
|
967
|
+
type_=HttpErrorResponse, # type: ignore
|
|
968
|
+
object_=_response.json(),
|
|
969
|
+
),
|
|
970
|
+
),
|
|
971
|
+
)
|
|
972
|
+
if _response.status_code == 404:
|
|
973
|
+
raise NotFoundError(
|
|
974
|
+
headers=dict(_response.headers),
|
|
975
|
+
body=typing.cast(
|
|
976
|
+
HttpErrorResponse,
|
|
977
|
+
parse_obj_as(
|
|
978
|
+
type_=HttpErrorResponse, # type: ignore
|
|
979
|
+
object_=_response.json(),
|
|
980
|
+
),
|
|
981
|
+
),
|
|
982
|
+
)
|
|
983
|
+
if _response.status_code == 422:
|
|
984
|
+
raise UnprocessableEntityError(
|
|
985
|
+
headers=dict(_response.headers),
|
|
986
|
+
body=typing.cast(
|
|
987
|
+
HttpValidationError,
|
|
988
|
+
parse_obj_as(
|
|
989
|
+
type_=HttpValidationError, # type: ignore
|
|
990
|
+
object_=_response.json(),
|
|
991
|
+
),
|
|
992
|
+
),
|
|
993
|
+
)
|
|
994
|
+
if _response.status_code == 429:
|
|
995
|
+
raise TooManyRequestsError(
|
|
996
|
+
headers=dict(_response.headers),
|
|
997
|
+
body=typing.cast(
|
|
998
|
+
HttpErrorResponse,
|
|
999
|
+
parse_obj_as(
|
|
1000
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1001
|
+
object_=_response.json(),
|
|
1002
|
+
),
|
|
1003
|
+
),
|
|
1004
|
+
)
|
|
1005
|
+
if _response.status_code == 502:
|
|
1006
|
+
raise BadGatewayError(
|
|
1007
|
+
headers=dict(_response.headers),
|
|
1008
|
+
body=typing.cast(
|
|
1009
|
+
HttpErrorResponse,
|
|
1010
|
+
parse_obj_as(
|
|
1011
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1012
|
+
object_=_response.json(),
|
|
1013
|
+
),
|
|
1014
|
+
),
|
|
1015
|
+
)
|
|
1016
|
+
if _response.status_code == 504:
|
|
1017
|
+
raise GatewayTimeoutError(
|
|
1018
|
+
headers=dict(_response.headers),
|
|
1019
|
+
body=typing.cast(
|
|
1020
|
+
HttpErrorResponse,
|
|
1021
|
+
parse_obj_as(
|
|
1022
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1023
|
+
object_=_response.json(),
|
|
1024
|
+
),
|
|
1025
|
+
),
|
|
1026
|
+
)
|
|
1027
|
+
_response_json = _response.json()
|
|
1028
|
+
except JSONDecodeError:
|
|
1029
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1030
|
+
except ValidationError as e:
|
|
1031
|
+
raise ParsingError(
|
|
1032
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
1033
|
+
)
|
|
1034
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1035
|
+
|
|
1036
|
+
def list_consumers(
|
|
1037
|
+
self,
|
|
1038
|
+
network_id: int,
|
|
1039
|
+
*,
|
|
1040
|
+
after: typing.Optional[str] = None,
|
|
1041
|
+
limit: typing.Optional[int] = None,
|
|
1042
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1043
|
+
) -> SyncPager[NetworkConsumer, NetworkConsumerPage]:
|
|
1044
|
+
"""
|
|
1045
|
+
Workspaces that ranked this base network, with its position in their ranking.
|
|
1046
|
+
|
|
1047
|
+
Parameters
|
|
1048
|
+
----------
|
|
1049
|
+
network_id : int
|
|
1050
|
+
The network's ``network_id``.
|
|
1051
|
+
|
|
1052
|
+
after : typing.Optional[str]
|
|
1053
|
+
Cursor: the previous page's ``pagination.end_cursor``. Omit it for the first page.
|
|
1054
|
+
|
|
1055
|
+
limit : typing.Optional[int]
|
|
1056
|
+
Maximum rows per page (default 50, max 200).
|
|
1057
|
+
|
|
1058
|
+
request_options : typing.Optional[RequestOptions]
|
|
1059
|
+
Request-specific configuration.
|
|
1060
|
+
|
|
1061
|
+
Returns
|
|
1062
|
+
-------
|
|
1063
|
+
SyncPager[NetworkConsumer, NetworkConsumerPage]
|
|
1064
|
+
One page of workspaces, with your network's place in their ranking.
|
|
1065
|
+
"""
|
|
1066
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
1067
|
+
f"emsp/networks/{encode_path_param(network_id)}/consumers",
|
|
1068
|
+
method="GET",
|
|
1069
|
+
params={
|
|
1070
|
+
"after": after,
|
|
1071
|
+
"limit": limit,
|
|
1072
|
+
},
|
|
1073
|
+
request_options=request_options,
|
|
1074
|
+
)
|
|
1075
|
+
try:
|
|
1076
|
+
if 200 <= _response.status_code < 300:
|
|
1077
|
+
_parsed_response = typing.cast(
|
|
1078
|
+
NetworkConsumerPage,
|
|
1079
|
+
parse_obj_as(
|
|
1080
|
+
type_=NetworkConsumerPage, # type: ignore
|
|
1081
|
+
object_=_response.json(),
|
|
1082
|
+
),
|
|
1083
|
+
)
|
|
1084
|
+
_items = _parsed_response.data
|
|
1085
|
+
_has_next = False
|
|
1086
|
+
_get_next = None
|
|
1087
|
+
if _parsed_response.pagination is not None:
|
|
1088
|
+
_parsed_next = _parsed_response.pagination.end_cursor
|
|
1089
|
+
_has_next = _parsed_next is not None and _parsed_next != ""
|
|
1090
|
+
_get_next = lambda: self.list_consumers(
|
|
1091
|
+
network_id,
|
|
1092
|
+
after=_parsed_next,
|
|
1093
|
+
limit=limit,
|
|
1094
|
+
request_options=request_options,
|
|
1095
|
+
)
|
|
1096
|
+
return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
|
|
1097
|
+
if _response.status_code == 401:
|
|
1098
|
+
raise UnauthorizedError(
|
|
1099
|
+
headers=dict(_response.headers),
|
|
1100
|
+
body=typing.cast(
|
|
1101
|
+
HttpErrorResponse,
|
|
1102
|
+
parse_obj_as(
|
|
1103
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1104
|
+
object_=_response.json(),
|
|
1105
|
+
),
|
|
1106
|
+
),
|
|
1107
|
+
)
|
|
1108
|
+
if _response.status_code == 404:
|
|
1109
|
+
raise NotFoundError(
|
|
1110
|
+
headers=dict(_response.headers),
|
|
1111
|
+
body=typing.cast(
|
|
1112
|
+
HttpErrorResponse,
|
|
1113
|
+
parse_obj_as(
|
|
1114
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1115
|
+
object_=_response.json(),
|
|
1116
|
+
),
|
|
1117
|
+
),
|
|
1118
|
+
)
|
|
1119
|
+
if _response.status_code == 422:
|
|
1120
|
+
raise UnprocessableEntityError(
|
|
1121
|
+
headers=dict(_response.headers),
|
|
1122
|
+
body=typing.cast(
|
|
1123
|
+
HttpValidationError,
|
|
1124
|
+
parse_obj_as(
|
|
1125
|
+
type_=HttpValidationError, # type: ignore
|
|
1126
|
+
object_=_response.json(),
|
|
1127
|
+
),
|
|
1128
|
+
),
|
|
1129
|
+
)
|
|
1130
|
+
if _response.status_code == 429:
|
|
1131
|
+
raise TooManyRequestsError(
|
|
1132
|
+
headers=dict(_response.headers),
|
|
1133
|
+
body=typing.cast(
|
|
1134
|
+
HttpErrorResponse,
|
|
1135
|
+
parse_obj_as(
|
|
1136
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1137
|
+
object_=_response.json(),
|
|
1138
|
+
),
|
|
1139
|
+
),
|
|
1140
|
+
)
|
|
1141
|
+
if _response.status_code == 502:
|
|
1142
|
+
raise BadGatewayError(
|
|
1143
|
+
headers=dict(_response.headers),
|
|
1144
|
+
body=typing.cast(
|
|
1145
|
+
HttpErrorResponse,
|
|
1146
|
+
parse_obj_as(
|
|
1147
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1148
|
+
object_=_response.json(),
|
|
1149
|
+
),
|
|
1150
|
+
),
|
|
1151
|
+
)
|
|
1152
|
+
if _response.status_code == 504:
|
|
1153
|
+
raise GatewayTimeoutError(
|
|
1154
|
+
headers=dict(_response.headers),
|
|
1155
|
+
body=typing.cast(
|
|
1156
|
+
HttpErrorResponse,
|
|
1157
|
+
parse_obj_as(
|
|
1158
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1159
|
+
object_=_response.json(),
|
|
1160
|
+
),
|
|
1161
|
+
),
|
|
1162
|
+
)
|
|
1163
|
+
_response_json = _response.json()
|
|
1164
|
+
except JSONDecodeError:
|
|
1165
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1166
|
+
except ValidationError as e:
|
|
1167
|
+
raise ParsingError(
|
|
1168
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
1169
|
+
)
|
|
1170
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1171
|
+
|
|
1172
|
+
def list_locations(
|
|
1173
|
+
self,
|
|
1174
|
+
network_id: int,
|
|
1175
|
+
*,
|
|
1176
|
+
country: typing.Optional[str] = None,
|
|
1177
|
+
after: typing.Optional[str] = None,
|
|
1178
|
+
limit: typing.Optional[int] = None,
|
|
1179
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1180
|
+
) -> SyncPager[EmspGatewaySchemaNetworksLocationOut, EmspGatewaySchemaNetworksLocationPage]:
|
|
1181
|
+
"""
|
|
1182
|
+
Partner locations of its CPOs, with its filters and active access rules applied.
|
|
1183
|
+
|
|
1184
|
+
Parameters
|
|
1185
|
+
----------
|
|
1186
|
+
network_id : int
|
|
1187
|
+
The network's ``network_id``.
|
|
1188
|
+
|
|
1189
|
+
country : typing.Optional[str]
|
|
1190
|
+
Only locations in this country (ISO 3166 alpha-2 or alpha-3).
|
|
1191
|
+
|
|
1192
|
+
after : typing.Optional[str]
|
|
1193
|
+
Cursor: the previous page's ``pagination.end_cursor``. Omit it for the first page.
|
|
1194
|
+
|
|
1195
|
+
limit : typing.Optional[int]
|
|
1196
|
+
Maximum rows per page (default 50, max 200).
|
|
1197
|
+
|
|
1198
|
+
request_options : typing.Optional[RequestOptions]
|
|
1199
|
+
Request-specific configuration.
|
|
1200
|
+
|
|
1201
|
+
Returns
|
|
1202
|
+
-------
|
|
1203
|
+
SyncPager[EmspGatewaySchemaNetworksLocationOut, EmspGatewaySchemaNetworksLocationPage]
|
|
1204
|
+
One page of partner locations the network reaches.
|
|
1205
|
+
"""
|
|
1206
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
1207
|
+
f"emsp/networks/{encode_path_param(network_id)}/locations",
|
|
1208
|
+
method="GET",
|
|
1209
|
+
params={
|
|
1210
|
+
"country": country,
|
|
1211
|
+
"after": after,
|
|
1212
|
+
"limit": limit,
|
|
1213
|
+
},
|
|
1214
|
+
request_options=request_options,
|
|
1215
|
+
)
|
|
1216
|
+
try:
|
|
1217
|
+
if 200 <= _response.status_code < 300:
|
|
1218
|
+
_parsed_response = typing.cast(
|
|
1219
|
+
EmspGatewaySchemaNetworksLocationPage,
|
|
1220
|
+
parse_obj_as(
|
|
1221
|
+
type_=EmspGatewaySchemaNetworksLocationPage, # type: ignore
|
|
1222
|
+
object_=_response.json(),
|
|
1223
|
+
),
|
|
1224
|
+
)
|
|
1225
|
+
_items = _parsed_response.data
|
|
1226
|
+
_has_next = False
|
|
1227
|
+
_get_next = None
|
|
1228
|
+
if _parsed_response.pagination is not None:
|
|
1229
|
+
_parsed_next = _parsed_response.pagination.end_cursor
|
|
1230
|
+
_has_next = _parsed_next is not None and _parsed_next != ""
|
|
1231
|
+
_get_next = lambda: self.list_locations(
|
|
1232
|
+
network_id,
|
|
1233
|
+
country=country,
|
|
1234
|
+
after=_parsed_next,
|
|
1235
|
+
limit=limit,
|
|
1236
|
+
request_options=request_options,
|
|
1237
|
+
)
|
|
1238
|
+
return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
|
|
1239
|
+
if _response.status_code == 401:
|
|
1240
|
+
raise UnauthorizedError(
|
|
1241
|
+
headers=dict(_response.headers),
|
|
1242
|
+
body=typing.cast(
|
|
1243
|
+
HttpErrorResponse,
|
|
1244
|
+
parse_obj_as(
|
|
1245
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1246
|
+
object_=_response.json(),
|
|
1247
|
+
),
|
|
1248
|
+
),
|
|
1249
|
+
)
|
|
1250
|
+
if _response.status_code == 404:
|
|
1251
|
+
raise NotFoundError(
|
|
1252
|
+
headers=dict(_response.headers),
|
|
1253
|
+
body=typing.cast(
|
|
1254
|
+
HttpErrorResponse,
|
|
1255
|
+
parse_obj_as(
|
|
1256
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1257
|
+
object_=_response.json(),
|
|
1258
|
+
),
|
|
1259
|
+
),
|
|
1260
|
+
)
|
|
1261
|
+
if _response.status_code == 422:
|
|
1262
|
+
raise UnprocessableEntityError(
|
|
1263
|
+
headers=dict(_response.headers),
|
|
1264
|
+
body=typing.cast(
|
|
1265
|
+
HttpValidationError,
|
|
1266
|
+
parse_obj_as(
|
|
1267
|
+
type_=HttpValidationError, # type: ignore
|
|
1268
|
+
object_=_response.json(),
|
|
1269
|
+
),
|
|
1270
|
+
),
|
|
1271
|
+
)
|
|
1272
|
+
if _response.status_code == 429:
|
|
1273
|
+
raise TooManyRequestsError(
|
|
1274
|
+
headers=dict(_response.headers),
|
|
1275
|
+
body=typing.cast(
|
|
1276
|
+
HttpErrorResponse,
|
|
1277
|
+
parse_obj_as(
|
|
1278
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1279
|
+
object_=_response.json(),
|
|
1280
|
+
),
|
|
1281
|
+
),
|
|
1282
|
+
)
|
|
1283
|
+
if _response.status_code == 502:
|
|
1284
|
+
raise BadGatewayError(
|
|
1285
|
+
headers=dict(_response.headers),
|
|
1286
|
+
body=typing.cast(
|
|
1287
|
+
HttpErrorResponse,
|
|
1288
|
+
parse_obj_as(
|
|
1289
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1290
|
+
object_=_response.json(),
|
|
1291
|
+
),
|
|
1292
|
+
),
|
|
1293
|
+
)
|
|
1294
|
+
if _response.status_code == 504:
|
|
1295
|
+
raise GatewayTimeoutError(
|
|
1296
|
+
headers=dict(_response.headers),
|
|
1297
|
+
body=typing.cast(
|
|
1298
|
+
HttpErrorResponse,
|
|
1299
|
+
parse_obj_as(
|
|
1300
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1301
|
+
object_=_response.json(),
|
|
1302
|
+
),
|
|
1303
|
+
),
|
|
1304
|
+
)
|
|
1305
|
+
_response_json = _response.json()
|
|
1306
|
+
except JSONDecodeError:
|
|
1307
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1308
|
+
except ValidationError as e:
|
|
1309
|
+
raise ParsingError(
|
|
1310
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
1311
|
+
)
|
|
1312
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1313
|
+
|
|
1314
|
+
def set_publish_state(
|
|
1315
|
+
self,
|
|
1316
|
+
network_id: int,
|
|
1317
|
+
*,
|
|
1318
|
+
idempotency_key: str,
|
|
1319
|
+
published: bool,
|
|
1320
|
+
unpublish_drain_until: typing.Optional[dt.datetime] = OMIT,
|
|
1321
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1322
|
+
) -> HttpResponse[NetworkResponse]:
|
|
1323
|
+
"""
|
|
1324
|
+
Published base networks can be ranked by other workspaces. When withdrawing, ``unpublish_drain_until`` keeps their access until then.
|
|
1325
|
+
|
|
1326
|
+
Parameters
|
|
1327
|
+
----------
|
|
1328
|
+
network_id : int
|
|
1329
|
+
The network's ``network_id``.
|
|
1330
|
+
|
|
1331
|
+
idempotency_key : str
|
|
1332
|
+
A unique key you choose for this call, e.g. a UUID. Retrying with the same key returns the first result instead of acting twice.
|
|
1333
|
+
|
|
1334
|
+
published : bool
|
|
1335
|
+
|
|
1336
|
+
unpublish_drain_until : typing.Optional[dt.datetime]
|
|
1337
|
+
|
|
1338
|
+
request_options : typing.Optional[RequestOptions]
|
|
1339
|
+
Request-specific configuration.
|
|
1340
|
+
|
|
1341
|
+
Returns
|
|
1342
|
+
-------
|
|
1343
|
+
HttpResponse[NetworkResponse]
|
|
1344
|
+
The network after the change.
|
|
1345
|
+
"""
|
|
1346
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
1347
|
+
f"emsp/networks/{encode_path_param(network_id)}/publish-state",
|
|
1348
|
+
method="PATCH",
|
|
1349
|
+
json={
|
|
1350
|
+
"published": published,
|
|
1351
|
+
"unpublish_drain_until": unpublish_drain_until,
|
|
1352
|
+
},
|
|
1353
|
+
headers={
|
|
1354
|
+
"content-type": "application/json",
|
|
1355
|
+
"Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None,
|
|
1356
|
+
},
|
|
1357
|
+
request_options=request_options,
|
|
1358
|
+
omit=OMIT,
|
|
1359
|
+
)
|
|
1360
|
+
try:
|
|
1361
|
+
if 200 <= _response.status_code < 300:
|
|
1362
|
+
_data = typing.cast(
|
|
1363
|
+
NetworkResponse,
|
|
1364
|
+
parse_obj_as(
|
|
1365
|
+
type_=NetworkResponse, # type: ignore
|
|
1366
|
+
object_=_response.json(),
|
|
1367
|
+
),
|
|
1368
|
+
)
|
|
1369
|
+
return HttpResponse(response=_response, data=_data)
|
|
1370
|
+
if _response.status_code == 400:
|
|
1371
|
+
raise BadRequestError(
|
|
1372
|
+
headers=dict(_response.headers),
|
|
1373
|
+
body=typing.cast(
|
|
1374
|
+
HttpErrorResponse,
|
|
1375
|
+
parse_obj_as(
|
|
1376
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1377
|
+
object_=_response.json(),
|
|
1378
|
+
),
|
|
1379
|
+
),
|
|
1380
|
+
)
|
|
1381
|
+
if _response.status_code == 401:
|
|
1382
|
+
raise UnauthorizedError(
|
|
1383
|
+
headers=dict(_response.headers),
|
|
1384
|
+
body=typing.cast(
|
|
1385
|
+
HttpErrorResponse,
|
|
1386
|
+
parse_obj_as(
|
|
1387
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1388
|
+
object_=_response.json(),
|
|
1389
|
+
),
|
|
1390
|
+
),
|
|
1391
|
+
)
|
|
1392
|
+
if _response.status_code == 404:
|
|
1393
|
+
raise NotFoundError(
|
|
1394
|
+
headers=dict(_response.headers),
|
|
1395
|
+
body=typing.cast(
|
|
1396
|
+
HttpErrorResponse,
|
|
1397
|
+
parse_obj_as(
|
|
1398
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1399
|
+
object_=_response.json(),
|
|
1400
|
+
),
|
|
1401
|
+
),
|
|
1402
|
+
)
|
|
1403
|
+
if _response.status_code == 409:
|
|
1404
|
+
raise ConflictError(
|
|
1405
|
+
headers=dict(_response.headers),
|
|
1406
|
+
body=typing.cast(
|
|
1407
|
+
HttpErrorResponse,
|
|
1408
|
+
parse_obj_as(
|
|
1409
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1410
|
+
object_=_response.json(),
|
|
1411
|
+
),
|
|
1412
|
+
),
|
|
1413
|
+
)
|
|
1414
|
+
if _response.status_code == 422:
|
|
1415
|
+
raise UnprocessableEntityError(
|
|
1416
|
+
headers=dict(_response.headers),
|
|
1417
|
+
body=typing.cast(
|
|
1418
|
+
HttpValidationError,
|
|
1419
|
+
parse_obj_as(
|
|
1420
|
+
type_=HttpValidationError, # type: ignore
|
|
1421
|
+
object_=_response.json(),
|
|
1422
|
+
),
|
|
1423
|
+
),
|
|
1424
|
+
)
|
|
1425
|
+
if _response.status_code == 429:
|
|
1426
|
+
raise TooManyRequestsError(
|
|
1427
|
+
headers=dict(_response.headers),
|
|
1428
|
+
body=typing.cast(
|
|
1429
|
+
HttpErrorResponse,
|
|
1430
|
+
parse_obj_as(
|
|
1431
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1432
|
+
object_=_response.json(),
|
|
1433
|
+
),
|
|
1434
|
+
),
|
|
1435
|
+
)
|
|
1436
|
+
if _response.status_code == 502:
|
|
1437
|
+
raise BadGatewayError(
|
|
1438
|
+
headers=dict(_response.headers),
|
|
1439
|
+
body=typing.cast(
|
|
1440
|
+
HttpErrorResponse,
|
|
1441
|
+
parse_obj_as(
|
|
1442
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1443
|
+
object_=_response.json(),
|
|
1444
|
+
),
|
|
1445
|
+
),
|
|
1446
|
+
)
|
|
1447
|
+
if _response.status_code == 504:
|
|
1448
|
+
raise GatewayTimeoutError(
|
|
1449
|
+
headers=dict(_response.headers),
|
|
1450
|
+
body=typing.cast(
|
|
1451
|
+
HttpErrorResponse,
|
|
1452
|
+
parse_obj_as(
|
|
1453
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1454
|
+
object_=_response.json(),
|
|
1455
|
+
),
|
|
1456
|
+
),
|
|
1457
|
+
)
|
|
1458
|
+
_response_json = _response.json()
|
|
1459
|
+
except JSONDecodeError:
|
|
1460
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1461
|
+
except ValidationError as e:
|
|
1462
|
+
raise ParsingError(
|
|
1463
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
1464
|
+
)
|
|
1465
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1466
|
+
|
|
1467
|
+
def list_rules(
|
|
1468
|
+
self,
|
|
1469
|
+
network_id: int,
|
|
1470
|
+
*,
|
|
1471
|
+
validity: typing.Optional[ListRulesNetworksRequestValidity] = None,
|
|
1472
|
+
after: typing.Optional[str] = None,
|
|
1473
|
+
limit: typing.Optional[int] = None,
|
|
1474
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1475
|
+
) -> SyncPager[NetworkRuleResponse, NetworkRulePage]:
|
|
1476
|
+
"""
|
|
1477
|
+
With no rules a network shows every location of its CPOs.
|
|
1478
|
+
|
|
1479
|
+
Parameters
|
|
1480
|
+
----------
|
|
1481
|
+
network_id : int
|
|
1482
|
+
The network's ``network_id``.
|
|
1483
|
+
|
|
1484
|
+
validity : typing.Optional[ListRulesNetworksRequestValidity]
|
|
1485
|
+
Only rules in effect now (ACTIVE), later, or ended; default ALL.
|
|
1486
|
+
|
|
1487
|
+
after : typing.Optional[str]
|
|
1488
|
+
Cursor: the previous page's ``pagination.end_cursor``. Omit it for the first page.
|
|
1489
|
+
|
|
1490
|
+
limit : typing.Optional[int]
|
|
1491
|
+
Maximum rows per page (default 50, max 200).
|
|
1492
|
+
|
|
1493
|
+
request_options : typing.Optional[RequestOptions]
|
|
1494
|
+
Request-specific configuration.
|
|
1495
|
+
|
|
1496
|
+
Returns
|
|
1497
|
+
-------
|
|
1498
|
+
SyncPager[NetworkRuleResponse, NetworkRulePage]
|
|
1499
|
+
One page of access rules.
|
|
1500
|
+
"""
|
|
1501
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
1502
|
+
f"emsp/networks/{encode_path_param(network_id)}/rules",
|
|
1503
|
+
method="GET",
|
|
1504
|
+
params={
|
|
1505
|
+
"validity": validity,
|
|
1506
|
+
"after": after,
|
|
1507
|
+
"limit": limit,
|
|
1508
|
+
},
|
|
1509
|
+
request_options=request_options,
|
|
1510
|
+
)
|
|
1511
|
+
try:
|
|
1512
|
+
if 200 <= _response.status_code < 300:
|
|
1513
|
+
_parsed_response = typing.cast(
|
|
1514
|
+
NetworkRulePage,
|
|
1515
|
+
parse_obj_as(
|
|
1516
|
+
type_=NetworkRulePage, # type: ignore
|
|
1517
|
+
object_=_response.json(),
|
|
1518
|
+
),
|
|
1519
|
+
)
|
|
1520
|
+
_items = _parsed_response.data
|
|
1521
|
+
_has_next = False
|
|
1522
|
+
_get_next = None
|
|
1523
|
+
if _parsed_response.pagination is not None:
|
|
1524
|
+
_parsed_next = _parsed_response.pagination.end_cursor
|
|
1525
|
+
_has_next = _parsed_next is not None and _parsed_next != ""
|
|
1526
|
+
_get_next = lambda: self.list_rules(
|
|
1527
|
+
network_id,
|
|
1528
|
+
validity=validity,
|
|
1529
|
+
after=_parsed_next,
|
|
1530
|
+
limit=limit,
|
|
1531
|
+
request_options=request_options,
|
|
1532
|
+
)
|
|
1533
|
+
return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
|
|
1534
|
+
if _response.status_code == 401:
|
|
1535
|
+
raise UnauthorizedError(
|
|
1536
|
+
headers=dict(_response.headers),
|
|
1537
|
+
body=typing.cast(
|
|
1538
|
+
HttpErrorResponse,
|
|
1539
|
+
parse_obj_as(
|
|
1540
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1541
|
+
object_=_response.json(),
|
|
1542
|
+
),
|
|
1543
|
+
),
|
|
1544
|
+
)
|
|
1545
|
+
if _response.status_code == 404:
|
|
1546
|
+
raise NotFoundError(
|
|
1547
|
+
headers=dict(_response.headers),
|
|
1548
|
+
body=typing.cast(
|
|
1549
|
+
HttpErrorResponse,
|
|
1550
|
+
parse_obj_as(
|
|
1551
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1552
|
+
object_=_response.json(),
|
|
1553
|
+
),
|
|
1554
|
+
),
|
|
1555
|
+
)
|
|
1556
|
+
if _response.status_code == 422:
|
|
1557
|
+
raise UnprocessableEntityError(
|
|
1558
|
+
headers=dict(_response.headers),
|
|
1559
|
+
body=typing.cast(
|
|
1560
|
+
HttpValidationError,
|
|
1561
|
+
parse_obj_as(
|
|
1562
|
+
type_=HttpValidationError, # type: ignore
|
|
1563
|
+
object_=_response.json(),
|
|
1564
|
+
),
|
|
1565
|
+
),
|
|
1566
|
+
)
|
|
1567
|
+
if _response.status_code == 429:
|
|
1568
|
+
raise TooManyRequestsError(
|
|
1569
|
+
headers=dict(_response.headers),
|
|
1570
|
+
body=typing.cast(
|
|
1571
|
+
HttpErrorResponse,
|
|
1572
|
+
parse_obj_as(
|
|
1573
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1574
|
+
object_=_response.json(),
|
|
1575
|
+
),
|
|
1576
|
+
),
|
|
1577
|
+
)
|
|
1578
|
+
if _response.status_code == 502:
|
|
1579
|
+
raise BadGatewayError(
|
|
1580
|
+
headers=dict(_response.headers),
|
|
1581
|
+
body=typing.cast(
|
|
1582
|
+
HttpErrorResponse,
|
|
1583
|
+
parse_obj_as(
|
|
1584
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1585
|
+
object_=_response.json(),
|
|
1586
|
+
),
|
|
1587
|
+
),
|
|
1588
|
+
)
|
|
1589
|
+
if _response.status_code == 504:
|
|
1590
|
+
raise GatewayTimeoutError(
|
|
1591
|
+
headers=dict(_response.headers),
|
|
1592
|
+
body=typing.cast(
|
|
1593
|
+
HttpErrorResponse,
|
|
1594
|
+
parse_obj_as(
|
|
1595
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1596
|
+
object_=_response.json(),
|
|
1597
|
+
),
|
|
1598
|
+
),
|
|
1599
|
+
)
|
|
1600
|
+
_response_json = _response.json()
|
|
1601
|
+
except JSONDecodeError:
|
|
1602
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1603
|
+
except ValidationError as e:
|
|
1604
|
+
raise ParsingError(
|
|
1605
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
1606
|
+
)
|
|
1607
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1608
|
+
|
|
1609
|
+
def create_rule(
|
|
1610
|
+
self,
|
|
1611
|
+
network_id: int,
|
|
1612
|
+
*,
|
|
1613
|
+
idempotency_key: str,
|
|
1614
|
+
rule_type: NetworkRuleCreateRequestRuleType,
|
|
1615
|
+
location_ids: typing.Sequence[str],
|
|
1616
|
+
priority: typing.Optional[int] = OMIT,
|
|
1617
|
+
effective_from: typing.Optional[dt.datetime] = OMIT,
|
|
1618
|
+
effective_until: typing.Optional[dt.datetime] = OMIT,
|
|
1619
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1620
|
+
) -> HttpResponse[NetworkRuleResponse]:
|
|
1621
|
+
"""
|
|
1622
|
+
INCLUDE shows only the listed locations, EXCLUDE hides them, optionally within an ``effective_from``/``effective_until`` window.
|
|
1623
|
+
|
|
1624
|
+
Parameters
|
|
1625
|
+
----------
|
|
1626
|
+
network_id : int
|
|
1627
|
+
The network's ``network_id``.
|
|
1628
|
+
|
|
1629
|
+
idempotency_key : str
|
|
1630
|
+
A unique key you choose for this call, e.g. a UUID. Retrying with the same key returns the first result instead of acting twice.
|
|
1631
|
+
|
|
1632
|
+
rule_type : NetworkRuleCreateRequestRuleType
|
|
1633
|
+
|
|
1634
|
+
location_ids : typing.Sequence[str]
|
|
1635
|
+
|
|
1636
|
+
priority : typing.Optional[int]
|
|
1637
|
+
|
|
1638
|
+
effective_from : typing.Optional[dt.datetime]
|
|
1639
|
+
|
|
1640
|
+
effective_until : typing.Optional[dt.datetime]
|
|
1641
|
+
|
|
1642
|
+
request_options : typing.Optional[RequestOptions]
|
|
1643
|
+
Request-specific configuration.
|
|
1644
|
+
|
|
1645
|
+
Returns
|
|
1646
|
+
-------
|
|
1647
|
+
HttpResponse[NetworkRuleResponse]
|
|
1648
|
+
The created rule.
|
|
1649
|
+
"""
|
|
1650
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
1651
|
+
f"emsp/networks/{encode_path_param(network_id)}/rules",
|
|
1652
|
+
method="POST",
|
|
1653
|
+
json={
|
|
1654
|
+
"rule_type": rule_type,
|
|
1655
|
+
"location_ids": location_ids,
|
|
1656
|
+
"priority": priority,
|
|
1657
|
+
"effective_from": effective_from,
|
|
1658
|
+
"effective_until": effective_until,
|
|
1659
|
+
},
|
|
1660
|
+
headers={
|
|
1661
|
+
"content-type": "application/json",
|
|
1662
|
+
"Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None,
|
|
1663
|
+
},
|
|
1664
|
+
request_options=request_options,
|
|
1665
|
+
omit=OMIT,
|
|
1666
|
+
)
|
|
1667
|
+
try:
|
|
1668
|
+
if 200 <= _response.status_code < 300:
|
|
1669
|
+
_data = typing.cast(
|
|
1670
|
+
NetworkRuleResponse,
|
|
1671
|
+
parse_obj_as(
|
|
1672
|
+
type_=NetworkRuleResponse, # type: ignore
|
|
1673
|
+
object_=_response.json(),
|
|
1674
|
+
),
|
|
1675
|
+
)
|
|
1676
|
+
return HttpResponse(response=_response, data=_data)
|
|
1677
|
+
if _response.status_code == 400:
|
|
1678
|
+
raise BadRequestError(
|
|
1679
|
+
headers=dict(_response.headers),
|
|
1680
|
+
body=typing.cast(
|
|
1681
|
+
HttpErrorResponse,
|
|
1682
|
+
parse_obj_as(
|
|
1683
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1684
|
+
object_=_response.json(),
|
|
1685
|
+
),
|
|
1686
|
+
),
|
|
1687
|
+
)
|
|
1688
|
+
if _response.status_code == 401:
|
|
1689
|
+
raise UnauthorizedError(
|
|
1690
|
+
headers=dict(_response.headers),
|
|
1691
|
+
body=typing.cast(
|
|
1692
|
+
HttpErrorResponse,
|
|
1693
|
+
parse_obj_as(
|
|
1694
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1695
|
+
object_=_response.json(),
|
|
1696
|
+
),
|
|
1697
|
+
),
|
|
1698
|
+
)
|
|
1699
|
+
if _response.status_code == 404:
|
|
1700
|
+
raise NotFoundError(
|
|
1701
|
+
headers=dict(_response.headers),
|
|
1702
|
+
body=typing.cast(
|
|
1703
|
+
HttpErrorResponse,
|
|
1704
|
+
parse_obj_as(
|
|
1705
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1706
|
+
object_=_response.json(),
|
|
1707
|
+
),
|
|
1708
|
+
),
|
|
1709
|
+
)
|
|
1710
|
+
if _response.status_code == 409:
|
|
1711
|
+
raise ConflictError(
|
|
1712
|
+
headers=dict(_response.headers),
|
|
1713
|
+
body=typing.cast(
|
|
1714
|
+
HttpErrorResponse,
|
|
1715
|
+
parse_obj_as(
|
|
1716
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1717
|
+
object_=_response.json(),
|
|
1718
|
+
),
|
|
1719
|
+
),
|
|
1720
|
+
)
|
|
1721
|
+
if _response.status_code == 422:
|
|
1722
|
+
raise UnprocessableEntityError(
|
|
1723
|
+
headers=dict(_response.headers),
|
|
1724
|
+
body=typing.cast(
|
|
1725
|
+
HttpValidationError,
|
|
1726
|
+
parse_obj_as(
|
|
1727
|
+
type_=HttpValidationError, # type: ignore
|
|
1728
|
+
object_=_response.json(),
|
|
1729
|
+
),
|
|
1730
|
+
),
|
|
1731
|
+
)
|
|
1732
|
+
if _response.status_code == 429:
|
|
1733
|
+
raise TooManyRequestsError(
|
|
1734
|
+
headers=dict(_response.headers),
|
|
1735
|
+
body=typing.cast(
|
|
1736
|
+
HttpErrorResponse,
|
|
1737
|
+
parse_obj_as(
|
|
1738
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1739
|
+
object_=_response.json(),
|
|
1740
|
+
),
|
|
1741
|
+
),
|
|
1742
|
+
)
|
|
1743
|
+
if _response.status_code == 502:
|
|
1744
|
+
raise BadGatewayError(
|
|
1745
|
+
headers=dict(_response.headers),
|
|
1746
|
+
body=typing.cast(
|
|
1747
|
+
HttpErrorResponse,
|
|
1748
|
+
parse_obj_as(
|
|
1749
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1750
|
+
object_=_response.json(),
|
|
1751
|
+
),
|
|
1752
|
+
),
|
|
1753
|
+
)
|
|
1754
|
+
if _response.status_code == 504:
|
|
1755
|
+
raise GatewayTimeoutError(
|
|
1756
|
+
headers=dict(_response.headers),
|
|
1757
|
+
body=typing.cast(
|
|
1758
|
+
HttpErrorResponse,
|
|
1759
|
+
parse_obj_as(
|
|
1760
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1761
|
+
object_=_response.json(),
|
|
1762
|
+
),
|
|
1763
|
+
),
|
|
1764
|
+
)
|
|
1765
|
+
_response_json = _response.json()
|
|
1766
|
+
except JSONDecodeError:
|
|
1767
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1768
|
+
except ValidationError as e:
|
|
1769
|
+
raise ParsingError(
|
|
1770
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
1771
|
+
)
|
|
1772
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1773
|
+
|
|
1774
|
+
def delete_rule(
|
|
1775
|
+
self, network_id: int, rule_id: int, *, request_options: typing.Optional[RequestOptions] = None
|
|
1776
|
+
) -> HttpResponse[None]:
|
|
1777
|
+
"""
|
|
1778
|
+
Removes one access rule; the network's other rules stay in force.
|
|
1779
|
+
|
|
1780
|
+
Parameters
|
|
1781
|
+
----------
|
|
1782
|
+
network_id : int
|
|
1783
|
+
The network's ``network_id``.
|
|
1784
|
+
|
|
1785
|
+
rule_id : int
|
|
1786
|
+
The access rule's ``rule_id``.
|
|
1787
|
+
|
|
1788
|
+
request_options : typing.Optional[RequestOptions]
|
|
1789
|
+
Request-specific configuration.
|
|
1790
|
+
|
|
1791
|
+
Returns
|
|
1792
|
+
-------
|
|
1793
|
+
HttpResponse[None]
|
|
1794
|
+
"""
|
|
1795
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
1796
|
+
f"emsp/networks/{encode_path_param(network_id)}/rules/{encode_path_param(rule_id)}",
|
|
1797
|
+
method="DELETE",
|
|
1798
|
+
request_options=request_options,
|
|
1799
|
+
)
|
|
1800
|
+
try:
|
|
1801
|
+
if 200 <= _response.status_code < 300:
|
|
1802
|
+
return HttpResponse(response=_response, data=None)
|
|
1803
|
+
if _response.status_code == 401:
|
|
1804
|
+
raise UnauthorizedError(
|
|
1805
|
+
headers=dict(_response.headers),
|
|
1806
|
+
body=typing.cast(
|
|
1807
|
+
HttpErrorResponse,
|
|
1808
|
+
parse_obj_as(
|
|
1809
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1810
|
+
object_=_response.json(),
|
|
1811
|
+
),
|
|
1812
|
+
),
|
|
1813
|
+
)
|
|
1814
|
+
if _response.status_code == 404:
|
|
1815
|
+
raise NotFoundError(
|
|
1816
|
+
headers=dict(_response.headers),
|
|
1817
|
+
body=typing.cast(
|
|
1818
|
+
HttpErrorResponse,
|
|
1819
|
+
parse_obj_as(
|
|
1820
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1821
|
+
object_=_response.json(),
|
|
1822
|
+
),
|
|
1823
|
+
),
|
|
1824
|
+
)
|
|
1825
|
+
if _response.status_code == 422:
|
|
1826
|
+
raise UnprocessableEntityError(
|
|
1827
|
+
headers=dict(_response.headers),
|
|
1828
|
+
body=typing.cast(
|
|
1829
|
+
HttpValidationError,
|
|
1830
|
+
parse_obj_as(
|
|
1831
|
+
type_=HttpValidationError, # type: ignore
|
|
1832
|
+
object_=_response.json(),
|
|
1833
|
+
),
|
|
1834
|
+
),
|
|
1835
|
+
)
|
|
1836
|
+
if _response.status_code == 429:
|
|
1837
|
+
raise TooManyRequestsError(
|
|
1838
|
+
headers=dict(_response.headers),
|
|
1839
|
+
body=typing.cast(
|
|
1840
|
+
HttpErrorResponse,
|
|
1841
|
+
parse_obj_as(
|
|
1842
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1843
|
+
object_=_response.json(),
|
|
1844
|
+
),
|
|
1845
|
+
),
|
|
1846
|
+
)
|
|
1847
|
+
if _response.status_code == 502:
|
|
1848
|
+
raise BadGatewayError(
|
|
1849
|
+
headers=dict(_response.headers),
|
|
1850
|
+
body=typing.cast(
|
|
1851
|
+
HttpErrorResponse,
|
|
1852
|
+
parse_obj_as(
|
|
1853
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1854
|
+
object_=_response.json(),
|
|
1855
|
+
),
|
|
1856
|
+
),
|
|
1857
|
+
)
|
|
1858
|
+
if _response.status_code == 504:
|
|
1859
|
+
raise GatewayTimeoutError(
|
|
1860
|
+
headers=dict(_response.headers),
|
|
1861
|
+
body=typing.cast(
|
|
1862
|
+
HttpErrorResponse,
|
|
1863
|
+
parse_obj_as(
|
|
1864
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1865
|
+
object_=_response.json(),
|
|
1866
|
+
),
|
|
1867
|
+
),
|
|
1868
|
+
)
|
|
1869
|
+
_response_json = _response.json()
|
|
1870
|
+
except JSONDecodeError:
|
|
1871
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1872
|
+
except ValidationError as e:
|
|
1873
|
+
raise ParsingError(
|
|
1874
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
1875
|
+
)
|
|
1876
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1877
|
+
|
|
1878
|
+
|
|
1879
|
+
class AsyncRawNetworksClient:
|
|
1880
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
1881
|
+
self._client_wrapper = client_wrapper
|
|
1882
|
+
|
|
1883
|
+
async def list(
|
|
1884
|
+
self,
|
|
1885
|
+
*,
|
|
1886
|
+
network_type: typing.Optional[ListNetworksRequestNetworkType] = None,
|
|
1887
|
+
parent_network_id: typing.Optional[int] = None,
|
|
1888
|
+
published: typing.Optional[bool] = None,
|
|
1889
|
+
after: typing.Optional[str] = None,
|
|
1890
|
+
limit: typing.Optional[int] = None,
|
|
1891
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1892
|
+
) -> AsyncPager[NetworkResponse, NetworkPage]:
|
|
1893
|
+
"""
|
|
1894
|
+
Your base networks and the sub-networks that slice them.
|
|
1895
|
+
|
|
1896
|
+
Parameters
|
|
1897
|
+
----------
|
|
1898
|
+
network_type : typing.Optional[ListNetworksRequestNetworkType]
|
|
1899
|
+
Only BASE or only TENANT (sub-)networks.
|
|
1900
|
+
|
|
1901
|
+
parent_network_id : typing.Optional[int]
|
|
1902
|
+
Only sub-networks of this base network.
|
|
1903
|
+
|
|
1904
|
+
published : typing.Optional[bool]
|
|
1905
|
+
Only published (true) or unpublished (false) networks.
|
|
1906
|
+
|
|
1907
|
+
after : typing.Optional[str]
|
|
1908
|
+
Cursor: the previous page's ``pagination.end_cursor``. Omit it for the first page.
|
|
1909
|
+
|
|
1910
|
+
limit : typing.Optional[int]
|
|
1911
|
+
Maximum rows per page (default 50, max 200).
|
|
1912
|
+
|
|
1913
|
+
request_options : typing.Optional[RequestOptions]
|
|
1914
|
+
Request-specific configuration.
|
|
1915
|
+
|
|
1916
|
+
Returns
|
|
1917
|
+
-------
|
|
1918
|
+
AsyncPager[NetworkResponse, NetworkPage]
|
|
1919
|
+
One page of networks; ``pagination.has_next`` is false on the last page.
|
|
1920
|
+
"""
|
|
1921
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1922
|
+
"emsp/networks",
|
|
1923
|
+
method="GET",
|
|
1924
|
+
params={
|
|
1925
|
+
"network_type": network_type,
|
|
1926
|
+
"parent_network_id": parent_network_id,
|
|
1927
|
+
"published": published,
|
|
1928
|
+
"after": after,
|
|
1929
|
+
"limit": limit,
|
|
1930
|
+
},
|
|
1931
|
+
request_options=request_options,
|
|
1932
|
+
)
|
|
1933
|
+
try:
|
|
1934
|
+
if 200 <= _response.status_code < 300:
|
|
1935
|
+
_parsed_response = typing.cast(
|
|
1936
|
+
NetworkPage,
|
|
1937
|
+
parse_obj_as(
|
|
1938
|
+
type_=NetworkPage, # type: ignore
|
|
1939
|
+
object_=_response.json(),
|
|
1940
|
+
),
|
|
1941
|
+
)
|
|
1942
|
+
_items = _parsed_response.data
|
|
1943
|
+
_has_next = False
|
|
1944
|
+
_get_next = None
|
|
1945
|
+
if _parsed_response.pagination is not None:
|
|
1946
|
+
_parsed_next = _parsed_response.pagination.end_cursor
|
|
1947
|
+
_has_next = _parsed_next is not None and _parsed_next != ""
|
|
1948
|
+
|
|
1949
|
+
async def _get_next():
|
|
1950
|
+
return await self.list(
|
|
1951
|
+
network_type=network_type,
|
|
1952
|
+
parent_network_id=parent_network_id,
|
|
1953
|
+
published=published,
|
|
1954
|
+
after=_parsed_next,
|
|
1955
|
+
limit=limit,
|
|
1956
|
+
request_options=request_options,
|
|
1957
|
+
)
|
|
1958
|
+
|
|
1959
|
+
return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
|
|
1960
|
+
if _response.status_code == 401:
|
|
1961
|
+
raise UnauthorizedError(
|
|
1962
|
+
headers=dict(_response.headers),
|
|
1963
|
+
body=typing.cast(
|
|
1964
|
+
HttpErrorResponse,
|
|
1965
|
+
parse_obj_as(
|
|
1966
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1967
|
+
object_=_response.json(),
|
|
1968
|
+
),
|
|
1969
|
+
),
|
|
1970
|
+
)
|
|
1971
|
+
if _response.status_code == 422:
|
|
1972
|
+
raise UnprocessableEntityError(
|
|
1973
|
+
headers=dict(_response.headers),
|
|
1974
|
+
body=typing.cast(
|
|
1975
|
+
HttpValidationError,
|
|
1976
|
+
parse_obj_as(
|
|
1977
|
+
type_=HttpValidationError, # type: ignore
|
|
1978
|
+
object_=_response.json(),
|
|
1979
|
+
),
|
|
1980
|
+
),
|
|
1981
|
+
)
|
|
1982
|
+
if _response.status_code == 429:
|
|
1983
|
+
raise TooManyRequestsError(
|
|
1984
|
+
headers=dict(_response.headers),
|
|
1985
|
+
body=typing.cast(
|
|
1986
|
+
HttpErrorResponse,
|
|
1987
|
+
parse_obj_as(
|
|
1988
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1989
|
+
object_=_response.json(),
|
|
1990
|
+
),
|
|
1991
|
+
),
|
|
1992
|
+
)
|
|
1993
|
+
if _response.status_code == 502:
|
|
1994
|
+
raise BadGatewayError(
|
|
1995
|
+
headers=dict(_response.headers),
|
|
1996
|
+
body=typing.cast(
|
|
1997
|
+
HttpErrorResponse,
|
|
1998
|
+
parse_obj_as(
|
|
1999
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2000
|
+
object_=_response.json(),
|
|
2001
|
+
),
|
|
2002
|
+
),
|
|
2003
|
+
)
|
|
2004
|
+
if _response.status_code == 504:
|
|
2005
|
+
raise GatewayTimeoutError(
|
|
2006
|
+
headers=dict(_response.headers),
|
|
2007
|
+
body=typing.cast(
|
|
2008
|
+
HttpErrorResponse,
|
|
2009
|
+
parse_obj_as(
|
|
2010
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2011
|
+
object_=_response.json(),
|
|
2012
|
+
),
|
|
2013
|
+
),
|
|
2014
|
+
)
|
|
2015
|
+
_response_json = _response.json()
|
|
2016
|
+
except JSONDecodeError:
|
|
2017
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
2018
|
+
except ValidationError as e:
|
|
2019
|
+
raise ParsingError(
|
|
2020
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
2021
|
+
)
|
|
2022
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
2023
|
+
|
|
2024
|
+
async def create(
|
|
2025
|
+
self,
|
|
2026
|
+
*,
|
|
2027
|
+
idempotency_key: str,
|
|
2028
|
+
name: str,
|
|
2029
|
+
parent_network_id: int,
|
|
2030
|
+
cpo_ids: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
2031
|
+
description: typing.Optional[str] = OMIT,
|
|
2032
|
+
countries: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
2033
|
+
power_types: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
2034
|
+
parking_types: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
2035
|
+
facilities: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
2036
|
+
auto_accept_cpo_additions: typing.Optional[bool] = OMIT,
|
|
2037
|
+
publicly_accessible: typing.Optional[bool] = OMIT,
|
|
2038
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2039
|
+
) -> AsyncHttpResponse[NetworkResponse]:
|
|
2040
|
+
"""
|
|
2041
|
+
A named slice of one of your base networks: some of its CPOs, optionally filtered by country, power, parking and facilities.
|
|
2042
|
+
|
|
2043
|
+
Parameters
|
|
2044
|
+
----------
|
|
2045
|
+
idempotency_key : str
|
|
2046
|
+
A unique key you choose for this call, e.g. a UUID. Retrying with the same key returns the first result instead of acting twice.
|
|
2047
|
+
|
|
2048
|
+
name : str
|
|
2049
|
+
|
|
2050
|
+
parent_network_id : int
|
|
2051
|
+
|
|
2052
|
+
cpo_ids : typing.Optional[typing.Sequence[str]]
|
|
2053
|
+
|
|
2054
|
+
description : typing.Optional[str]
|
|
2055
|
+
|
|
2056
|
+
countries : typing.Optional[typing.Sequence[str]]
|
|
2057
|
+
|
|
2058
|
+
power_types : typing.Optional[typing.Sequence[str]]
|
|
2059
|
+
|
|
2060
|
+
parking_types : typing.Optional[typing.Sequence[str]]
|
|
2061
|
+
|
|
2062
|
+
facilities : typing.Optional[typing.Sequence[str]]
|
|
2063
|
+
|
|
2064
|
+
auto_accept_cpo_additions : typing.Optional[bool]
|
|
2065
|
+
|
|
2066
|
+
publicly_accessible : typing.Optional[bool]
|
|
2067
|
+
|
|
2068
|
+
request_options : typing.Optional[RequestOptions]
|
|
2069
|
+
Request-specific configuration.
|
|
2070
|
+
|
|
2071
|
+
Returns
|
|
2072
|
+
-------
|
|
2073
|
+
AsyncHttpResponse[NetworkResponse]
|
|
2074
|
+
The created sub-network.
|
|
2075
|
+
"""
|
|
2076
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2077
|
+
"emsp/networks",
|
|
2078
|
+
method="POST",
|
|
2079
|
+
json={
|
|
2080
|
+
"name": name,
|
|
2081
|
+
"parent_network_id": parent_network_id,
|
|
2082
|
+
"cpo_ids": cpo_ids,
|
|
2083
|
+
"description": description,
|
|
2084
|
+
"countries": countries,
|
|
2085
|
+
"power_types": power_types,
|
|
2086
|
+
"parking_types": parking_types,
|
|
2087
|
+
"facilities": facilities,
|
|
2088
|
+
"auto_accept_cpo_additions": auto_accept_cpo_additions,
|
|
2089
|
+
"publicly_accessible": publicly_accessible,
|
|
2090
|
+
},
|
|
2091
|
+
headers={
|
|
2092
|
+
"content-type": "application/json",
|
|
2093
|
+
"Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None,
|
|
2094
|
+
},
|
|
2095
|
+
request_options=request_options,
|
|
2096
|
+
omit=OMIT,
|
|
2097
|
+
)
|
|
2098
|
+
try:
|
|
2099
|
+
if 200 <= _response.status_code < 300:
|
|
2100
|
+
_data = typing.cast(
|
|
2101
|
+
NetworkResponse,
|
|
2102
|
+
parse_obj_as(
|
|
2103
|
+
type_=NetworkResponse, # type: ignore
|
|
2104
|
+
object_=_response.json(),
|
|
2105
|
+
),
|
|
2106
|
+
)
|
|
2107
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
2108
|
+
if _response.status_code == 400:
|
|
2109
|
+
raise BadRequestError(
|
|
2110
|
+
headers=dict(_response.headers),
|
|
2111
|
+
body=typing.cast(
|
|
2112
|
+
HttpErrorResponse,
|
|
2113
|
+
parse_obj_as(
|
|
2114
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2115
|
+
object_=_response.json(),
|
|
2116
|
+
),
|
|
2117
|
+
),
|
|
2118
|
+
)
|
|
2119
|
+
if _response.status_code == 401:
|
|
2120
|
+
raise UnauthorizedError(
|
|
2121
|
+
headers=dict(_response.headers),
|
|
2122
|
+
body=typing.cast(
|
|
2123
|
+
HttpErrorResponse,
|
|
2124
|
+
parse_obj_as(
|
|
2125
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2126
|
+
object_=_response.json(),
|
|
2127
|
+
),
|
|
2128
|
+
),
|
|
2129
|
+
)
|
|
2130
|
+
if _response.status_code == 404:
|
|
2131
|
+
raise NotFoundError(
|
|
2132
|
+
headers=dict(_response.headers),
|
|
2133
|
+
body=typing.cast(
|
|
2134
|
+
HttpErrorResponse,
|
|
2135
|
+
parse_obj_as(
|
|
2136
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2137
|
+
object_=_response.json(),
|
|
2138
|
+
),
|
|
2139
|
+
),
|
|
2140
|
+
)
|
|
2141
|
+
if _response.status_code == 409:
|
|
2142
|
+
raise ConflictError(
|
|
2143
|
+
headers=dict(_response.headers),
|
|
2144
|
+
body=typing.cast(
|
|
2145
|
+
HttpErrorResponse,
|
|
2146
|
+
parse_obj_as(
|
|
2147
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2148
|
+
object_=_response.json(),
|
|
2149
|
+
),
|
|
2150
|
+
),
|
|
2151
|
+
)
|
|
2152
|
+
if _response.status_code == 422:
|
|
2153
|
+
raise UnprocessableEntityError(
|
|
2154
|
+
headers=dict(_response.headers),
|
|
2155
|
+
body=typing.cast(
|
|
2156
|
+
HttpValidationError,
|
|
2157
|
+
parse_obj_as(
|
|
2158
|
+
type_=HttpValidationError, # type: ignore
|
|
2159
|
+
object_=_response.json(),
|
|
2160
|
+
),
|
|
2161
|
+
),
|
|
2162
|
+
)
|
|
2163
|
+
if _response.status_code == 429:
|
|
2164
|
+
raise TooManyRequestsError(
|
|
2165
|
+
headers=dict(_response.headers),
|
|
2166
|
+
body=typing.cast(
|
|
2167
|
+
HttpErrorResponse,
|
|
2168
|
+
parse_obj_as(
|
|
2169
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2170
|
+
object_=_response.json(),
|
|
2171
|
+
),
|
|
2172
|
+
),
|
|
2173
|
+
)
|
|
2174
|
+
if _response.status_code == 502:
|
|
2175
|
+
raise BadGatewayError(
|
|
2176
|
+
headers=dict(_response.headers),
|
|
2177
|
+
body=typing.cast(
|
|
2178
|
+
HttpErrorResponse,
|
|
2179
|
+
parse_obj_as(
|
|
2180
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2181
|
+
object_=_response.json(),
|
|
2182
|
+
),
|
|
2183
|
+
),
|
|
2184
|
+
)
|
|
2185
|
+
if _response.status_code == 504:
|
|
2186
|
+
raise GatewayTimeoutError(
|
|
2187
|
+
headers=dict(_response.headers),
|
|
2188
|
+
body=typing.cast(
|
|
2189
|
+
HttpErrorResponse,
|
|
2190
|
+
parse_obj_as(
|
|
2191
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2192
|
+
object_=_response.json(),
|
|
2193
|
+
),
|
|
2194
|
+
),
|
|
2195
|
+
)
|
|
2196
|
+
_response_json = _response.json()
|
|
2197
|
+
except JSONDecodeError:
|
|
2198
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
2199
|
+
except ValidationError as e:
|
|
2200
|
+
raise ParsingError(
|
|
2201
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
2202
|
+
)
|
|
2203
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
2204
|
+
|
|
2205
|
+
async def create_base(
|
|
2206
|
+
self,
|
|
2207
|
+
*,
|
|
2208
|
+
idempotency_key: str,
|
|
2209
|
+
emp_identity_id: int,
|
|
2210
|
+
cpo_ids: typing.Sequence[str],
|
|
2211
|
+
name: typing.Optional[str] = OMIT,
|
|
2212
|
+
description: typing.Optional[str] = OMIT,
|
|
2213
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2214
|
+
) -> AsyncHttpResponse[NetworkResponse]:
|
|
2215
|
+
"""
|
|
2216
|
+
Every CPO reachable through one of your roaming identities. Base networks are permanent.
|
|
2217
|
+
|
|
2218
|
+
Parameters
|
|
2219
|
+
----------
|
|
2220
|
+
idempotency_key : str
|
|
2221
|
+
A unique key you choose for this call, e.g. a UUID. Retrying with the same key returns the first result instead of acting twice.
|
|
2222
|
+
|
|
2223
|
+
emp_identity_id : int
|
|
2224
|
+
|
|
2225
|
+
cpo_ids : typing.Sequence[str]
|
|
2226
|
+
|
|
2227
|
+
name : typing.Optional[str]
|
|
2228
|
+
|
|
2229
|
+
description : typing.Optional[str]
|
|
2230
|
+
|
|
2231
|
+
request_options : typing.Optional[RequestOptions]
|
|
2232
|
+
Request-specific configuration.
|
|
2233
|
+
|
|
2234
|
+
Returns
|
|
2235
|
+
-------
|
|
2236
|
+
AsyncHttpResponse[NetworkResponse]
|
|
2237
|
+
The created base network.
|
|
2238
|
+
"""
|
|
2239
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2240
|
+
"emsp/networks/base",
|
|
2241
|
+
method="POST",
|
|
2242
|
+
json={
|
|
2243
|
+
"emp_identity_id": emp_identity_id,
|
|
2244
|
+
"cpo_ids": cpo_ids,
|
|
2245
|
+
"name": name,
|
|
2246
|
+
"description": description,
|
|
2247
|
+
},
|
|
2248
|
+
headers={
|
|
2249
|
+
"content-type": "application/json",
|
|
2250
|
+
"Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None,
|
|
2251
|
+
},
|
|
2252
|
+
request_options=request_options,
|
|
2253
|
+
omit=OMIT,
|
|
2254
|
+
)
|
|
2255
|
+
try:
|
|
2256
|
+
if 200 <= _response.status_code < 300:
|
|
2257
|
+
_data = typing.cast(
|
|
2258
|
+
NetworkResponse,
|
|
2259
|
+
parse_obj_as(
|
|
2260
|
+
type_=NetworkResponse, # type: ignore
|
|
2261
|
+
object_=_response.json(),
|
|
2262
|
+
),
|
|
2263
|
+
)
|
|
2264
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
2265
|
+
if _response.status_code == 401:
|
|
2266
|
+
raise UnauthorizedError(
|
|
2267
|
+
headers=dict(_response.headers),
|
|
2268
|
+
body=typing.cast(
|
|
2269
|
+
HttpErrorResponse,
|
|
2270
|
+
parse_obj_as(
|
|
2271
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2272
|
+
object_=_response.json(),
|
|
2273
|
+
),
|
|
2274
|
+
),
|
|
2275
|
+
)
|
|
2276
|
+
if _response.status_code == 404:
|
|
2277
|
+
raise NotFoundError(
|
|
2278
|
+
headers=dict(_response.headers),
|
|
2279
|
+
body=typing.cast(
|
|
2280
|
+
HttpErrorResponse,
|
|
2281
|
+
parse_obj_as(
|
|
2282
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2283
|
+
object_=_response.json(),
|
|
2284
|
+
),
|
|
2285
|
+
),
|
|
2286
|
+
)
|
|
2287
|
+
if _response.status_code == 409:
|
|
2288
|
+
raise ConflictError(
|
|
2289
|
+
headers=dict(_response.headers),
|
|
2290
|
+
body=typing.cast(
|
|
2291
|
+
HttpErrorResponse,
|
|
2292
|
+
parse_obj_as(
|
|
2293
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2294
|
+
object_=_response.json(),
|
|
2295
|
+
),
|
|
2296
|
+
),
|
|
2297
|
+
)
|
|
2298
|
+
if _response.status_code == 422:
|
|
2299
|
+
raise UnprocessableEntityError(
|
|
2300
|
+
headers=dict(_response.headers),
|
|
2301
|
+
body=typing.cast(
|
|
2302
|
+
HttpValidationError,
|
|
2303
|
+
parse_obj_as(
|
|
2304
|
+
type_=HttpValidationError, # type: ignore
|
|
2305
|
+
object_=_response.json(),
|
|
2306
|
+
),
|
|
2307
|
+
),
|
|
2308
|
+
)
|
|
2309
|
+
if _response.status_code == 429:
|
|
2310
|
+
raise TooManyRequestsError(
|
|
2311
|
+
headers=dict(_response.headers),
|
|
2312
|
+
body=typing.cast(
|
|
2313
|
+
HttpErrorResponse,
|
|
2314
|
+
parse_obj_as(
|
|
2315
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2316
|
+
object_=_response.json(),
|
|
2317
|
+
),
|
|
2318
|
+
),
|
|
2319
|
+
)
|
|
2320
|
+
if _response.status_code == 502:
|
|
2321
|
+
raise BadGatewayError(
|
|
2322
|
+
headers=dict(_response.headers),
|
|
2323
|
+
body=typing.cast(
|
|
2324
|
+
HttpErrorResponse,
|
|
2325
|
+
parse_obj_as(
|
|
2326
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2327
|
+
object_=_response.json(),
|
|
2328
|
+
),
|
|
2329
|
+
),
|
|
2330
|
+
)
|
|
2331
|
+
if _response.status_code == 504:
|
|
2332
|
+
raise GatewayTimeoutError(
|
|
2333
|
+
headers=dict(_response.headers),
|
|
2334
|
+
body=typing.cast(
|
|
2335
|
+
HttpErrorResponse,
|
|
2336
|
+
parse_obj_as(
|
|
2337
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2338
|
+
object_=_response.json(),
|
|
2339
|
+
),
|
|
2340
|
+
),
|
|
2341
|
+
)
|
|
2342
|
+
_response_json = _response.json()
|
|
2343
|
+
except JSONDecodeError:
|
|
2344
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
2345
|
+
except ValidationError as e:
|
|
2346
|
+
raise ParsingError(
|
|
2347
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
2348
|
+
)
|
|
2349
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
2350
|
+
|
|
2351
|
+
async def get_effective_view(
|
|
2352
|
+
self,
|
|
2353
|
+
*,
|
|
2354
|
+
country: typing.Optional[str] = None,
|
|
2355
|
+
after: typing.Optional[str] = None,
|
|
2356
|
+
limit: typing.Optional[int] = None,
|
|
2357
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2358
|
+
) -> AsyncPager[EffectiveCpo, EffectiveViewResponse]:
|
|
2359
|
+
"""
|
|
2360
|
+
Each reachable CPO once: your own base networks first, then published networks in your ranking order.
|
|
2361
|
+
|
|
2362
|
+
Parameters
|
|
2363
|
+
----------
|
|
2364
|
+
country : typing.Optional[str]
|
|
2365
|
+
Only CPOs of this OCPI country code, e.g. NL.
|
|
2366
|
+
|
|
2367
|
+
after : typing.Optional[str]
|
|
2368
|
+
Cursor: the previous page's ``pagination.end_cursor``. Omit it for the first page.
|
|
2369
|
+
|
|
2370
|
+
limit : typing.Optional[int]
|
|
2371
|
+
Maximum rows per page (default 50, max 200).
|
|
2372
|
+
|
|
2373
|
+
request_options : typing.Optional[RequestOptions]
|
|
2374
|
+
Request-specific configuration.
|
|
2375
|
+
|
|
2376
|
+
Returns
|
|
2377
|
+
-------
|
|
2378
|
+
AsyncPager[EffectiveCpo, EffectiveViewResponse]
|
|
2379
|
+
One page of reachable CPOs, with counts per source.
|
|
2380
|
+
"""
|
|
2381
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2382
|
+
"emsp/network-effective-view",
|
|
2383
|
+
method="GET",
|
|
2384
|
+
params={
|
|
2385
|
+
"country": country,
|
|
2386
|
+
"after": after,
|
|
2387
|
+
"limit": limit,
|
|
2388
|
+
},
|
|
2389
|
+
request_options=request_options,
|
|
2390
|
+
)
|
|
2391
|
+
try:
|
|
2392
|
+
if 200 <= _response.status_code < 300:
|
|
2393
|
+
_parsed_response = typing.cast(
|
|
2394
|
+
EffectiveViewResponse,
|
|
2395
|
+
parse_obj_as(
|
|
2396
|
+
type_=EffectiveViewResponse, # type: ignore
|
|
2397
|
+
object_=_response.json(),
|
|
2398
|
+
),
|
|
2399
|
+
)
|
|
2400
|
+
_items = _parsed_response.data
|
|
2401
|
+
_has_next = False
|
|
2402
|
+
_get_next = None
|
|
2403
|
+
if _parsed_response.pagination is not None:
|
|
2404
|
+
_parsed_next = _parsed_response.pagination.end_cursor
|
|
2405
|
+
_has_next = _parsed_next is not None and _parsed_next != ""
|
|
2406
|
+
|
|
2407
|
+
async def _get_next():
|
|
2408
|
+
return await self.get_effective_view(
|
|
2409
|
+
country=country,
|
|
2410
|
+
after=_parsed_next,
|
|
2411
|
+
limit=limit,
|
|
2412
|
+
request_options=request_options,
|
|
2413
|
+
)
|
|
2414
|
+
|
|
2415
|
+
return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
|
|
2416
|
+
if _response.status_code == 401:
|
|
2417
|
+
raise UnauthorizedError(
|
|
2418
|
+
headers=dict(_response.headers),
|
|
2419
|
+
body=typing.cast(
|
|
2420
|
+
HttpErrorResponse,
|
|
2421
|
+
parse_obj_as(
|
|
2422
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2423
|
+
object_=_response.json(),
|
|
2424
|
+
),
|
|
2425
|
+
),
|
|
2426
|
+
)
|
|
2427
|
+
if _response.status_code == 422:
|
|
2428
|
+
raise UnprocessableEntityError(
|
|
2429
|
+
headers=dict(_response.headers),
|
|
2430
|
+
body=typing.cast(
|
|
2431
|
+
HttpValidationError,
|
|
2432
|
+
parse_obj_as(
|
|
2433
|
+
type_=HttpValidationError, # type: ignore
|
|
2434
|
+
object_=_response.json(),
|
|
2435
|
+
),
|
|
2436
|
+
),
|
|
2437
|
+
)
|
|
2438
|
+
if _response.status_code == 429:
|
|
2439
|
+
raise TooManyRequestsError(
|
|
2440
|
+
headers=dict(_response.headers),
|
|
2441
|
+
body=typing.cast(
|
|
2442
|
+
HttpErrorResponse,
|
|
2443
|
+
parse_obj_as(
|
|
2444
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2445
|
+
object_=_response.json(),
|
|
2446
|
+
),
|
|
2447
|
+
),
|
|
2448
|
+
)
|
|
2449
|
+
if _response.status_code == 502:
|
|
2450
|
+
raise BadGatewayError(
|
|
2451
|
+
headers=dict(_response.headers),
|
|
2452
|
+
body=typing.cast(
|
|
2453
|
+
HttpErrorResponse,
|
|
2454
|
+
parse_obj_as(
|
|
2455
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2456
|
+
object_=_response.json(),
|
|
2457
|
+
),
|
|
2458
|
+
),
|
|
2459
|
+
)
|
|
2460
|
+
if _response.status_code == 504:
|
|
2461
|
+
raise GatewayTimeoutError(
|
|
2462
|
+
headers=dict(_response.headers),
|
|
2463
|
+
body=typing.cast(
|
|
2464
|
+
HttpErrorResponse,
|
|
2465
|
+
parse_obj_as(
|
|
2466
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2467
|
+
object_=_response.json(),
|
|
2468
|
+
),
|
|
2469
|
+
),
|
|
2470
|
+
)
|
|
2471
|
+
_response_json = _response.json()
|
|
2472
|
+
except JSONDecodeError:
|
|
2473
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
2474
|
+
except ValidationError as e:
|
|
2475
|
+
raise ParsingError(
|
|
2476
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
2477
|
+
)
|
|
2478
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
2479
|
+
|
|
2480
|
+
async def get(
|
|
2481
|
+
self, network_id: int, *, request_options: typing.Optional[RequestOptions] = None
|
|
2482
|
+
) -> AsyncHttpResponse[NetworkDetailResponse]:
|
|
2483
|
+
"""
|
|
2484
|
+
With how many locations and EVSEs it reaches today and how many token groups use it.
|
|
2485
|
+
|
|
2486
|
+
Parameters
|
|
2487
|
+
----------
|
|
2488
|
+
network_id : int
|
|
2489
|
+
The network's ``network_id``.
|
|
2490
|
+
|
|
2491
|
+
request_options : typing.Optional[RequestOptions]
|
|
2492
|
+
Request-specific configuration.
|
|
2493
|
+
|
|
2494
|
+
Returns
|
|
2495
|
+
-------
|
|
2496
|
+
AsyncHttpResponse[NetworkDetailResponse]
|
|
2497
|
+
The network with how many locations, EVSEs and token groups it has.
|
|
2498
|
+
"""
|
|
2499
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2500
|
+
f"emsp/networks/{encode_path_param(network_id)}",
|
|
2501
|
+
method="GET",
|
|
2502
|
+
request_options=request_options,
|
|
2503
|
+
)
|
|
2504
|
+
try:
|
|
2505
|
+
if 200 <= _response.status_code < 300:
|
|
2506
|
+
_data = typing.cast(
|
|
2507
|
+
NetworkDetailResponse,
|
|
2508
|
+
parse_obj_as(
|
|
2509
|
+
type_=NetworkDetailResponse, # type: ignore
|
|
2510
|
+
object_=_response.json(),
|
|
2511
|
+
),
|
|
2512
|
+
)
|
|
2513
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
2514
|
+
if _response.status_code == 401:
|
|
2515
|
+
raise UnauthorizedError(
|
|
2516
|
+
headers=dict(_response.headers),
|
|
2517
|
+
body=typing.cast(
|
|
2518
|
+
HttpErrorResponse,
|
|
2519
|
+
parse_obj_as(
|
|
2520
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2521
|
+
object_=_response.json(),
|
|
2522
|
+
),
|
|
2523
|
+
),
|
|
2524
|
+
)
|
|
2525
|
+
if _response.status_code == 404:
|
|
2526
|
+
raise NotFoundError(
|
|
2527
|
+
headers=dict(_response.headers),
|
|
2528
|
+
body=typing.cast(
|
|
2529
|
+
HttpErrorResponse,
|
|
2530
|
+
parse_obj_as(
|
|
2531
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2532
|
+
object_=_response.json(),
|
|
2533
|
+
),
|
|
2534
|
+
),
|
|
2535
|
+
)
|
|
2536
|
+
if _response.status_code == 422:
|
|
2537
|
+
raise UnprocessableEntityError(
|
|
2538
|
+
headers=dict(_response.headers),
|
|
2539
|
+
body=typing.cast(
|
|
2540
|
+
HttpValidationError,
|
|
2541
|
+
parse_obj_as(
|
|
2542
|
+
type_=HttpValidationError, # type: ignore
|
|
2543
|
+
object_=_response.json(),
|
|
2544
|
+
),
|
|
2545
|
+
),
|
|
2546
|
+
)
|
|
2547
|
+
if _response.status_code == 429:
|
|
2548
|
+
raise TooManyRequestsError(
|
|
2549
|
+
headers=dict(_response.headers),
|
|
2550
|
+
body=typing.cast(
|
|
2551
|
+
HttpErrorResponse,
|
|
2552
|
+
parse_obj_as(
|
|
2553
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2554
|
+
object_=_response.json(),
|
|
2555
|
+
),
|
|
2556
|
+
),
|
|
2557
|
+
)
|
|
2558
|
+
if _response.status_code == 502:
|
|
2559
|
+
raise BadGatewayError(
|
|
2560
|
+
headers=dict(_response.headers),
|
|
2561
|
+
body=typing.cast(
|
|
2562
|
+
HttpErrorResponse,
|
|
2563
|
+
parse_obj_as(
|
|
2564
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2565
|
+
object_=_response.json(),
|
|
2566
|
+
),
|
|
2567
|
+
),
|
|
2568
|
+
)
|
|
2569
|
+
if _response.status_code == 504:
|
|
2570
|
+
raise GatewayTimeoutError(
|
|
2571
|
+
headers=dict(_response.headers),
|
|
2572
|
+
body=typing.cast(
|
|
2573
|
+
HttpErrorResponse,
|
|
2574
|
+
parse_obj_as(
|
|
2575
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2576
|
+
object_=_response.json(),
|
|
2577
|
+
),
|
|
2578
|
+
),
|
|
2579
|
+
)
|
|
2580
|
+
_response_json = _response.json()
|
|
2581
|
+
except JSONDecodeError:
|
|
2582
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
2583
|
+
except ValidationError as e:
|
|
2584
|
+
raise ParsingError(
|
|
2585
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
2586
|
+
)
|
|
2587
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
2588
|
+
|
|
2589
|
+
async def delete(
|
|
2590
|
+
self,
|
|
2591
|
+
network_id: int,
|
|
2592
|
+
*,
|
|
2593
|
+
force: typing.Optional[bool] = None,
|
|
2594
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2595
|
+
) -> AsyncHttpResponse[None]:
|
|
2596
|
+
"""
|
|
2597
|
+
Base networks cannot be deleted. A sub-network assigned to token groups needs ``force=true``.
|
|
2598
|
+
|
|
2599
|
+
Parameters
|
|
2600
|
+
----------
|
|
2601
|
+
network_id : int
|
|
2602
|
+
The network's ``network_id``.
|
|
2603
|
+
|
|
2604
|
+
force : typing.Optional[bool]
|
|
2605
|
+
Also remove the network from the token groups it is assigned to.
|
|
2606
|
+
|
|
2607
|
+
request_options : typing.Optional[RequestOptions]
|
|
2608
|
+
Request-specific configuration.
|
|
2609
|
+
|
|
2610
|
+
Returns
|
|
2611
|
+
-------
|
|
2612
|
+
AsyncHttpResponse[None]
|
|
2613
|
+
"""
|
|
2614
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2615
|
+
f"emsp/networks/{encode_path_param(network_id)}",
|
|
2616
|
+
method="DELETE",
|
|
2617
|
+
params={
|
|
2618
|
+
"force": force,
|
|
2619
|
+
},
|
|
2620
|
+
request_options=request_options,
|
|
2621
|
+
)
|
|
2622
|
+
try:
|
|
2623
|
+
if 200 <= _response.status_code < 300:
|
|
2624
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
2625
|
+
if _response.status_code == 401:
|
|
2626
|
+
raise UnauthorizedError(
|
|
2627
|
+
headers=dict(_response.headers),
|
|
2628
|
+
body=typing.cast(
|
|
2629
|
+
HttpErrorResponse,
|
|
2630
|
+
parse_obj_as(
|
|
2631
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2632
|
+
object_=_response.json(),
|
|
2633
|
+
),
|
|
2634
|
+
),
|
|
2635
|
+
)
|
|
2636
|
+
if _response.status_code == 404:
|
|
2637
|
+
raise NotFoundError(
|
|
2638
|
+
headers=dict(_response.headers),
|
|
2639
|
+
body=typing.cast(
|
|
2640
|
+
HttpErrorResponse,
|
|
2641
|
+
parse_obj_as(
|
|
2642
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2643
|
+
object_=_response.json(),
|
|
2644
|
+
),
|
|
2645
|
+
),
|
|
2646
|
+
)
|
|
2647
|
+
if _response.status_code == 409:
|
|
2648
|
+
raise ConflictError(
|
|
2649
|
+
headers=dict(_response.headers),
|
|
2650
|
+
body=typing.cast(
|
|
2651
|
+
HttpErrorResponse,
|
|
2652
|
+
parse_obj_as(
|
|
2653
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2654
|
+
object_=_response.json(),
|
|
2655
|
+
),
|
|
2656
|
+
),
|
|
2657
|
+
)
|
|
2658
|
+
if _response.status_code == 422:
|
|
2659
|
+
raise UnprocessableEntityError(
|
|
2660
|
+
headers=dict(_response.headers),
|
|
2661
|
+
body=typing.cast(
|
|
2662
|
+
HttpValidationError,
|
|
2663
|
+
parse_obj_as(
|
|
2664
|
+
type_=HttpValidationError, # type: ignore
|
|
2665
|
+
object_=_response.json(),
|
|
2666
|
+
),
|
|
2667
|
+
),
|
|
2668
|
+
)
|
|
2669
|
+
if _response.status_code == 429:
|
|
2670
|
+
raise TooManyRequestsError(
|
|
2671
|
+
headers=dict(_response.headers),
|
|
2672
|
+
body=typing.cast(
|
|
2673
|
+
HttpErrorResponse,
|
|
2674
|
+
parse_obj_as(
|
|
2675
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2676
|
+
object_=_response.json(),
|
|
2677
|
+
),
|
|
2678
|
+
),
|
|
2679
|
+
)
|
|
2680
|
+
if _response.status_code == 502:
|
|
2681
|
+
raise BadGatewayError(
|
|
2682
|
+
headers=dict(_response.headers),
|
|
2683
|
+
body=typing.cast(
|
|
2684
|
+
HttpErrorResponse,
|
|
2685
|
+
parse_obj_as(
|
|
2686
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2687
|
+
object_=_response.json(),
|
|
2688
|
+
),
|
|
2689
|
+
),
|
|
2690
|
+
)
|
|
2691
|
+
if _response.status_code == 504:
|
|
2692
|
+
raise GatewayTimeoutError(
|
|
2693
|
+
headers=dict(_response.headers),
|
|
2694
|
+
body=typing.cast(
|
|
2695
|
+
HttpErrorResponse,
|
|
2696
|
+
parse_obj_as(
|
|
2697
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2698
|
+
object_=_response.json(),
|
|
2699
|
+
),
|
|
2700
|
+
),
|
|
2701
|
+
)
|
|
2702
|
+
_response_json = _response.json()
|
|
2703
|
+
except JSONDecodeError:
|
|
2704
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
2705
|
+
except ValidationError as e:
|
|
2706
|
+
raise ParsingError(
|
|
2707
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
2708
|
+
)
|
|
2709
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
2710
|
+
|
|
2711
|
+
async def update(
|
|
2712
|
+
self,
|
|
2713
|
+
network_id: int,
|
|
2714
|
+
*,
|
|
2715
|
+
name: typing.Optional[str] = OMIT,
|
|
2716
|
+
description: typing.Optional[str] = OMIT,
|
|
2717
|
+
cpo_ids: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
2718
|
+
publicly_accessible: typing.Optional[bool] = OMIT,
|
|
2719
|
+
auto_accept_cpo_additions: typing.Optional[bool] = OMIT,
|
|
2720
|
+
countries: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
2721
|
+
power_types: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
2722
|
+
parking_types: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
2723
|
+
facilities: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
2724
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2725
|
+
) -> AsyncHttpResponse[NetworkResponse]:
|
|
2726
|
+
"""
|
|
2727
|
+
Only the fields sent change. A base network's name and filters cannot change; its CPOs and access settings can.
|
|
2728
|
+
|
|
2729
|
+
Parameters
|
|
2730
|
+
----------
|
|
2731
|
+
network_id : int
|
|
2732
|
+
The network's ``network_id``.
|
|
2733
|
+
|
|
2734
|
+
name : typing.Optional[str]
|
|
2735
|
+
|
|
2736
|
+
description : typing.Optional[str]
|
|
2737
|
+
|
|
2738
|
+
cpo_ids : typing.Optional[typing.Sequence[str]]
|
|
2739
|
+
|
|
2740
|
+
publicly_accessible : typing.Optional[bool]
|
|
2741
|
+
|
|
2742
|
+
auto_accept_cpo_additions : typing.Optional[bool]
|
|
2743
|
+
|
|
2744
|
+
countries : typing.Optional[typing.Sequence[str]]
|
|
2745
|
+
|
|
2746
|
+
power_types : typing.Optional[typing.Sequence[str]]
|
|
2747
|
+
|
|
2748
|
+
parking_types : typing.Optional[typing.Sequence[str]]
|
|
2749
|
+
|
|
2750
|
+
facilities : typing.Optional[typing.Sequence[str]]
|
|
2751
|
+
|
|
2752
|
+
request_options : typing.Optional[RequestOptions]
|
|
2753
|
+
Request-specific configuration.
|
|
2754
|
+
|
|
2755
|
+
Returns
|
|
2756
|
+
-------
|
|
2757
|
+
AsyncHttpResponse[NetworkResponse]
|
|
2758
|
+
The network after the update.
|
|
2759
|
+
"""
|
|
2760
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2761
|
+
f"emsp/networks/{encode_path_param(network_id)}",
|
|
2762
|
+
method="PATCH",
|
|
2763
|
+
json={
|
|
2764
|
+
"name": name,
|
|
2765
|
+
"description": description,
|
|
2766
|
+
"cpo_ids": cpo_ids,
|
|
2767
|
+
"publicly_accessible": publicly_accessible,
|
|
2768
|
+
"auto_accept_cpo_additions": auto_accept_cpo_additions,
|
|
2769
|
+
"countries": countries,
|
|
2770
|
+
"power_types": power_types,
|
|
2771
|
+
"parking_types": parking_types,
|
|
2772
|
+
"facilities": facilities,
|
|
2773
|
+
},
|
|
2774
|
+
headers={
|
|
2775
|
+
"content-type": "application/json",
|
|
2776
|
+
},
|
|
2777
|
+
request_options=request_options,
|
|
2778
|
+
omit=OMIT,
|
|
2779
|
+
)
|
|
2780
|
+
try:
|
|
2781
|
+
if 200 <= _response.status_code < 300:
|
|
2782
|
+
_data = typing.cast(
|
|
2783
|
+
NetworkResponse,
|
|
2784
|
+
parse_obj_as(
|
|
2785
|
+
type_=NetworkResponse, # type: ignore
|
|
2786
|
+
object_=_response.json(),
|
|
2787
|
+
),
|
|
2788
|
+
)
|
|
2789
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
2790
|
+
if _response.status_code == 400:
|
|
2791
|
+
raise BadRequestError(
|
|
2792
|
+
headers=dict(_response.headers),
|
|
2793
|
+
body=typing.cast(
|
|
2794
|
+
HttpErrorResponse,
|
|
2795
|
+
parse_obj_as(
|
|
2796
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2797
|
+
object_=_response.json(),
|
|
2798
|
+
),
|
|
2799
|
+
),
|
|
2800
|
+
)
|
|
2801
|
+
if _response.status_code == 401:
|
|
2802
|
+
raise UnauthorizedError(
|
|
2803
|
+
headers=dict(_response.headers),
|
|
2804
|
+
body=typing.cast(
|
|
2805
|
+
HttpErrorResponse,
|
|
2806
|
+
parse_obj_as(
|
|
2807
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2808
|
+
object_=_response.json(),
|
|
2809
|
+
),
|
|
2810
|
+
),
|
|
2811
|
+
)
|
|
2812
|
+
if _response.status_code == 404:
|
|
2813
|
+
raise NotFoundError(
|
|
2814
|
+
headers=dict(_response.headers),
|
|
2815
|
+
body=typing.cast(
|
|
2816
|
+
HttpErrorResponse,
|
|
2817
|
+
parse_obj_as(
|
|
2818
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2819
|
+
object_=_response.json(),
|
|
2820
|
+
),
|
|
2821
|
+
),
|
|
2822
|
+
)
|
|
2823
|
+
if _response.status_code == 422:
|
|
2824
|
+
raise UnprocessableEntityError(
|
|
2825
|
+
headers=dict(_response.headers),
|
|
2826
|
+
body=typing.cast(
|
|
2827
|
+
HttpValidationError,
|
|
2828
|
+
parse_obj_as(
|
|
2829
|
+
type_=HttpValidationError, # type: ignore
|
|
2830
|
+
object_=_response.json(),
|
|
2831
|
+
),
|
|
2832
|
+
),
|
|
2833
|
+
)
|
|
2834
|
+
if _response.status_code == 429:
|
|
2835
|
+
raise TooManyRequestsError(
|
|
2836
|
+
headers=dict(_response.headers),
|
|
2837
|
+
body=typing.cast(
|
|
2838
|
+
HttpErrorResponse,
|
|
2839
|
+
parse_obj_as(
|
|
2840
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2841
|
+
object_=_response.json(),
|
|
2842
|
+
),
|
|
2843
|
+
),
|
|
2844
|
+
)
|
|
2845
|
+
if _response.status_code == 502:
|
|
2846
|
+
raise BadGatewayError(
|
|
2847
|
+
headers=dict(_response.headers),
|
|
2848
|
+
body=typing.cast(
|
|
2849
|
+
HttpErrorResponse,
|
|
2850
|
+
parse_obj_as(
|
|
2851
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2852
|
+
object_=_response.json(),
|
|
2853
|
+
),
|
|
2854
|
+
),
|
|
2855
|
+
)
|
|
2856
|
+
if _response.status_code == 504:
|
|
2857
|
+
raise GatewayTimeoutError(
|
|
2858
|
+
headers=dict(_response.headers),
|
|
2859
|
+
body=typing.cast(
|
|
2860
|
+
HttpErrorResponse,
|
|
2861
|
+
parse_obj_as(
|
|
2862
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2863
|
+
object_=_response.json(),
|
|
2864
|
+
),
|
|
2865
|
+
),
|
|
2866
|
+
)
|
|
2867
|
+
_response_json = _response.json()
|
|
2868
|
+
except JSONDecodeError:
|
|
2869
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
2870
|
+
except ValidationError as e:
|
|
2871
|
+
raise ParsingError(
|
|
2872
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
2873
|
+
)
|
|
2874
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
2875
|
+
|
|
2876
|
+
async def list_consumers(
|
|
2877
|
+
self,
|
|
2878
|
+
network_id: int,
|
|
2879
|
+
*,
|
|
2880
|
+
after: typing.Optional[str] = None,
|
|
2881
|
+
limit: typing.Optional[int] = None,
|
|
2882
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2883
|
+
) -> AsyncPager[NetworkConsumer, NetworkConsumerPage]:
|
|
2884
|
+
"""
|
|
2885
|
+
Workspaces that ranked this base network, with its position in their ranking.
|
|
2886
|
+
|
|
2887
|
+
Parameters
|
|
2888
|
+
----------
|
|
2889
|
+
network_id : int
|
|
2890
|
+
The network's ``network_id``.
|
|
2891
|
+
|
|
2892
|
+
after : typing.Optional[str]
|
|
2893
|
+
Cursor: the previous page's ``pagination.end_cursor``. Omit it for the first page.
|
|
2894
|
+
|
|
2895
|
+
limit : typing.Optional[int]
|
|
2896
|
+
Maximum rows per page (default 50, max 200).
|
|
2897
|
+
|
|
2898
|
+
request_options : typing.Optional[RequestOptions]
|
|
2899
|
+
Request-specific configuration.
|
|
2900
|
+
|
|
2901
|
+
Returns
|
|
2902
|
+
-------
|
|
2903
|
+
AsyncPager[NetworkConsumer, NetworkConsumerPage]
|
|
2904
|
+
One page of workspaces, with your network's place in their ranking.
|
|
2905
|
+
"""
|
|
2906
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2907
|
+
f"emsp/networks/{encode_path_param(network_id)}/consumers",
|
|
2908
|
+
method="GET",
|
|
2909
|
+
params={
|
|
2910
|
+
"after": after,
|
|
2911
|
+
"limit": limit,
|
|
2912
|
+
},
|
|
2913
|
+
request_options=request_options,
|
|
2914
|
+
)
|
|
2915
|
+
try:
|
|
2916
|
+
if 200 <= _response.status_code < 300:
|
|
2917
|
+
_parsed_response = typing.cast(
|
|
2918
|
+
NetworkConsumerPage,
|
|
2919
|
+
parse_obj_as(
|
|
2920
|
+
type_=NetworkConsumerPage, # type: ignore
|
|
2921
|
+
object_=_response.json(),
|
|
2922
|
+
),
|
|
2923
|
+
)
|
|
2924
|
+
_items = _parsed_response.data
|
|
2925
|
+
_has_next = False
|
|
2926
|
+
_get_next = None
|
|
2927
|
+
if _parsed_response.pagination is not None:
|
|
2928
|
+
_parsed_next = _parsed_response.pagination.end_cursor
|
|
2929
|
+
_has_next = _parsed_next is not None and _parsed_next != ""
|
|
2930
|
+
|
|
2931
|
+
async def _get_next():
|
|
2932
|
+
return await self.list_consumers(
|
|
2933
|
+
network_id,
|
|
2934
|
+
after=_parsed_next,
|
|
2935
|
+
limit=limit,
|
|
2936
|
+
request_options=request_options,
|
|
2937
|
+
)
|
|
2938
|
+
|
|
2939
|
+
return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
|
|
2940
|
+
if _response.status_code == 401:
|
|
2941
|
+
raise UnauthorizedError(
|
|
2942
|
+
headers=dict(_response.headers),
|
|
2943
|
+
body=typing.cast(
|
|
2944
|
+
HttpErrorResponse,
|
|
2945
|
+
parse_obj_as(
|
|
2946
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2947
|
+
object_=_response.json(),
|
|
2948
|
+
),
|
|
2949
|
+
),
|
|
2950
|
+
)
|
|
2951
|
+
if _response.status_code == 404:
|
|
2952
|
+
raise NotFoundError(
|
|
2953
|
+
headers=dict(_response.headers),
|
|
2954
|
+
body=typing.cast(
|
|
2955
|
+
HttpErrorResponse,
|
|
2956
|
+
parse_obj_as(
|
|
2957
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2958
|
+
object_=_response.json(),
|
|
2959
|
+
),
|
|
2960
|
+
),
|
|
2961
|
+
)
|
|
2962
|
+
if _response.status_code == 422:
|
|
2963
|
+
raise UnprocessableEntityError(
|
|
2964
|
+
headers=dict(_response.headers),
|
|
2965
|
+
body=typing.cast(
|
|
2966
|
+
HttpValidationError,
|
|
2967
|
+
parse_obj_as(
|
|
2968
|
+
type_=HttpValidationError, # type: ignore
|
|
2969
|
+
object_=_response.json(),
|
|
2970
|
+
),
|
|
2971
|
+
),
|
|
2972
|
+
)
|
|
2973
|
+
if _response.status_code == 429:
|
|
2974
|
+
raise TooManyRequestsError(
|
|
2975
|
+
headers=dict(_response.headers),
|
|
2976
|
+
body=typing.cast(
|
|
2977
|
+
HttpErrorResponse,
|
|
2978
|
+
parse_obj_as(
|
|
2979
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2980
|
+
object_=_response.json(),
|
|
2981
|
+
),
|
|
2982
|
+
),
|
|
2983
|
+
)
|
|
2984
|
+
if _response.status_code == 502:
|
|
2985
|
+
raise BadGatewayError(
|
|
2986
|
+
headers=dict(_response.headers),
|
|
2987
|
+
body=typing.cast(
|
|
2988
|
+
HttpErrorResponse,
|
|
2989
|
+
parse_obj_as(
|
|
2990
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2991
|
+
object_=_response.json(),
|
|
2992
|
+
),
|
|
2993
|
+
),
|
|
2994
|
+
)
|
|
2995
|
+
if _response.status_code == 504:
|
|
2996
|
+
raise GatewayTimeoutError(
|
|
2997
|
+
headers=dict(_response.headers),
|
|
2998
|
+
body=typing.cast(
|
|
2999
|
+
HttpErrorResponse,
|
|
3000
|
+
parse_obj_as(
|
|
3001
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3002
|
+
object_=_response.json(),
|
|
3003
|
+
),
|
|
3004
|
+
),
|
|
3005
|
+
)
|
|
3006
|
+
_response_json = _response.json()
|
|
3007
|
+
except JSONDecodeError:
|
|
3008
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
3009
|
+
except ValidationError as e:
|
|
3010
|
+
raise ParsingError(
|
|
3011
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
3012
|
+
)
|
|
3013
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
3014
|
+
|
|
3015
|
+
async def list_locations(
|
|
3016
|
+
self,
|
|
3017
|
+
network_id: int,
|
|
3018
|
+
*,
|
|
3019
|
+
country: typing.Optional[str] = None,
|
|
3020
|
+
after: typing.Optional[str] = None,
|
|
3021
|
+
limit: typing.Optional[int] = None,
|
|
3022
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
3023
|
+
) -> AsyncPager[EmspGatewaySchemaNetworksLocationOut, EmspGatewaySchemaNetworksLocationPage]:
|
|
3024
|
+
"""
|
|
3025
|
+
Partner locations of its CPOs, with its filters and active access rules applied.
|
|
3026
|
+
|
|
3027
|
+
Parameters
|
|
3028
|
+
----------
|
|
3029
|
+
network_id : int
|
|
3030
|
+
The network's ``network_id``.
|
|
3031
|
+
|
|
3032
|
+
country : typing.Optional[str]
|
|
3033
|
+
Only locations in this country (ISO 3166 alpha-2 or alpha-3).
|
|
3034
|
+
|
|
3035
|
+
after : typing.Optional[str]
|
|
3036
|
+
Cursor: the previous page's ``pagination.end_cursor``. Omit it for the first page.
|
|
3037
|
+
|
|
3038
|
+
limit : typing.Optional[int]
|
|
3039
|
+
Maximum rows per page (default 50, max 200).
|
|
3040
|
+
|
|
3041
|
+
request_options : typing.Optional[RequestOptions]
|
|
3042
|
+
Request-specific configuration.
|
|
3043
|
+
|
|
3044
|
+
Returns
|
|
3045
|
+
-------
|
|
3046
|
+
AsyncPager[EmspGatewaySchemaNetworksLocationOut, EmspGatewaySchemaNetworksLocationPage]
|
|
3047
|
+
One page of partner locations the network reaches.
|
|
3048
|
+
"""
|
|
3049
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
3050
|
+
f"emsp/networks/{encode_path_param(network_id)}/locations",
|
|
3051
|
+
method="GET",
|
|
3052
|
+
params={
|
|
3053
|
+
"country": country,
|
|
3054
|
+
"after": after,
|
|
3055
|
+
"limit": limit,
|
|
3056
|
+
},
|
|
3057
|
+
request_options=request_options,
|
|
3058
|
+
)
|
|
3059
|
+
try:
|
|
3060
|
+
if 200 <= _response.status_code < 300:
|
|
3061
|
+
_parsed_response = typing.cast(
|
|
3062
|
+
EmspGatewaySchemaNetworksLocationPage,
|
|
3063
|
+
parse_obj_as(
|
|
3064
|
+
type_=EmspGatewaySchemaNetworksLocationPage, # type: ignore
|
|
3065
|
+
object_=_response.json(),
|
|
3066
|
+
),
|
|
3067
|
+
)
|
|
3068
|
+
_items = _parsed_response.data
|
|
3069
|
+
_has_next = False
|
|
3070
|
+
_get_next = None
|
|
3071
|
+
if _parsed_response.pagination is not None:
|
|
3072
|
+
_parsed_next = _parsed_response.pagination.end_cursor
|
|
3073
|
+
_has_next = _parsed_next is not None and _parsed_next != ""
|
|
3074
|
+
|
|
3075
|
+
async def _get_next():
|
|
3076
|
+
return await self.list_locations(
|
|
3077
|
+
network_id,
|
|
3078
|
+
country=country,
|
|
3079
|
+
after=_parsed_next,
|
|
3080
|
+
limit=limit,
|
|
3081
|
+
request_options=request_options,
|
|
3082
|
+
)
|
|
3083
|
+
|
|
3084
|
+
return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
|
|
3085
|
+
if _response.status_code == 401:
|
|
3086
|
+
raise UnauthorizedError(
|
|
3087
|
+
headers=dict(_response.headers),
|
|
3088
|
+
body=typing.cast(
|
|
3089
|
+
HttpErrorResponse,
|
|
3090
|
+
parse_obj_as(
|
|
3091
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3092
|
+
object_=_response.json(),
|
|
3093
|
+
),
|
|
3094
|
+
),
|
|
3095
|
+
)
|
|
3096
|
+
if _response.status_code == 404:
|
|
3097
|
+
raise NotFoundError(
|
|
3098
|
+
headers=dict(_response.headers),
|
|
3099
|
+
body=typing.cast(
|
|
3100
|
+
HttpErrorResponse,
|
|
3101
|
+
parse_obj_as(
|
|
3102
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3103
|
+
object_=_response.json(),
|
|
3104
|
+
),
|
|
3105
|
+
),
|
|
3106
|
+
)
|
|
3107
|
+
if _response.status_code == 422:
|
|
3108
|
+
raise UnprocessableEntityError(
|
|
3109
|
+
headers=dict(_response.headers),
|
|
3110
|
+
body=typing.cast(
|
|
3111
|
+
HttpValidationError,
|
|
3112
|
+
parse_obj_as(
|
|
3113
|
+
type_=HttpValidationError, # type: ignore
|
|
3114
|
+
object_=_response.json(),
|
|
3115
|
+
),
|
|
3116
|
+
),
|
|
3117
|
+
)
|
|
3118
|
+
if _response.status_code == 429:
|
|
3119
|
+
raise TooManyRequestsError(
|
|
3120
|
+
headers=dict(_response.headers),
|
|
3121
|
+
body=typing.cast(
|
|
3122
|
+
HttpErrorResponse,
|
|
3123
|
+
parse_obj_as(
|
|
3124
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3125
|
+
object_=_response.json(),
|
|
3126
|
+
),
|
|
3127
|
+
),
|
|
3128
|
+
)
|
|
3129
|
+
if _response.status_code == 502:
|
|
3130
|
+
raise BadGatewayError(
|
|
3131
|
+
headers=dict(_response.headers),
|
|
3132
|
+
body=typing.cast(
|
|
3133
|
+
HttpErrorResponse,
|
|
3134
|
+
parse_obj_as(
|
|
3135
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3136
|
+
object_=_response.json(),
|
|
3137
|
+
),
|
|
3138
|
+
),
|
|
3139
|
+
)
|
|
3140
|
+
if _response.status_code == 504:
|
|
3141
|
+
raise GatewayTimeoutError(
|
|
3142
|
+
headers=dict(_response.headers),
|
|
3143
|
+
body=typing.cast(
|
|
3144
|
+
HttpErrorResponse,
|
|
3145
|
+
parse_obj_as(
|
|
3146
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3147
|
+
object_=_response.json(),
|
|
3148
|
+
),
|
|
3149
|
+
),
|
|
3150
|
+
)
|
|
3151
|
+
_response_json = _response.json()
|
|
3152
|
+
except JSONDecodeError:
|
|
3153
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
3154
|
+
except ValidationError as e:
|
|
3155
|
+
raise ParsingError(
|
|
3156
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
3157
|
+
)
|
|
3158
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
3159
|
+
|
|
3160
|
+
async def set_publish_state(
|
|
3161
|
+
self,
|
|
3162
|
+
network_id: int,
|
|
3163
|
+
*,
|
|
3164
|
+
idempotency_key: str,
|
|
3165
|
+
published: bool,
|
|
3166
|
+
unpublish_drain_until: typing.Optional[dt.datetime] = OMIT,
|
|
3167
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
3168
|
+
) -> AsyncHttpResponse[NetworkResponse]:
|
|
3169
|
+
"""
|
|
3170
|
+
Published base networks can be ranked by other workspaces. When withdrawing, ``unpublish_drain_until`` keeps their access until then.
|
|
3171
|
+
|
|
3172
|
+
Parameters
|
|
3173
|
+
----------
|
|
3174
|
+
network_id : int
|
|
3175
|
+
The network's ``network_id``.
|
|
3176
|
+
|
|
3177
|
+
idempotency_key : str
|
|
3178
|
+
A unique key you choose for this call, e.g. a UUID. Retrying with the same key returns the first result instead of acting twice.
|
|
3179
|
+
|
|
3180
|
+
published : bool
|
|
3181
|
+
|
|
3182
|
+
unpublish_drain_until : typing.Optional[dt.datetime]
|
|
3183
|
+
|
|
3184
|
+
request_options : typing.Optional[RequestOptions]
|
|
3185
|
+
Request-specific configuration.
|
|
3186
|
+
|
|
3187
|
+
Returns
|
|
3188
|
+
-------
|
|
3189
|
+
AsyncHttpResponse[NetworkResponse]
|
|
3190
|
+
The network after the change.
|
|
3191
|
+
"""
|
|
3192
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
3193
|
+
f"emsp/networks/{encode_path_param(network_id)}/publish-state",
|
|
3194
|
+
method="PATCH",
|
|
3195
|
+
json={
|
|
3196
|
+
"published": published,
|
|
3197
|
+
"unpublish_drain_until": unpublish_drain_until,
|
|
3198
|
+
},
|
|
3199
|
+
headers={
|
|
3200
|
+
"content-type": "application/json",
|
|
3201
|
+
"Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None,
|
|
3202
|
+
},
|
|
3203
|
+
request_options=request_options,
|
|
3204
|
+
omit=OMIT,
|
|
3205
|
+
)
|
|
3206
|
+
try:
|
|
3207
|
+
if 200 <= _response.status_code < 300:
|
|
3208
|
+
_data = typing.cast(
|
|
3209
|
+
NetworkResponse,
|
|
3210
|
+
parse_obj_as(
|
|
3211
|
+
type_=NetworkResponse, # type: ignore
|
|
3212
|
+
object_=_response.json(),
|
|
3213
|
+
),
|
|
3214
|
+
)
|
|
3215
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
3216
|
+
if _response.status_code == 400:
|
|
3217
|
+
raise BadRequestError(
|
|
3218
|
+
headers=dict(_response.headers),
|
|
3219
|
+
body=typing.cast(
|
|
3220
|
+
HttpErrorResponse,
|
|
3221
|
+
parse_obj_as(
|
|
3222
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3223
|
+
object_=_response.json(),
|
|
3224
|
+
),
|
|
3225
|
+
),
|
|
3226
|
+
)
|
|
3227
|
+
if _response.status_code == 401:
|
|
3228
|
+
raise UnauthorizedError(
|
|
3229
|
+
headers=dict(_response.headers),
|
|
3230
|
+
body=typing.cast(
|
|
3231
|
+
HttpErrorResponse,
|
|
3232
|
+
parse_obj_as(
|
|
3233
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3234
|
+
object_=_response.json(),
|
|
3235
|
+
),
|
|
3236
|
+
),
|
|
3237
|
+
)
|
|
3238
|
+
if _response.status_code == 404:
|
|
3239
|
+
raise NotFoundError(
|
|
3240
|
+
headers=dict(_response.headers),
|
|
3241
|
+
body=typing.cast(
|
|
3242
|
+
HttpErrorResponse,
|
|
3243
|
+
parse_obj_as(
|
|
3244
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3245
|
+
object_=_response.json(),
|
|
3246
|
+
),
|
|
3247
|
+
),
|
|
3248
|
+
)
|
|
3249
|
+
if _response.status_code == 409:
|
|
3250
|
+
raise ConflictError(
|
|
3251
|
+
headers=dict(_response.headers),
|
|
3252
|
+
body=typing.cast(
|
|
3253
|
+
HttpErrorResponse,
|
|
3254
|
+
parse_obj_as(
|
|
3255
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3256
|
+
object_=_response.json(),
|
|
3257
|
+
),
|
|
3258
|
+
),
|
|
3259
|
+
)
|
|
3260
|
+
if _response.status_code == 422:
|
|
3261
|
+
raise UnprocessableEntityError(
|
|
3262
|
+
headers=dict(_response.headers),
|
|
3263
|
+
body=typing.cast(
|
|
3264
|
+
HttpValidationError,
|
|
3265
|
+
parse_obj_as(
|
|
3266
|
+
type_=HttpValidationError, # type: ignore
|
|
3267
|
+
object_=_response.json(),
|
|
3268
|
+
),
|
|
3269
|
+
),
|
|
3270
|
+
)
|
|
3271
|
+
if _response.status_code == 429:
|
|
3272
|
+
raise TooManyRequestsError(
|
|
3273
|
+
headers=dict(_response.headers),
|
|
3274
|
+
body=typing.cast(
|
|
3275
|
+
HttpErrorResponse,
|
|
3276
|
+
parse_obj_as(
|
|
3277
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3278
|
+
object_=_response.json(),
|
|
3279
|
+
),
|
|
3280
|
+
),
|
|
3281
|
+
)
|
|
3282
|
+
if _response.status_code == 502:
|
|
3283
|
+
raise BadGatewayError(
|
|
3284
|
+
headers=dict(_response.headers),
|
|
3285
|
+
body=typing.cast(
|
|
3286
|
+
HttpErrorResponse,
|
|
3287
|
+
parse_obj_as(
|
|
3288
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3289
|
+
object_=_response.json(),
|
|
3290
|
+
),
|
|
3291
|
+
),
|
|
3292
|
+
)
|
|
3293
|
+
if _response.status_code == 504:
|
|
3294
|
+
raise GatewayTimeoutError(
|
|
3295
|
+
headers=dict(_response.headers),
|
|
3296
|
+
body=typing.cast(
|
|
3297
|
+
HttpErrorResponse,
|
|
3298
|
+
parse_obj_as(
|
|
3299
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3300
|
+
object_=_response.json(),
|
|
3301
|
+
),
|
|
3302
|
+
),
|
|
3303
|
+
)
|
|
3304
|
+
_response_json = _response.json()
|
|
3305
|
+
except JSONDecodeError:
|
|
3306
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
3307
|
+
except ValidationError as e:
|
|
3308
|
+
raise ParsingError(
|
|
3309
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
3310
|
+
)
|
|
3311
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
3312
|
+
|
|
3313
|
+
async def list_rules(
|
|
3314
|
+
self,
|
|
3315
|
+
network_id: int,
|
|
3316
|
+
*,
|
|
3317
|
+
validity: typing.Optional[ListRulesNetworksRequestValidity] = None,
|
|
3318
|
+
after: typing.Optional[str] = None,
|
|
3319
|
+
limit: typing.Optional[int] = None,
|
|
3320
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
3321
|
+
) -> AsyncPager[NetworkRuleResponse, NetworkRulePage]:
|
|
3322
|
+
"""
|
|
3323
|
+
With no rules a network shows every location of its CPOs.
|
|
3324
|
+
|
|
3325
|
+
Parameters
|
|
3326
|
+
----------
|
|
3327
|
+
network_id : int
|
|
3328
|
+
The network's ``network_id``.
|
|
3329
|
+
|
|
3330
|
+
validity : typing.Optional[ListRulesNetworksRequestValidity]
|
|
3331
|
+
Only rules in effect now (ACTIVE), later, or ended; default ALL.
|
|
3332
|
+
|
|
3333
|
+
after : typing.Optional[str]
|
|
3334
|
+
Cursor: the previous page's ``pagination.end_cursor``. Omit it for the first page.
|
|
3335
|
+
|
|
3336
|
+
limit : typing.Optional[int]
|
|
3337
|
+
Maximum rows per page (default 50, max 200).
|
|
3338
|
+
|
|
3339
|
+
request_options : typing.Optional[RequestOptions]
|
|
3340
|
+
Request-specific configuration.
|
|
3341
|
+
|
|
3342
|
+
Returns
|
|
3343
|
+
-------
|
|
3344
|
+
AsyncPager[NetworkRuleResponse, NetworkRulePage]
|
|
3345
|
+
One page of access rules.
|
|
3346
|
+
"""
|
|
3347
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
3348
|
+
f"emsp/networks/{encode_path_param(network_id)}/rules",
|
|
3349
|
+
method="GET",
|
|
3350
|
+
params={
|
|
3351
|
+
"validity": validity,
|
|
3352
|
+
"after": after,
|
|
3353
|
+
"limit": limit,
|
|
3354
|
+
},
|
|
3355
|
+
request_options=request_options,
|
|
3356
|
+
)
|
|
3357
|
+
try:
|
|
3358
|
+
if 200 <= _response.status_code < 300:
|
|
3359
|
+
_parsed_response = typing.cast(
|
|
3360
|
+
NetworkRulePage,
|
|
3361
|
+
parse_obj_as(
|
|
3362
|
+
type_=NetworkRulePage, # type: ignore
|
|
3363
|
+
object_=_response.json(),
|
|
3364
|
+
),
|
|
3365
|
+
)
|
|
3366
|
+
_items = _parsed_response.data
|
|
3367
|
+
_has_next = False
|
|
3368
|
+
_get_next = None
|
|
3369
|
+
if _parsed_response.pagination is not None:
|
|
3370
|
+
_parsed_next = _parsed_response.pagination.end_cursor
|
|
3371
|
+
_has_next = _parsed_next is not None and _parsed_next != ""
|
|
3372
|
+
|
|
3373
|
+
async def _get_next():
|
|
3374
|
+
return await self.list_rules(
|
|
3375
|
+
network_id,
|
|
3376
|
+
validity=validity,
|
|
3377
|
+
after=_parsed_next,
|
|
3378
|
+
limit=limit,
|
|
3379
|
+
request_options=request_options,
|
|
3380
|
+
)
|
|
3381
|
+
|
|
3382
|
+
return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
|
|
3383
|
+
if _response.status_code == 401:
|
|
3384
|
+
raise UnauthorizedError(
|
|
3385
|
+
headers=dict(_response.headers),
|
|
3386
|
+
body=typing.cast(
|
|
3387
|
+
HttpErrorResponse,
|
|
3388
|
+
parse_obj_as(
|
|
3389
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3390
|
+
object_=_response.json(),
|
|
3391
|
+
),
|
|
3392
|
+
),
|
|
3393
|
+
)
|
|
3394
|
+
if _response.status_code == 404:
|
|
3395
|
+
raise NotFoundError(
|
|
3396
|
+
headers=dict(_response.headers),
|
|
3397
|
+
body=typing.cast(
|
|
3398
|
+
HttpErrorResponse,
|
|
3399
|
+
parse_obj_as(
|
|
3400
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3401
|
+
object_=_response.json(),
|
|
3402
|
+
),
|
|
3403
|
+
),
|
|
3404
|
+
)
|
|
3405
|
+
if _response.status_code == 422:
|
|
3406
|
+
raise UnprocessableEntityError(
|
|
3407
|
+
headers=dict(_response.headers),
|
|
3408
|
+
body=typing.cast(
|
|
3409
|
+
HttpValidationError,
|
|
3410
|
+
parse_obj_as(
|
|
3411
|
+
type_=HttpValidationError, # type: ignore
|
|
3412
|
+
object_=_response.json(),
|
|
3413
|
+
),
|
|
3414
|
+
),
|
|
3415
|
+
)
|
|
3416
|
+
if _response.status_code == 429:
|
|
3417
|
+
raise TooManyRequestsError(
|
|
3418
|
+
headers=dict(_response.headers),
|
|
3419
|
+
body=typing.cast(
|
|
3420
|
+
HttpErrorResponse,
|
|
3421
|
+
parse_obj_as(
|
|
3422
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3423
|
+
object_=_response.json(),
|
|
3424
|
+
),
|
|
3425
|
+
),
|
|
3426
|
+
)
|
|
3427
|
+
if _response.status_code == 502:
|
|
3428
|
+
raise BadGatewayError(
|
|
3429
|
+
headers=dict(_response.headers),
|
|
3430
|
+
body=typing.cast(
|
|
3431
|
+
HttpErrorResponse,
|
|
3432
|
+
parse_obj_as(
|
|
3433
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3434
|
+
object_=_response.json(),
|
|
3435
|
+
),
|
|
3436
|
+
),
|
|
3437
|
+
)
|
|
3438
|
+
if _response.status_code == 504:
|
|
3439
|
+
raise GatewayTimeoutError(
|
|
3440
|
+
headers=dict(_response.headers),
|
|
3441
|
+
body=typing.cast(
|
|
3442
|
+
HttpErrorResponse,
|
|
3443
|
+
parse_obj_as(
|
|
3444
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3445
|
+
object_=_response.json(),
|
|
3446
|
+
),
|
|
3447
|
+
),
|
|
3448
|
+
)
|
|
3449
|
+
_response_json = _response.json()
|
|
3450
|
+
except JSONDecodeError:
|
|
3451
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
3452
|
+
except ValidationError as e:
|
|
3453
|
+
raise ParsingError(
|
|
3454
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
3455
|
+
)
|
|
3456
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
3457
|
+
|
|
3458
|
+
async def create_rule(
|
|
3459
|
+
self,
|
|
3460
|
+
network_id: int,
|
|
3461
|
+
*,
|
|
3462
|
+
idempotency_key: str,
|
|
3463
|
+
rule_type: NetworkRuleCreateRequestRuleType,
|
|
3464
|
+
location_ids: typing.Sequence[str],
|
|
3465
|
+
priority: typing.Optional[int] = OMIT,
|
|
3466
|
+
effective_from: typing.Optional[dt.datetime] = OMIT,
|
|
3467
|
+
effective_until: typing.Optional[dt.datetime] = OMIT,
|
|
3468
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
3469
|
+
) -> AsyncHttpResponse[NetworkRuleResponse]:
|
|
3470
|
+
"""
|
|
3471
|
+
INCLUDE shows only the listed locations, EXCLUDE hides them, optionally within an ``effective_from``/``effective_until`` window.
|
|
3472
|
+
|
|
3473
|
+
Parameters
|
|
3474
|
+
----------
|
|
3475
|
+
network_id : int
|
|
3476
|
+
The network's ``network_id``.
|
|
3477
|
+
|
|
3478
|
+
idempotency_key : str
|
|
3479
|
+
A unique key you choose for this call, e.g. a UUID. Retrying with the same key returns the first result instead of acting twice.
|
|
3480
|
+
|
|
3481
|
+
rule_type : NetworkRuleCreateRequestRuleType
|
|
3482
|
+
|
|
3483
|
+
location_ids : typing.Sequence[str]
|
|
3484
|
+
|
|
3485
|
+
priority : typing.Optional[int]
|
|
3486
|
+
|
|
3487
|
+
effective_from : typing.Optional[dt.datetime]
|
|
3488
|
+
|
|
3489
|
+
effective_until : typing.Optional[dt.datetime]
|
|
3490
|
+
|
|
3491
|
+
request_options : typing.Optional[RequestOptions]
|
|
3492
|
+
Request-specific configuration.
|
|
3493
|
+
|
|
3494
|
+
Returns
|
|
3495
|
+
-------
|
|
3496
|
+
AsyncHttpResponse[NetworkRuleResponse]
|
|
3497
|
+
The created rule.
|
|
3498
|
+
"""
|
|
3499
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
3500
|
+
f"emsp/networks/{encode_path_param(network_id)}/rules",
|
|
3501
|
+
method="POST",
|
|
3502
|
+
json={
|
|
3503
|
+
"rule_type": rule_type,
|
|
3504
|
+
"location_ids": location_ids,
|
|
3505
|
+
"priority": priority,
|
|
3506
|
+
"effective_from": effective_from,
|
|
3507
|
+
"effective_until": effective_until,
|
|
3508
|
+
},
|
|
3509
|
+
headers={
|
|
3510
|
+
"content-type": "application/json",
|
|
3511
|
+
"Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None,
|
|
3512
|
+
},
|
|
3513
|
+
request_options=request_options,
|
|
3514
|
+
omit=OMIT,
|
|
3515
|
+
)
|
|
3516
|
+
try:
|
|
3517
|
+
if 200 <= _response.status_code < 300:
|
|
3518
|
+
_data = typing.cast(
|
|
3519
|
+
NetworkRuleResponse,
|
|
3520
|
+
parse_obj_as(
|
|
3521
|
+
type_=NetworkRuleResponse, # type: ignore
|
|
3522
|
+
object_=_response.json(),
|
|
3523
|
+
),
|
|
3524
|
+
)
|
|
3525
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
3526
|
+
if _response.status_code == 400:
|
|
3527
|
+
raise BadRequestError(
|
|
3528
|
+
headers=dict(_response.headers),
|
|
3529
|
+
body=typing.cast(
|
|
3530
|
+
HttpErrorResponse,
|
|
3531
|
+
parse_obj_as(
|
|
3532
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3533
|
+
object_=_response.json(),
|
|
3534
|
+
),
|
|
3535
|
+
),
|
|
3536
|
+
)
|
|
3537
|
+
if _response.status_code == 401:
|
|
3538
|
+
raise UnauthorizedError(
|
|
3539
|
+
headers=dict(_response.headers),
|
|
3540
|
+
body=typing.cast(
|
|
3541
|
+
HttpErrorResponse,
|
|
3542
|
+
parse_obj_as(
|
|
3543
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3544
|
+
object_=_response.json(),
|
|
3545
|
+
),
|
|
3546
|
+
),
|
|
3547
|
+
)
|
|
3548
|
+
if _response.status_code == 404:
|
|
3549
|
+
raise NotFoundError(
|
|
3550
|
+
headers=dict(_response.headers),
|
|
3551
|
+
body=typing.cast(
|
|
3552
|
+
HttpErrorResponse,
|
|
3553
|
+
parse_obj_as(
|
|
3554
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3555
|
+
object_=_response.json(),
|
|
3556
|
+
),
|
|
3557
|
+
),
|
|
3558
|
+
)
|
|
3559
|
+
if _response.status_code == 409:
|
|
3560
|
+
raise ConflictError(
|
|
3561
|
+
headers=dict(_response.headers),
|
|
3562
|
+
body=typing.cast(
|
|
3563
|
+
HttpErrorResponse,
|
|
3564
|
+
parse_obj_as(
|
|
3565
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3566
|
+
object_=_response.json(),
|
|
3567
|
+
),
|
|
3568
|
+
),
|
|
3569
|
+
)
|
|
3570
|
+
if _response.status_code == 422:
|
|
3571
|
+
raise UnprocessableEntityError(
|
|
3572
|
+
headers=dict(_response.headers),
|
|
3573
|
+
body=typing.cast(
|
|
3574
|
+
HttpValidationError,
|
|
3575
|
+
parse_obj_as(
|
|
3576
|
+
type_=HttpValidationError, # type: ignore
|
|
3577
|
+
object_=_response.json(),
|
|
3578
|
+
),
|
|
3579
|
+
),
|
|
3580
|
+
)
|
|
3581
|
+
if _response.status_code == 429:
|
|
3582
|
+
raise TooManyRequestsError(
|
|
3583
|
+
headers=dict(_response.headers),
|
|
3584
|
+
body=typing.cast(
|
|
3585
|
+
HttpErrorResponse,
|
|
3586
|
+
parse_obj_as(
|
|
3587
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3588
|
+
object_=_response.json(),
|
|
3589
|
+
),
|
|
3590
|
+
),
|
|
3591
|
+
)
|
|
3592
|
+
if _response.status_code == 502:
|
|
3593
|
+
raise BadGatewayError(
|
|
3594
|
+
headers=dict(_response.headers),
|
|
3595
|
+
body=typing.cast(
|
|
3596
|
+
HttpErrorResponse,
|
|
3597
|
+
parse_obj_as(
|
|
3598
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3599
|
+
object_=_response.json(),
|
|
3600
|
+
),
|
|
3601
|
+
),
|
|
3602
|
+
)
|
|
3603
|
+
if _response.status_code == 504:
|
|
3604
|
+
raise GatewayTimeoutError(
|
|
3605
|
+
headers=dict(_response.headers),
|
|
3606
|
+
body=typing.cast(
|
|
3607
|
+
HttpErrorResponse,
|
|
3608
|
+
parse_obj_as(
|
|
3609
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3610
|
+
object_=_response.json(),
|
|
3611
|
+
),
|
|
3612
|
+
),
|
|
3613
|
+
)
|
|
3614
|
+
_response_json = _response.json()
|
|
3615
|
+
except JSONDecodeError:
|
|
3616
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
3617
|
+
except ValidationError as e:
|
|
3618
|
+
raise ParsingError(
|
|
3619
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
3620
|
+
)
|
|
3621
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
3622
|
+
|
|
3623
|
+
async def delete_rule(
|
|
3624
|
+
self, network_id: int, rule_id: int, *, request_options: typing.Optional[RequestOptions] = None
|
|
3625
|
+
) -> AsyncHttpResponse[None]:
|
|
3626
|
+
"""
|
|
3627
|
+
Removes one access rule; the network's other rules stay in force.
|
|
3628
|
+
|
|
3629
|
+
Parameters
|
|
3630
|
+
----------
|
|
3631
|
+
network_id : int
|
|
3632
|
+
The network's ``network_id``.
|
|
3633
|
+
|
|
3634
|
+
rule_id : int
|
|
3635
|
+
The access rule's ``rule_id``.
|
|
3636
|
+
|
|
3637
|
+
request_options : typing.Optional[RequestOptions]
|
|
3638
|
+
Request-specific configuration.
|
|
3639
|
+
|
|
3640
|
+
Returns
|
|
3641
|
+
-------
|
|
3642
|
+
AsyncHttpResponse[None]
|
|
3643
|
+
"""
|
|
3644
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
3645
|
+
f"emsp/networks/{encode_path_param(network_id)}/rules/{encode_path_param(rule_id)}",
|
|
3646
|
+
method="DELETE",
|
|
3647
|
+
request_options=request_options,
|
|
3648
|
+
)
|
|
3649
|
+
try:
|
|
3650
|
+
if 200 <= _response.status_code < 300:
|
|
3651
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
3652
|
+
if _response.status_code == 401:
|
|
3653
|
+
raise UnauthorizedError(
|
|
3654
|
+
headers=dict(_response.headers),
|
|
3655
|
+
body=typing.cast(
|
|
3656
|
+
HttpErrorResponse,
|
|
3657
|
+
parse_obj_as(
|
|
3658
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3659
|
+
object_=_response.json(),
|
|
3660
|
+
),
|
|
3661
|
+
),
|
|
3662
|
+
)
|
|
3663
|
+
if _response.status_code == 404:
|
|
3664
|
+
raise NotFoundError(
|
|
3665
|
+
headers=dict(_response.headers),
|
|
3666
|
+
body=typing.cast(
|
|
3667
|
+
HttpErrorResponse,
|
|
3668
|
+
parse_obj_as(
|
|
3669
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3670
|
+
object_=_response.json(),
|
|
3671
|
+
),
|
|
3672
|
+
),
|
|
3673
|
+
)
|
|
3674
|
+
if _response.status_code == 422:
|
|
3675
|
+
raise UnprocessableEntityError(
|
|
3676
|
+
headers=dict(_response.headers),
|
|
3677
|
+
body=typing.cast(
|
|
3678
|
+
HttpValidationError,
|
|
3679
|
+
parse_obj_as(
|
|
3680
|
+
type_=HttpValidationError, # type: ignore
|
|
3681
|
+
object_=_response.json(),
|
|
3682
|
+
),
|
|
3683
|
+
),
|
|
3684
|
+
)
|
|
3685
|
+
if _response.status_code == 429:
|
|
3686
|
+
raise TooManyRequestsError(
|
|
3687
|
+
headers=dict(_response.headers),
|
|
3688
|
+
body=typing.cast(
|
|
3689
|
+
HttpErrorResponse,
|
|
3690
|
+
parse_obj_as(
|
|
3691
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3692
|
+
object_=_response.json(),
|
|
3693
|
+
),
|
|
3694
|
+
),
|
|
3695
|
+
)
|
|
3696
|
+
if _response.status_code == 502:
|
|
3697
|
+
raise BadGatewayError(
|
|
3698
|
+
headers=dict(_response.headers),
|
|
3699
|
+
body=typing.cast(
|
|
3700
|
+
HttpErrorResponse,
|
|
3701
|
+
parse_obj_as(
|
|
3702
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3703
|
+
object_=_response.json(),
|
|
3704
|
+
),
|
|
3705
|
+
),
|
|
3706
|
+
)
|
|
3707
|
+
if _response.status_code == 504:
|
|
3708
|
+
raise GatewayTimeoutError(
|
|
3709
|
+
headers=dict(_response.headers),
|
|
3710
|
+
body=typing.cast(
|
|
3711
|
+
HttpErrorResponse,
|
|
3712
|
+
parse_obj_as(
|
|
3713
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3714
|
+
object_=_response.json(),
|
|
3715
|
+
),
|
|
3716
|
+
),
|
|
3717
|
+
)
|
|
3718
|
+
_response_json = _response.json()
|
|
3719
|
+
except JSONDecodeError:
|
|
3720
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
3721
|
+
except ValidationError as e:
|
|
3722
|
+
raise ParsingError(
|
|
3723
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
3724
|
+
)
|
|
3725
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|