From a62f347156b62a684e940070eadfc3d3ec342a06 Mon Sep 17 00:00:00 2001 From: Nils Ponsard | Nitrokey Date: Thu, 28 Sep 2023 10:52:15 +0200 Subject: [PATCH] feat: use the nethsm-sdk-py lib --- Makefile | 18 +- docs/developer-guide.rst | 27 +- nethsm-api.yaml | 2595 ----------------- pynitrokey/cli/nethsm.py | 49 +- pynitrokey/nethsm/__init__.py | 1312 --------- pynitrokey/nethsm/client/__init__.py | 26 - pynitrokey/nethsm/client/api_client.py | 1419 --------- pynitrokey/nethsm/client/api_response.py | 28 - pynitrokey/nethsm/client/apis/__init__.py | 3 - pynitrokey/nethsm/client/apis/path_to_api.py | 143 - .../nethsm/client/apis/paths/__init__.py | 3 - .../apis/paths/config_backup_passphrase.py | 13 - .../client/apis/paths/config_logging.py | 15 - .../client/apis/paths/config_network.py | 15 - .../nethsm/client/apis/paths/config_time.py | 15 - .../client/apis/paths/config_tls_cert_pem.py | 15 - .../client/apis/paths/config_tls_csr_pem.py | 13 - .../client/apis/paths/config_tls_generate.py | 13 - .../apis/paths/config_tls_public_pem.py | 13 - .../apis/paths/config_unattended_boot.py | 15 - .../apis/paths/config_unlock_passphrase.py | 13 - .../nethsm/client/apis/paths/health_alive.py | 13 - .../nethsm/client/apis/paths/health_ready.py | 13 - .../nethsm/client/apis/paths/health_state.py | 13 - pynitrokey/nethsm/client/apis/paths/info.py | 13 - pynitrokey/nethsm/client/apis/paths/keys.py | 15 - .../nethsm/client/apis/paths/keys_generate.py | 13 - .../nethsm/client/apis/paths/keys_key_id.py | 17 - .../client/apis/paths/keys_key_id_cert.py | 17 - .../client/apis/paths/keys_key_id_csr_pem.py | 13 - .../client/apis/paths/keys_key_id_decrypt.py | 13 - .../client/apis/paths/keys_key_id_encrypt.py | 13 - .../apis/paths/keys_key_id_public_pem.py | 13 - .../keys_key_id_restrictions_tags_tag.py | 15 - .../client/apis/paths/keys_key_id_sign.py | 13 - pynitrokey/nethsm/client/apis/paths/lock.py | 13 - .../nethsm/client/apis/paths/metrics.py | 13 - .../nethsm/client/apis/paths/provision.py | 13 - pynitrokey/nethsm/client/apis/paths/random.py | 13 - .../nethsm/client/apis/paths/system_backup.py | 13 - .../client/apis/paths/system_cancel_update.py | 13 - .../client/apis/paths/system_commit_update.py | 13 - .../client/apis/paths/system_factory_reset.py | 13 - .../nethsm/client/apis/paths/system_info.py | 13 - .../nethsm/client/apis/paths/system_reboot.py | 13 - .../client/apis/paths/system_restore.py | 13 - .../client/apis/paths/system_shutdown.py | 13 - .../nethsm/client/apis/paths/system_update.py | 13 - pynitrokey/nethsm/client/apis/paths/unlock.py | 13 - pynitrokey/nethsm/client/apis/paths/users.py | 15 - .../nethsm/client/apis/paths/users_user_id.py | 17 - .../apis/paths/users_user_id_passphrase.py | 13 - .../client/apis/paths/users_user_id_tags.py | 13 - .../apis/paths/users_user_id_tags_tag.py | 15 - pynitrokey/nethsm/client/apis/tag_to_api.py | 17 - .../nethsm/client/apis/tags/__init__.py | 3 - .../nethsm/client/apis/tags/default_api.py | 132 - .../nethsm/client/components/__init__.py | 0 .../components/request_bodies/__init__.py | 0 .../client/components/responses/__init__.py | 0 .../client/components/schema/__init__.py | 5 - .../schema/backup_passphrase_config.py | 103 - .../nethsm/client/components/schema/base64.py | 29 - .../client/components/schema/decrypt_data.py | 103 - .../client/components/schema/decrypt_mode.py | 183 -- .../components/schema/decrypt_request_data.py | 148 - .../components/schema/distinguished_name.py | 216 -- .../client/components/schema/encrypt_data.py | 116 - .../client/components/schema/encrypt_mode.py | 71 - .../components/schema/encrypt_request_data.py | 140 - .../components/schema/health_state_data.py | 107 - .../nethsm/client/components/schema/id.py | 31 - .../client/components/schema/info_data.py | 116 - .../schema/key_generate_request_data.py | 199 -- .../client/components/schema/key_item.py | 103 - .../client/components/schema/key_list.py | 75 - .../client/components/schema/key_mechanism.py | 323 -- .../components/schema/key_mechanisms.py | 109 - .../components/schema/key_private_data.py | 162 - .../components/schema/key_public_data.py | 149 - .../components/schema/key_restrictions.py | 111 - .../client/components/schema/key_type.py | 155 - .../client/components/schema/log_level.py | 113 - .../components/schema/logging_config.py | 134 - .../client/components/schema/metrics_data.py | 13 - .../components/schema/network_config.py | 129 - .../client/components/schema/passphrase.py | 27 - .../client/components/schema/pem_cert.py | 13 - .../client/components/schema/pem_csr.py | 13 - .../components/schema/pem_private_key.py | 13 - .../components/schema/pem_public_key.py | 13 - .../components/schema/pgp_private_key.py | 13 - .../client/components/schema/private_key.py | 168 -- .../schema/provision_request_data.py | 132 - .../client/components/schema/public_key.py | 181 -- .../client/components/schema/random_data.py | 103 - .../components/schema/random_request_data.py | 114 - .../client/components/schema/sign_data.py | 103 - .../client/components/schema/sign_mode.py | 183 -- .../components/schema/sign_request_data.py | 127 - .../nethsm/client/components/schema/switch.py | 85 - .../client/components/schema/system_info.py | 187 -- .../client/components/schema/system_state.py | 99 - .../components/schema/system_update_data.py | 103 - .../client/components/schema/tag_list.py | 69 - .../client/components/schema/time_config.py | 106 - .../schema/tls_key_generate_request_data.py | 145 - .../client/components/schema/tls_key_type.py | 141 - .../schema/unattended_boot_config.py | 106 - .../schema/unlock_passphrase_config.py | 103 - .../components/schema/unlock_request_data.py | 103 - .../client/components/schema/user_data.py | 121 - .../client/components/schema/user_item.py | 103 - .../client/components/schema/user_list.py | 75 - .../schema/user_passphrase_post_data.py | 103 - .../components/schema/user_post_data.py | 135 - .../client/components/schema/user_role.py | 113 - .../client/components/schemas/__init__.py | 69 - .../components/security_schemes/__init__.py | 0 .../security_schemes/security_scheme_basic.py | 14 - .../nethsm/client/configurations/__init__.py | 0 .../configurations/api_configuration.py | 441 --- .../configurations/schema_configuration.py | 105 - pynitrokey/nethsm/client/exceptions.py | 132 - pynitrokey/nethsm/client/paths/__init__.py | 3 - .../config_backup_passphrase/__init__.py | 5 - .../config_backup_passphrase/put/__init__.py | 0 .../config_backup_passphrase/put/operation.py | 188 -- .../put/request_body/__init__.py | 20 - .../put/request_body/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../put/responses/__init__.py | 0 .../put/responses/response_204/__init__.py | 20 - .../put/responses/response_400/__init__.py | 20 - .../put/responses/response_401/__init__.py | 20 - .../put/responses/response_403/__init__.py | 20 - .../put/responses/response_406/__init__.py | 20 - .../put/responses/response_412/__init__.py | 20 - .../put/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../client/paths/config_logging/__init__.py | 5 - .../paths/config_logging/get/__init__.py | 0 .../paths/config_logging/get/operation.py | 164 -- .../config_logging/get/responses/__init__.py | 0 .../get/responses/response_200/__init__.py | 29 - .../response_200/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../get/responses/response_401/__init__.py | 20 - .../get/responses/response_403/__init__.py | 20 - .../get/responses/response_406/__init__.py | 20 - .../get/responses/response_412/__init__.py | 20 - .../config_logging/get/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../paths/config_logging/put/__init__.py | 0 .../paths/config_logging/put/operation.py | 188 -- .../put/request_body/__init__.py | 20 - .../put/request_body/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../config_logging/put/responses/__init__.py | 0 .../put/responses/response_204/__init__.py | 20 - .../put/responses/response_400/__init__.py | 20 - .../put/responses/response_401/__init__.py | 20 - .../put/responses/response_403/__init__.py | 20 - .../put/responses/response_406/__init__.py | 20 - .../put/responses/response_412/__init__.py | 20 - .../config_logging/put/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../client/paths/config_network/__init__.py | 5 - .../paths/config_network/get/__init__.py | 0 .../paths/config_network/get/operation.py | 164 -- .../config_network/get/responses/__init__.py | 0 .../get/responses/response_200/__init__.py | 29 - .../response_200/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../get/responses/response_401/__init__.py | 20 - .../get/responses/response_403/__init__.py | 20 - .../get/responses/response_406/__init__.py | 20 - .../get/responses/response_412/__init__.py | 20 - .../config_network/get/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../paths/config_network/put/__init__.py | 0 .../paths/config_network/put/operation.py | 188 -- .../put/request_body/__init__.py | 20 - .../put/request_body/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../config_network/put/responses/__init__.py | 0 .../put/responses/response_204/__init__.py | 20 - .../put/responses/response_400/__init__.py | 20 - .../put/responses/response_401/__init__.py | 20 - .../put/responses/response_403/__init__.py | 20 - .../put/responses/response_406/__init__.py | 20 - .../put/responses/response_412/__init__.py | 20 - .../config_network/put/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../client/paths/config_time/__init__.py | 5 - .../client/paths/config_time/get/__init__.py | 0 .../client/paths/config_time/get/operation.py | 164 -- .../config_time/get/responses/__init__.py | 0 .../get/responses/response_200/__init__.py | 29 - .../response_200/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../get/responses/response_401/__init__.py | 20 - .../get/responses/response_403/__init__.py | 20 - .../get/responses/response_406/__init__.py | 20 - .../get/responses/response_412/__init__.py | 20 - .../config_time/get/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../client/paths/config_time/put/__init__.py | 0 .../client/paths/config_time/put/operation.py | 188 -- .../config_time/put/request_body/__init__.py | 20 - .../put/request_body/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../config_time/put/responses/__init__.py | 0 .../put/responses/response_204/__init__.py | 20 - .../put/responses/response_400/__init__.py | 20 - .../put/responses/response_401/__init__.py | 20 - .../put/responses/response_403/__init__.py | 20 - .../put/responses/response_406/__init__.py | 20 - .../put/responses/response_412/__init__.py | 20 - .../config_time/put/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../paths/config_tls_cert_pem/__init__.py | 5 - .../paths/config_tls_cert_pem/get/__init__.py | 0 .../config_tls_cert_pem/get/operation.py | 169 -- .../get/responses/__init__.py | 0 .../get/responses/response_200/__init__.py | 29 - .../response_200/content/__init__.py | 0 .../application_x_pem_file/__init__.py | 0 .../content/application_x_pem_file/schema.py | 13 - .../get/responses/response_401/__init__.py | 20 - .../get/responses/response_403/__init__.py | 20 - .../get/responses/response_406/__init__.py | 20 - .../get/responses/response_412/__init__.py | 20 - .../get/responses/response_415/__init__.py | 20 - .../get/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../paths/config_tls_cert_pem/put/__init__.py | 0 .../config_tls_cert_pem/put/operation.py | 179 -- .../put/request_body/__init__.py | 20 - .../put/request_body/content/__init__.py | 0 .../application_x_pem_file/__init__.py | 0 .../content/application_x_pem_file/schema.py | 13 - .../put/responses/__init__.py | 0 .../put/responses/response_201/__init__.py | 20 - .../put/responses/response_400/__init__.py | 20 - .../put/responses/response_401/__init__.py | 20 - .../put/responses/response_403/__init__.py | 20 - .../put/responses/response_406/__init__.py | 20 - .../put/responses/response_412/__init__.py | 20 - .../put/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../paths/config_tls_csr_pem/__init__.py | 5 - .../paths/config_tls_csr_pem/post/__init__.py | 0 .../config_tls_csr_pem/post/operation.py | 190 -- .../post/request_body/__init__.py | 20 - .../post/request_body/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../post/responses/__init__.py | 0 .../post/responses/response_200/__init__.py | 29 - .../response_200/content/__init__.py | 0 .../application_x_pem_file/__init__.py | 0 .../content/application_x_pem_file/schema.py | 13 - .../post/responses/response_401/__init__.py | 20 - .../post/responses/response_403/__init__.py | 20 - .../post/responses/response_406/__init__.py | 20 - .../post/responses/response_412/__init__.py | 20 - .../post/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../paths/config_tls_generate/__init__.py | 5 - .../config_tls_generate/post/__init__.py | 0 .../config_tls_generate/post/operation.py | 188 -- .../post/request_body/__init__.py | 20 - .../post/request_body/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../post/responses/__init__.py | 0 .../post/responses/response_204/__init__.py | 20 - .../post/responses/response_400/__init__.py | 20 - .../post/responses/response_401/__init__.py | 20 - .../post/responses/response_403/__init__.py | 20 - .../post/responses/response_406/__init__.py | 20 - .../post/responses/response_412/__init__.py | 20 - .../post/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../paths/config_tls_public_pem/__init__.py | 5 - .../config_tls_public_pem/get/__init__.py | 0 .../config_tls_public_pem/get/operation.py | 164 -- .../get/responses/__init__.py | 0 .../get/responses/response_200/__init__.py | 29 - .../response_200/content/__init__.py | 0 .../application_x_pem_file/__init__.py | 0 .../content/application_x_pem_file/schema.py | 13 - .../get/responses/response_401/__init__.py | 20 - .../get/responses/response_403/__init__.py | 20 - .../get/responses/response_406/__init__.py | 20 - .../get/responses/response_412/__init__.py | 20 - .../get/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../paths/config_unattended_boot/__init__.py | 5 - .../config_unattended_boot/get/__init__.py | 0 .../config_unattended_boot/get/operation.py | 164 -- .../get/responses/__init__.py | 0 .../get/responses/response_200/__init__.py | 29 - .../response_200/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../get/responses/response_401/__init__.py | 20 - .../get/responses/response_403/__init__.py | 20 - .../get/responses/response_406/__init__.py | 20 - .../get/responses/response_412/__init__.py | 20 - .../get/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../config_unattended_boot/put/__init__.py | 0 .../config_unattended_boot/put/operation.py | 188 -- .../put/request_body/__init__.py | 20 - .../put/request_body/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../put/responses/__init__.py | 0 .../put/responses/response_204/__init__.py | 20 - .../put/responses/response_400/__init__.py | 20 - .../put/responses/response_401/__init__.py | 20 - .../put/responses/response_403/__init__.py | 20 - .../put/responses/response_406/__init__.py | 20 - .../put/responses/response_412/__init__.py | 20 - .../put/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../config_unlock_passphrase/__init__.py | 5 - .../config_unlock_passphrase/put/__init__.py | 0 .../config_unlock_passphrase/put/operation.py | 188 -- .../put/request_body/__init__.py | 20 - .../put/request_body/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../put/responses/__init__.py | 0 .../put/responses/response_204/__init__.py | 20 - .../put/responses/response_400/__init__.py | 20 - .../put/responses/response_401/__init__.py | 20 - .../put/responses/response_403/__init__.py | 20 - .../put/responses/response_406/__init__.py | 20 - .../put/responses/response_412/__init__.py | 20 - .../put/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../client/paths/health_alive/__init__.py | 5 - .../client/paths/health_alive/get/__init__.py | 0 .../paths/health_alive/get/operation.py | 131 - .../health_alive/get/responses/__init__.py | 0 .../get/responses/response_200/__init__.py | 20 - .../get/responses/response_406/__init__.py | 20 - .../get/responses/response_412/__init__.py | 20 - .../client/paths/health_ready/__init__.py | 5 - .../client/paths/health_ready/get/__init__.py | 0 .../paths/health_ready/get/operation.py | 131 - .../health_ready/get/responses/__init__.py | 0 .../get/responses/response_200/__init__.py | 20 - .../get/responses/response_406/__init__.py | 20 - .../get/responses/response_412/__init__.py | 20 - .../client/paths/health_state/__init__.py | 5 - .../client/paths/health_state/get/__init__.py | 0 .../paths/health_state/get/operation.py | 135 - .../health_state/get/responses/__init__.py | 0 .../get/responses/response_200/__init__.py | 29 - .../response_200/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../get/responses/response_406/__init__.py | 20 - .../nethsm/client/paths/info/__init__.py | 5 - .../nethsm/client/paths/info/get/__init__.py | 0 .../nethsm/client/paths/info/get/operation.py | 135 - .../paths/info/get/responses/__init__.py | 0 .../get/responses/response_200/__init__.py | 29 - .../response_200/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../get/responses/response_406/__init__.py | 20 - .../nethsm/client/paths/keys/__init__.py | 5 - .../nethsm/client/paths/keys/get/__init__.py | 0 .../nethsm/client/paths/keys/get/operation.py | 192 -- .../paths/keys/get/parameters/__init__.py | 0 .../get/parameters/parameter_0/__init__.py | 16 - .../keys/get/parameters/parameter_0/schema.py | 13 - .../client/paths/keys/get/query_parameters.py | 108 - .../paths/keys/get/responses/__init__.py | 0 .../get/responses/response_200/__init__.py | 29 - .../response_200/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../get/responses/response_401/__init__.py | 20 - .../get/responses/response_403/__init__.py | 20 - .../get/responses/response_406/__init__.py | 20 - .../get/responses/response_412/__init__.py | 20 - .../paths/keys/get/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../nethsm/client/paths/keys/post/__init__.py | 0 .../client/paths/keys/post/operation.py | 263 -- .../paths/keys/post/parameters/__init__.py | 0 .../post/parameters/parameter_0/__init__.py | 16 - .../post/parameters/parameter_0/schema.py | 104 - .../post/parameters/parameter_1/__init__.py | 16 - .../post/parameters/parameter_1/schema.py | 64 - .../paths/keys/post/query_parameters.py | 134 - .../paths/keys/post/request_body/__init__.py | 26 - .../post/request_body/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../application_x_pem_file/__init__.py | 0 .../content/application_x_pem_file/schema.py | 13 - .../paths/keys/post/responses/__init__.py | 0 .../post/responses/response_201/__init__.py | 28 - .../response_201/header_parameters.py | 108 - .../response_201/headers/__init__.py | 0 .../headers/header_location/__init__.py | 14 - .../headers/header_location/schema.py | 13 - .../post/responses/response_400/__init__.py | 20 - .../post/responses/response_401/__init__.py | 20 - .../post/responses/response_403/__init__.py | 20 - .../post/responses/response_406/__init__.py | 20 - .../post/responses/response_412/__init__.py | 20 - .../paths/keys/post/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../client/paths/keys_generate/__init__.py | 5 - .../paths/keys_generate/post/__init__.py | 0 .../paths/keys_generate/post/operation.py | 188 -- .../post/request_body/__init__.py | 20 - .../post/request_body/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../keys_generate/post/responses/__init__.py | 0 .../post/responses/response_201/__init__.py | 28 - .../response_201/header_parameters.py | 108 - .../response_201/headers/__init__.py | 0 .../headers/header_location/__init__.py | 14 - .../headers/header_location/schema.py | 13 - .../post/responses/response_400/__init__.py | 20 - .../post/responses/response_401/__init__.py | 20 - .../post/responses/response_403/__init__.py | 20 - .../post/responses/response_406/__init__.py | 20 - .../post/responses/response_412/__init__.py | 20 - .../keys_generate/post/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../client/paths/keys_key_id/__init__.py | 5 - .../paths/keys_key_id/delete/__init__.py | 0 .../paths/keys_key_id/delete/operation.py | 183 -- .../keys_key_id/delete/parameters/__init__.py | 0 .../delete/parameters/parameter_0/__init__.py | 16 - .../delete/parameters/parameter_0/schema.py | 13 - .../keys_key_id/delete/path_parameters.py | 100 - .../keys_key_id/delete/responses/__init__.py | 0 .../delete/responses/response_204/__init__.py | 20 - .../delete/responses/response_401/__init__.py | 20 - .../delete/responses/response_403/__init__.py | 20 - .../delete/responses/response_404/__init__.py | 20 - .../delete/responses/response_406/__init__.py | 20 - .../delete/responses/response_412/__init__.py | 20 - .../keys_key_id/delete/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../client/paths/keys_key_id/get/__init__.py | 0 .../client/paths/keys_key_id/get/operation.py | 197 -- .../keys_key_id/get/parameters/__init__.py | 0 .../get/parameters/parameter_0/__init__.py | 16 - .../get/parameters/parameter_0/schema.py | 13 - .../paths/keys_key_id/get/path_parameters.py | 100 - .../keys_key_id/get/responses/__init__.py | 0 .../get/responses/response_200/__init__.py | 29 - .../response_200/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../get/responses/response_400/__init__.py | 20 - .../get/responses/response_401/__init__.py | 20 - .../get/responses/response_403/__init__.py | 20 - .../get/responses/response_404/__init__.py | 20 - .../get/responses/response_406/__init__.py | 20 - .../get/responses/response_412/__init__.py | 20 - .../keys_key_id/get/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../client/paths/keys_key_id/put/__init__.py | 0 .../client/paths/keys_key_id/put/operation.py | 296 -- .../keys_key_id/put/parameters/__init__.py | 0 .../put/parameters/parameter_0/__init__.py | 16 - .../put/parameters/parameter_0/schema.py | 104 - .../put/parameters/parameter_1/__init__.py | 16 - .../put/parameters/parameter_1/schema.py | 64 - .../put/parameters/parameter_2/__init__.py | 16 - .../put/parameters/parameter_2/schema.py | 13 - .../paths/keys_key_id/put/path_parameters.py | 100 - .../paths/keys_key_id/put/query_parameters.py | 134 - .../keys_key_id/put/request_body/__init__.py | 26 - .../put/request_body/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../application_x_pem_file/__init__.py | 0 .../content/application_x_pem_file/schema.py | 13 - .../keys_key_id/put/responses/__init__.py | 0 .../put/responses/response_204/__init__.py | 20 - .../put/responses/response_400/__init__.py | 20 - .../put/responses/response_401/__init__.py | 20 - .../put/responses/response_403/__init__.py | 20 - .../put/responses/response_406/__init__.py | 20 - .../put/responses/response_409/__init__.py | 20 - .../put/responses/response_412/__init__.py | 20 - .../keys_key_id/put/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../client/paths/keys_key_id_cert/__init__.py | 5 - .../paths/keys_key_id_cert/delete/__init__.py | 0 .../keys_key_id_cert/delete/operation.py | 188 -- .../delete/parameters/__init__.py | 0 .../delete/parameters/parameter_0/__init__.py | 16 - .../delete/parameters/parameter_0/schema.py | 13 - .../delete/path_parameters.py | 100 - .../delete/responses/__init__.py | 0 .../delete/responses/response_204/__init__.py | 20 - .../delete/responses/response_401/__init__.py | 20 - .../delete/responses/response_403/__init__.py | 20 - .../delete/responses/response_404/__init__.py | 20 - .../delete/responses/response_406/__init__.py | 20 - .../delete/responses/response_409/__init__.py | 20 - .../delete/responses/response_412/__init__.py | 20 - .../delete/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../paths/keys_key_id_cert/get/__init__.py | 0 .../paths/keys_key_id_cert/get/operation.py | 199 -- .../get/parameters/__init__.py | 0 .../get/parameters/parameter_0/__init__.py | 16 - .../get/parameters/parameter_0/schema.py | 13 - .../keys_key_id_cert/get/path_parameters.py | 100 - .../get/responses/__init__.py | 0 .../get/responses/response_200/__init__.py | 45 - .../response_200/content/__init__.py | 0 .../content/application_pgp_keys/__init__.py | 0 .../content/application_pgp_keys/schema.py | 13 - .../application_x_pem_file/__init__.py | 0 .../content/application_x_pem_file/schema.py | 13 - .../application_xx509_ca_cert/__init__.py | 0 .../application_xx509_ca_cert/schema.py | 13 - .../get/responses/response_400/__init__.py | 20 - .../get/responses/response_401/__init__.py | 20 - .../get/responses/response_403/__init__.py | 20 - .../get/responses/response_404/__init__.py | 20 - .../get/responses/response_406/__init__.py | 20 - .../get/responses/response_412/__init__.py | 20 - .../keys_key_id_cert/get/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../paths/keys_key_id_cert/put/__init__.py | 0 .../paths/keys_key_id_cert/put/operation.py | 280 -- .../put/parameters/__init__.py | 0 .../put/parameters/parameter_0/__init__.py | 16 - .../put/parameters/parameter_0/schema.py | 13 - .../keys_key_id_cert/put/path_parameters.py | 100 - .../put/request_body/__init__.py | 32 - .../put/request_body/content/__init__.py | 0 .../content/application_pgp_keys/__init__.py | 0 .../content/application_pgp_keys/schema.py | 13 - .../application_x_pem_file/__init__.py | 0 .../content/application_x_pem_file/schema.py | 13 - .../application_xx509_ca_cert/__init__.py | 0 .../application_xx509_ca_cert/schema.py | 13 - .../put/responses/__init__.py | 0 .../put/responses/response_201/__init__.py | 20 - .../put/responses/response_401/__init__.py | 20 - .../put/responses/response_403/__init__.py | 20 - .../put/responses/response_406/__init__.py | 20 - .../put/responses/response_409/__init__.py | 20 - .../put/responses/response_412/__init__.py | 20 - .../keys_key_id_cert/put/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../paths/keys_key_id_csr_pem/__init__.py | 5 - .../keys_key_id_csr_pem/post/__init__.py | 0 .../keys_key_id_csr_pem/post/operation.py | 223 -- .../post/parameters/__init__.py | 0 .../post/parameters/parameter_0/__init__.py | 16 - .../post/parameters/parameter_0/schema.py | 13 - .../post/path_parameters.py | 100 - .../post/request_body/__init__.py | 20 - .../post/request_body/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../post/responses/__init__.py | 0 .../post/responses/response_200/__init__.py | 29 - .../response_200/content/__init__.py | 0 .../application_x_pem_file/__init__.py | 0 .../content/application_x_pem_file/schema.py | 13 - .../post/responses/response_400/__init__.py | 20 - .../post/responses/response_401/__init__.py | 20 - .../post/responses/response_403/__init__.py | 20 - .../post/responses/response_404/__init__.py | 20 - .../post/responses/response_406/__init__.py | 20 - .../post/responses/response_412/__init__.py | 20 - .../post/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../paths/keys_key_id_decrypt/__init__.py | 5 - .../keys_key_id_decrypt/post/__init__.py | 0 .../keys_key_id_decrypt/post/operation.py | 223 -- .../post/parameters/__init__.py | 0 .../post/parameters/parameter_0/__init__.py | 16 - .../post/parameters/parameter_0/schema.py | 13 - .../post/path_parameters.py | 100 - .../post/request_body/__init__.py | 20 - .../post/request_body/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../post/responses/__init__.py | 0 .../post/responses/response_200/__init__.py | 29 - .../response_200/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../post/responses/response_400/__init__.py | 20 - .../post/responses/response_401/__init__.py | 20 - .../post/responses/response_403/__init__.py | 20 - .../post/responses/response_404/__init__.py | 20 - .../post/responses/response_406/__init__.py | 20 - .../post/responses/response_412/__init__.py | 20 - .../post/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../paths/keys_key_id_encrypt/__init__.py | 5 - .../keys_key_id_encrypt/post/__init__.py | 0 .../keys_key_id_encrypt/post/operation.py | 223 -- .../post/parameters/__init__.py | 0 .../post/parameters/parameter_0/__init__.py | 16 - .../post/parameters/parameter_0/schema.py | 13 - .../post/path_parameters.py | 100 - .../post/request_body/__init__.py | 20 - .../post/request_body/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../post/responses/__init__.py | 0 .../post/responses/response_200/__init__.py | 29 - .../response_200/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../post/responses/response_400/__init__.py | 20 - .../post/responses/response_401/__init__.py | 20 - .../post/responses/response_403/__init__.py | 20 - .../post/responses/response_404/__init__.py | 20 - .../post/responses/response_406/__init__.py | 20 - .../post/responses/response_412/__init__.py | 20 - .../post/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../paths/keys_key_id_public_pem/__init__.py | 5 - .../keys_key_id_public_pem/get/__init__.py | 0 .../keys_key_id_public_pem/get/operation.py | 197 -- .../get/parameters/__init__.py | 0 .../get/parameters/parameter_0/__init__.py | 16 - .../get/parameters/parameter_0/schema.py | 13 - .../get/path_parameters.py | 100 - .../get/responses/__init__.py | 0 .../get/responses/response_200/__init__.py | 29 - .../response_200/content/__init__.py | 0 .../application_x_pem_file/__init__.py | 0 .../content/application_x_pem_file/schema.py | 13 - .../get/responses/response_400/__init__.py | 20 - .../get/responses/response_401/__init__.py | 20 - .../get/responses/response_403/__init__.py | 20 - .../get/responses/response_404/__init__.py | 20 - .../get/responses/response_406/__init__.py | 20 - .../get/responses/response_412/__init__.py | 20 - .../get/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../__init__.py | 5 - .../delete/__init__.py | 0 .../delete/operation.py | 187 -- .../delete/parameters/__init__.py | 0 .../delete/parameters/parameter_0/__init__.py | 16 - .../delete/parameters/parameter_0/schema.py | 13 - .../delete/parameters/parameter_1/__init__.py | 16 - .../delete/parameters/parameter_1/schema.py | 13 - .../delete/path_parameters.py | 113 - .../delete/responses/__init__.py | 0 .../delete/responses/response_204/__init__.py | 20 - .../delete/responses/response_401/__init__.py | 20 - .../delete/responses/response_403/__init__.py | 20 - .../delete/responses/response_404/__init__.py | 20 - .../delete/responses/response_406/__init__.py | 20 - .../delete/responses/response_412/__init__.py | 20 - .../delete/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../put/__init__.py | 0 .../put/operation.py | 200 -- .../put/parameters/__init__.py | 0 .../put/parameters/parameter_0/__init__.py | 16 - .../put/parameters/parameter_0/schema.py | 13 - .../put/parameters/parameter_1/__init__.py | 16 - .../put/parameters/parameter_1/schema.py | 13 - .../put/path_parameters.py | 113 - .../put/responses/__init__.py | 0 .../put/responses/response_204/__init__.py | 20 - .../put/responses/response_304/__init__.py | 20 - .../put/responses/response_400/__init__.py | 20 - .../put/responses/response_401/__init__.py | 20 - .../put/responses/response_403/__init__.py | 20 - .../put/responses/response_404/__init__.py | 20 - .../put/responses/response_406/__init__.py | 20 - .../put/responses/response_412/__init__.py | 20 - .../put/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../client/paths/keys_key_id_sign/__init__.py | 5 - .../paths/keys_key_id_sign/post/__init__.py | 0 .../paths/keys_key_id_sign/post/operation.py | 223 -- .../post/parameters/__init__.py | 0 .../post/parameters/parameter_0/__init__.py | 16 - .../post/parameters/parameter_0/schema.py | 13 - .../keys_key_id_sign/post/path_parameters.py | 100 - .../post/request_body/__init__.py | 20 - .../post/request_body/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../post/responses/__init__.py | 0 .../post/responses/response_200/__init__.py | 29 - .../response_200/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../post/responses/response_400/__init__.py | 20 - .../post/responses/response_401/__init__.py | 20 - .../post/responses/response_403/__init__.py | 20 - .../post/responses/response_404/__init__.py | 20 - .../post/responses/response_406/__init__.py | 20 - .../post/responses/response_412/__init__.py | 20 - .../post/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../nethsm/client/paths/lock/__init__.py | 5 - .../nethsm/client/paths/lock/post/__init__.py | 0 .../client/paths/lock/post/operation.py | 155 - .../paths/lock/post/responses/__init__.py | 0 .../post/responses/response_204/__init__.py | 20 - .../post/responses/response_401/__init__.py | 20 - .../post/responses/response_403/__init__.py | 20 - .../post/responses/response_406/__init__.py | 20 - .../post/responses/response_412/__init__.py | 20 - .../paths/lock/post/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../nethsm/client/paths/metrics/__init__.py | 5 - .../client/paths/metrics/get/__init__.py | 0 .../client/paths/metrics/get/operation.py | 164 -- .../paths/metrics/get/responses/__init__.py | 0 .../get/responses/response_200/__init__.py | 29 - .../response_200/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../get/responses/response_401/__init__.py | 20 - .../get/responses/response_403/__init__.py | 20 - .../get/responses/response_406/__init__.py | 20 - .../get/responses/response_412/__init__.py | 20 - .../paths/metrics/get/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../nethsm/client/paths/provision/__init__.py | 5 - .../client/paths/provision/post/__init__.py | 0 .../client/paths/provision/post/operation.py | 164 -- .../provision/post/request_body/__init__.py | 20 - .../post/request_body/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../provision/post/responses/__init__.py | 0 .../post/responses/response_204/__init__.py | 20 - .../post/responses/response_400/__init__.py | 20 - .../post/responses/response_406/__init__.py | 20 - .../post/responses/response_412/__init__.py | 20 - .../nethsm/client/paths/random/__init__.py | 5 - .../client/paths/random/post/__init__.py | 0 .../client/paths/random/post/operation.py | 195 -- .../random/post/request_body/__init__.py | 20 - .../post/request_body/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../paths/random/post/responses/__init__.py | 0 .../post/responses/response_200/__init__.py | 29 - .../response_200/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../post/responses/response_400/__init__.py | 20 - .../post/responses/response_401/__init__.py | 20 - .../post/responses/response_403/__init__.py | 20 - .../post/responses/response_406/__init__.py | 20 - .../post/responses/response_412/__init__.py | 20 - .../paths/random/post/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../client/paths/system_backup/__init__.py | 5 - .../paths/system_backup/post/__init__.py | 0 .../paths/system_backup/post/operation.py | 155 - .../system_backup/post/responses/__init__.py | 0 .../post/responses/response_200/__init__.py | 20 - .../post/responses/response_401/__init__.py | 20 - .../post/responses/response_403/__init__.py | 20 - .../post/responses/response_406/__init__.py | 20 - .../post/responses/response_412/__init__.py | 20 - .../system_backup/post/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../paths/system_cancel_update/__init__.py | 5 - .../system_cancel_update/post/__init__.py | 0 .../system_cancel_update/post/operation.py | 155 - .../post/responses/__init__.py | 0 .../post/responses/response_204/__init__.py | 20 - .../post/responses/response_401/__init__.py | 20 - .../post/responses/response_403/__init__.py | 20 - .../post/responses/response_406/__init__.py | 20 - .../post/responses/response_412/__init__.py | 20 - .../post/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../paths/system_commit_update/__init__.py | 5 - .../system_commit_update/post/__init__.py | 0 .../system_commit_update/post/operation.py | 155 - .../post/responses/__init__.py | 0 .../post/responses/response_204/__init__.py | 20 - .../post/responses/response_401/__init__.py | 20 - .../post/responses/response_403/__init__.py | 20 - .../post/responses/response_406/__init__.py | 20 - .../post/responses/response_412/__init__.py | 20 - .../post/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../paths/system_factory_reset/__init__.py | 5 - .../system_factory_reset/post/__init__.py | 0 .../system_factory_reset/post/operation.py | 155 - .../post/responses/__init__.py | 0 .../post/responses/response_204/__init__.py | 20 - .../post/responses/response_401/__init__.py | 20 - .../post/responses/response_403/__init__.py | 20 - .../post/responses/response_406/__init__.py | 20 - .../post/responses/response_412/__init__.py | 20 - .../post/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../client/paths/system_info/__init__.py | 5 - .../client/paths/system_info/get/__init__.py | 0 .../client/paths/system_info/get/operation.py | 164 -- .../system_info/get/responses/__init__.py | 0 .../get/responses/response_200/__init__.py | 29 - .../response_200/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../get/responses/response_401/__init__.py | 20 - .../get/responses/response_403/__init__.py | 20 - .../get/responses/response_406/__init__.py | 20 - .../get/responses/response_412/__init__.py | 20 - .../system_info/get/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../client/paths/system_reboot/__init__.py | 5 - .../paths/system_reboot/post/__init__.py | 0 .../paths/system_reboot/post/operation.py | 155 - .../system_reboot/post/responses/__init__.py | 0 .../post/responses/response_204/__init__.py | 20 - .../post/responses/response_401/__init__.py | 20 - .../post/responses/response_403/__init__.py | 20 - .../post/responses/response_406/__init__.py | 20 - .../post/responses/response_412/__init__.py | 20 - .../system_reboot/post/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../client/paths/system_restore/__init__.py | 5 - .../paths/system_restore/post/__init__.py | 0 .../paths/system_restore/post/operation.py | 183 -- .../post/parameters/__init__.py | 0 .../post/parameters/parameter_0/__init__.py | 17 - .../post/parameters/parameter_0/schema.py | 13 - .../post/parameters/parameter_1/__init__.py | 16 - .../post/parameters/parameter_1/schema.py | 13 - .../system_restore/post/query_parameters.py | 137 - .../post/request_body/__init__.py | 20 - .../post/request_body/content/__init__.py | 0 .../application_octet_stream/__init__.py | 0 .../application_octet_stream/schema.py | 13 - .../system_restore/post/responses/__init__.py | 0 .../post/responses/response_204/__init__.py | 20 - .../post/responses/response_400/__init__.py | 20 - .../post/responses/response_406/__init__.py | 20 - .../post/responses/response_412/__init__.py | 20 - .../client/paths/system_shutdown/__init__.py | 5 - .../paths/system_shutdown/post/__init__.py | 0 .../paths/system_shutdown/post/operation.py | 155 - .../post/responses/__init__.py | 0 .../post/responses/response_204/__init__.py | 20 - .../post/responses/response_401/__init__.py | 20 - .../post/responses/response_403/__init__.py | 20 - .../post/responses/response_406/__init__.py | 20 - .../post/responses/response_412/__init__.py | 20 - .../system_shutdown/post/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../client/paths/system_update/__init__.py | 5 - .../paths/system_update/post/__init__.py | 0 .../paths/system_update/post/operation.py | 191 -- .../post/request_body/__init__.py | 20 - .../post/request_body/content/__init__.py | 0 .../application_octet_stream/__init__.py | 0 .../application_octet_stream/schema.py | 13 - .../system_update/post/responses/__init__.py | 0 .../post/responses/response_200/__init__.py | 29 - .../response_200/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../post/responses/response_400/__init__.py | 20 - .../post/responses/response_401/__init__.py | 20 - .../post/responses/response_403/__init__.py | 20 - .../post/responses/response_406/__init__.py | 20 - .../post/responses/response_409/__init__.py | 20 - .../post/responses/response_412/__init__.py | 20 - .../system_update/post/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../nethsm/client/paths/unlock/__init__.py | 5 - .../client/paths/unlock/post/__init__.py | 0 .../client/paths/unlock/post/operation.py | 169 -- .../unlock/post/request_body/__init__.py | 20 - .../post/request_body/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../paths/unlock/post/responses/__init__.py | 0 .../post/responses/response_204/__init__.py | 20 - .../post/responses/response_400/__init__.py | 20 - .../post/responses/response_403/__init__.py | 20 - .../post/responses/response_406/__init__.py | 20 - .../post/responses/response_412/__init__.py | 20 - .../nethsm/client/paths/users/__init__.py | 5 - .../nethsm/client/paths/users/get/__init__.py | 0 .../client/paths/users/get/operation.py | 164 -- .../paths/users/get/responses/__init__.py | 0 .../get/responses/response_200/__init__.py | 29 - .../response_200/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../get/responses/response_401/__init__.py | 20 - .../get/responses/response_403/__init__.py | 20 - .../get/responses/response_406/__init__.py | 20 - .../get/responses/response_412/__init__.py | 20 - .../paths/users/get/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../client/paths/users/post/__init__.py | 0 .../client/paths/users/post/operation.py | 188 -- .../paths/users/post/request_body/__init__.py | 20 - .../post/request_body/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../paths/users/post/responses/__init__.py | 0 .../post/responses/response_201/__init__.py | 20 - .../post/responses/response_400/__init__.py | 20 - .../post/responses/response_401/__init__.py | 20 - .../post/responses/response_403/__init__.py | 20 - .../post/responses/response_406/__init__.py | 20 - .../post/responses/response_412/__init__.py | 20 - .../paths/users/post/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../client/paths/users_user_id/__init__.py | 5 - .../paths/users_user_id/delete/__init__.py | 0 .../paths/users_user_id/delete/operation.py | 183 -- .../delete/parameters/__init__.py | 0 .../delete/parameters/parameter_0/__init__.py | 16 - .../delete/parameters/parameter_0/schema.py | 13 - .../users_user_id/delete/path_parameters.py | 100 - .../delete/responses/__init__.py | 0 .../delete/responses/response_204/__init__.py | 20 - .../delete/responses/response_401/__init__.py | 20 - .../delete/responses/response_403/__init__.py | 20 - .../delete/responses/response_404/__init__.py | 20 - .../delete/responses/response_406/__init__.py | 20 - .../delete/responses/response_412/__init__.py | 20 - .../users_user_id/delete/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../paths/users_user_id/get/__init__.py | 0 .../paths/users_user_id/get/operation.py | 197 -- .../users_user_id/get/parameters/__init__.py | 0 .../get/parameters/parameter_0/__init__.py | 16 - .../get/parameters/parameter_0/schema.py | 13 - .../users_user_id/get/path_parameters.py | 100 - .../users_user_id/get/responses/__init__.py | 0 .../get/responses/response_200/__init__.py | 29 - .../response_200/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../get/responses/response_400/__init__.py | 20 - .../get/responses/response_401/__init__.py | 20 - .../get/responses/response_403/__init__.py | 20 - .../get/responses/response_404/__init__.py | 20 - .../get/responses/response_406/__init__.py | 20 - .../get/responses/response_412/__init__.py | 20 - .../users_user_id/get/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../paths/users_user_id/put/__init__.py | 0 .../paths/users_user_id/put/operation.py | 216 -- .../users_user_id/put/parameters/__init__.py | 0 .../put/parameters/parameter_0/__init__.py | 16 - .../put/parameters/parameter_0/schema.py | 13 - .../users_user_id/put/path_parameters.py | 100 - .../put/request_body/__init__.py | 20 - .../put/request_body/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../users_user_id/put/responses/__init__.py | 0 .../put/responses/response_201/__init__.py | 20 - .../put/responses/response_400/__init__.py | 20 - .../put/responses/response_401/__init__.py | 20 - .../put/responses/response_403/__init__.py | 20 - .../put/responses/response_406/__init__.py | 20 - .../put/responses/response_409/__init__.py | 20 - .../put/responses/response_412/__init__.py | 20 - .../users_user_id/put/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../users_user_id_passphrase/__init__.py | 5 - .../users_user_id_passphrase/post/__init__.py | 0 .../post/operation.py | 216 -- .../post/parameters/__init__.py | 0 .../post/parameters/parameter_0/__init__.py | 16 - .../post/parameters/parameter_0/schema.py | 13 - .../post/path_parameters.py | 100 - .../post/request_body/__init__.py | 20 - .../post/request_body/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../post/responses/__init__.py | 0 .../post/responses/response_204/__init__.py | 20 - .../post/responses/response_400/__init__.py | 20 - .../post/responses/response_401/__init__.py | 20 - .../post/responses/response_403/__init__.py | 20 - .../post/responses/response_404/__init__.py | 20 - .../post/responses/response_406/__init__.py | 20 - .../post/responses/response_412/__init__.py | 20 - .../post/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../paths/users_user_id_tags/__init__.py | 5 - .../paths/users_user_id_tags/get/__init__.py | 0 .../paths/users_user_id_tags/get/operation.py | 197 -- .../get/parameters/__init__.py | 0 .../get/parameters/parameter_0/__init__.py | 16 - .../get/parameters/parameter_0/schema.py | 13 - .../users_user_id_tags/get/path_parameters.py | 100 - .../get/responses/__init__.py | 0 .../get/responses/response_200/__init__.py | 29 - .../response_200/content/__init__.py | 0 .../content/application_json/__init__.py | 0 .../content/application_json/schema.py | 13 - .../get/responses/response_400/__init__.py | 20 - .../get/responses/response_401/__init__.py | 20 - .../get/responses/response_403/__init__.py | 20 - .../get/responses/response_404/__init__.py | 20 - .../get/responses/response_406/__init__.py | 20 - .../get/responses/response_412/__init__.py | 20 - .../get/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../paths/users_user_id_tags_tag/__init__.py | 5 - .../users_user_id_tags_tag/delete/__init__.py | 0 .../delete/operation.py | 187 -- .../delete/parameters/__init__.py | 0 .../delete/parameters/parameter_0/__init__.py | 16 - .../delete/parameters/parameter_0/schema.py | 13 - .../delete/parameters/parameter_1/__init__.py | 16 - .../delete/parameters/parameter_1/schema.py | 13 - .../delete/path_parameters.py | 113 - .../delete/responses/__init__.py | 0 .../delete/responses/response_204/__init__.py | 20 - .../delete/responses/response_401/__init__.py | 20 - .../delete/responses/response_403/__init__.py | 20 - .../delete/responses/response_404/__init__.py | 20 - .../delete/responses/response_406/__init__.py | 20 - .../delete/responses/response_412/__init__.py | 20 - .../delete/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - .../users_user_id_tags_tag/put/__init__.py | 0 .../users_user_id_tags_tag/put/operation.py | 200 -- .../put/parameters/__init__.py | 0 .../put/parameters/parameter_0/__init__.py | 16 - .../put/parameters/parameter_0/schema.py | 13 - .../put/parameters/parameter_1/__init__.py | 16 - .../put/parameters/parameter_1/schema.py | 13 - .../put/path_parameters.py | 113 - .../put/responses/__init__.py | 0 .../put/responses/response_204/__init__.py | 20 - .../put/responses/response_304/__init__.py | 20 - .../put/responses/response_400/__init__.py | 20 - .../put/responses/response_401/__init__.py | 20 - .../put/responses/response_403/__init__.py | 20 - .../put/responses/response_404/__init__.py | 20 - .../put/responses/response_406/__init__.py | 20 - .../put/responses/response_412/__init__.py | 20 - .../put/security/__init__.py | 0 .../security/security_requirement_object_0.py | 11 - pynitrokey/nethsm/client/py.typed | 0 pynitrokey/nethsm/client/rest.py | 270 -- pynitrokey/nethsm/client/schemas/__init__.py | 148 - pynitrokey/nethsm/client/schemas/format.py | 115 - .../client/schemas/original_immutabledict.py | 97 - pynitrokey/nethsm/client/schemas/schema.py | 729 ----- pynitrokey/nethsm/client/schemas/schemas.py | 375 --- .../nethsm/client/schemas/validation.py | 1285 -------- pynitrokey/nethsm/client/security_schemes.py | 228 -- pynitrokey/nethsm/client/server.py | 34 - pynitrokey/nethsm/client/servers/__init__.py | 0 pynitrokey/nethsm/client/servers/server_0.py | 139 - .../nethsm/client/shared_imports/__init__.py | 0 .../client/shared_imports/header_imports.py | 15 - .../shared_imports/operation_imports.py | 18 - .../client/shared_imports/response_imports.py | 25 - .../client/shared_imports/schema_imports.py | 28 - .../shared_imports/security_scheme_imports.py | 12 - .../client/shared_imports/server_imports.py | 13 - pyproject.toml | 10 +- 1095 files changed, 22 insertions(+), 40503 deletions(-) delete mode 100644 nethsm-api.yaml delete mode 100644 pynitrokey/nethsm/__init__.py delete mode 100644 pynitrokey/nethsm/client/__init__.py delete mode 100644 pynitrokey/nethsm/client/api_client.py delete mode 100644 pynitrokey/nethsm/client/api_response.py delete mode 100644 pynitrokey/nethsm/client/apis/__init__.py delete mode 100644 pynitrokey/nethsm/client/apis/path_to_api.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/__init__.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/config_backup_passphrase.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/config_logging.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/config_network.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/config_time.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/config_tls_cert_pem.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/config_tls_csr_pem.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/config_tls_generate.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/config_tls_public_pem.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/config_unattended_boot.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/config_unlock_passphrase.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/health_alive.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/health_ready.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/health_state.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/info.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/keys.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/keys_generate.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/keys_key_id.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/keys_key_id_cert.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/keys_key_id_csr_pem.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/keys_key_id_decrypt.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/keys_key_id_encrypt.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/keys_key_id_public_pem.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/keys_key_id_restrictions_tags_tag.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/keys_key_id_sign.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/lock.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/metrics.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/provision.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/random.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/system_backup.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/system_cancel_update.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/system_commit_update.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/system_factory_reset.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/system_info.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/system_reboot.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/system_restore.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/system_shutdown.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/system_update.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/unlock.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/users.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/users_user_id.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/users_user_id_passphrase.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/users_user_id_tags.py delete mode 100644 pynitrokey/nethsm/client/apis/paths/users_user_id_tags_tag.py delete mode 100644 pynitrokey/nethsm/client/apis/tag_to_api.py delete mode 100644 pynitrokey/nethsm/client/apis/tags/__init__.py delete mode 100644 pynitrokey/nethsm/client/apis/tags/default_api.py delete mode 100644 pynitrokey/nethsm/client/components/__init__.py delete mode 100644 pynitrokey/nethsm/client/components/request_bodies/__init__.py delete mode 100644 pynitrokey/nethsm/client/components/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/components/schema/__init__.py delete mode 100644 pynitrokey/nethsm/client/components/schema/backup_passphrase_config.py delete mode 100644 pynitrokey/nethsm/client/components/schema/base64.py delete mode 100644 pynitrokey/nethsm/client/components/schema/decrypt_data.py delete mode 100644 pynitrokey/nethsm/client/components/schema/decrypt_mode.py delete mode 100644 pynitrokey/nethsm/client/components/schema/decrypt_request_data.py delete mode 100644 pynitrokey/nethsm/client/components/schema/distinguished_name.py delete mode 100644 pynitrokey/nethsm/client/components/schema/encrypt_data.py delete mode 100644 pynitrokey/nethsm/client/components/schema/encrypt_mode.py delete mode 100644 pynitrokey/nethsm/client/components/schema/encrypt_request_data.py delete mode 100644 pynitrokey/nethsm/client/components/schema/health_state_data.py delete mode 100644 pynitrokey/nethsm/client/components/schema/id.py delete mode 100644 pynitrokey/nethsm/client/components/schema/info_data.py delete mode 100644 pynitrokey/nethsm/client/components/schema/key_generate_request_data.py delete mode 100644 pynitrokey/nethsm/client/components/schema/key_item.py delete mode 100644 pynitrokey/nethsm/client/components/schema/key_list.py delete mode 100644 pynitrokey/nethsm/client/components/schema/key_mechanism.py delete mode 100644 pynitrokey/nethsm/client/components/schema/key_mechanisms.py delete mode 100644 pynitrokey/nethsm/client/components/schema/key_private_data.py delete mode 100644 pynitrokey/nethsm/client/components/schema/key_public_data.py delete mode 100644 pynitrokey/nethsm/client/components/schema/key_restrictions.py delete mode 100644 pynitrokey/nethsm/client/components/schema/key_type.py delete mode 100644 pynitrokey/nethsm/client/components/schema/log_level.py delete mode 100644 pynitrokey/nethsm/client/components/schema/logging_config.py delete mode 100644 pynitrokey/nethsm/client/components/schema/metrics_data.py delete mode 100644 pynitrokey/nethsm/client/components/schema/network_config.py delete mode 100644 pynitrokey/nethsm/client/components/schema/passphrase.py delete mode 100644 pynitrokey/nethsm/client/components/schema/pem_cert.py delete mode 100644 pynitrokey/nethsm/client/components/schema/pem_csr.py delete mode 100644 pynitrokey/nethsm/client/components/schema/pem_private_key.py delete mode 100644 pynitrokey/nethsm/client/components/schema/pem_public_key.py delete mode 100644 pynitrokey/nethsm/client/components/schema/pgp_private_key.py delete mode 100644 pynitrokey/nethsm/client/components/schema/private_key.py delete mode 100644 pynitrokey/nethsm/client/components/schema/provision_request_data.py delete mode 100644 pynitrokey/nethsm/client/components/schema/public_key.py delete mode 100644 pynitrokey/nethsm/client/components/schema/random_data.py delete mode 100644 pynitrokey/nethsm/client/components/schema/random_request_data.py delete mode 100644 pynitrokey/nethsm/client/components/schema/sign_data.py delete mode 100644 pynitrokey/nethsm/client/components/schema/sign_mode.py delete mode 100644 pynitrokey/nethsm/client/components/schema/sign_request_data.py delete mode 100644 pynitrokey/nethsm/client/components/schema/switch.py delete mode 100644 pynitrokey/nethsm/client/components/schema/system_info.py delete mode 100644 pynitrokey/nethsm/client/components/schema/system_state.py delete mode 100644 pynitrokey/nethsm/client/components/schema/system_update_data.py delete mode 100644 pynitrokey/nethsm/client/components/schema/tag_list.py delete mode 100644 pynitrokey/nethsm/client/components/schema/time_config.py delete mode 100644 pynitrokey/nethsm/client/components/schema/tls_key_generate_request_data.py delete mode 100644 pynitrokey/nethsm/client/components/schema/tls_key_type.py delete mode 100644 pynitrokey/nethsm/client/components/schema/unattended_boot_config.py delete mode 100644 pynitrokey/nethsm/client/components/schema/unlock_passphrase_config.py delete mode 100644 pynitrokey/nethsm/client/components/schema/unlock_request_data.py delete mode 100644 pynitrokey/nethsm/client/components/schema/user_data.py delete mode 100644 pynitrokey/nethsm/client/components/schema/user_item.py delete mode 100644 pynitrokey/nethsm/client/components/schema/user_list.py delete mode 100644 pynitrokey/nethsm/client/components/schema/user_passphrase_post_data.py delete mode 100644 pynitrokey/nethsm/client/components/schema/user_post_data.py delete mode 100644 pynitrokey/nethsm/client/components/schema/user_role.py delete mode 100644 pynitrokey/nethsm/client/components/schemas/__init__.py delete mode 100644 pynitrokey/nethsm/client/components/security_schemes/__init__.py delete mode 100644 pynitrokey/nethsm/client/components/security_schemes/security_scheme_basic.py delete mode 100644 pynitrokey/nethsm/client/configurations/__init__.py delete mode 100644 pynitrokey/nethsm/client/configurations/api_configuration.py delete mode 100644 pynitrokey/nethsm/client/configurations/schema_configuration.py delete mode 100644 pynitrokey/nethsm/client/exceptions.py delete mode 100644 pynitrokey/nethsm/client/paths/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_backup_passphrase/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_backup_passphrase/put/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_backup_passphrase/put/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/config_backup_passphrase/put/request_body/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_backup_passphrase/put/request_body/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_backup_passphrase/put/request_body/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_backup_passphrase/put/request_body/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/response_204/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/response_400/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_backup_passphrase/put/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_backup_passphrase/put/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/config_logging/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_logging/get/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_logging/get/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/config_logging/get/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_logging/get/responses/response_200/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_logging/get/responses/response_200/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_logging/get/responses/response_200/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_logging/get/responses/response_200/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/config_logging/get/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_logging/get/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_logging/get/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_logging/get/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_logging/get/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_logging/get/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/config_logging/put/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_logging/put/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/config_logging/put/request_body/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_logging/put/request_body/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_logging/put/request_body/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_logging/put/request_body/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/config_logging/put/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_logging/put/responses/response_204/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_logging/put/responses/response_400/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_logging/put/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_logging/put/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_logging/put/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_logging/put/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_logging/put/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_logging/put/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/config_network/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_network/get/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_network/get/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/config_network/get/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_network/get/responses/response_200/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_network/get/responses/response_200/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_network/get/responses/response_200/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_network/get/responses/response_200/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/config_network/get/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_network/get/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_network/get/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_network/get/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_network/get/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_network/get/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/config_network/put/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_network/put/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/config_network/put/request_body/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_network/put/request_body/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_network/put/request_body/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_network/put/request_body/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/config_network/put/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_network/put/responses/response_204/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_network/put/responses/response_400/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_network/put/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_network/put/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_network/put/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_network/put/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_network/put/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_network/put/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/config_time/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_time/get/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_time/get/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/config_time/get/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_time/get/responses/response_200/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_time/get/responses/response_200/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_time/get/responses/response_200/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_time/get/responses/response_200/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/config_time/get/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_time/get/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_time/get/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_time/get/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_time/get/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_time/get/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/config_time/put/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_time/put/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/config_time/put/request_body/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_time/put/request_body/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_time/put/request_body/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_time/put/request_body/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/config_time/put/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_time/put/responses/response_204/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_time/put/responses/response_400/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_time/put/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_time/put/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_time/put/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_time/put/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_time/put/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_time/put/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_200/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_200/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_200/content/application_x_pem_file/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_200/content/application_x_pem_file/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_415/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/request_body/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/request_body/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/request_body/content/application_x_pem_file/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/request_body/content/application_x_pem_file/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/response_201/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/response_400/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_csr_pem/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/request_body/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/request_body/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/request_body/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/request_body/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_200/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_200/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_200/content/application_x_pem_file/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_200/content/application_x_pem_file/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_generate/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_generate/post/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_generate/post/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_generate/post/request_body/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_generate/post/request_body/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_generate/post/request_body/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_generate/post/request_body/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/response_204/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/response_400/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_generate/post/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_generate/post/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_public_pem/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_public_pem/get/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_public_pem/get/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_200/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_200/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_200/content/application_x_pem_file/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_200/content/application_x_pem_file/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_public_pem/get/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_public_pem/get/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/get/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/get/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_200/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_200/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_200/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_200/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/get/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/get/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/put/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/put/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/put/request_body/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/put/request_body/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/put/request_body/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/put/request_body/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/response_204/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/response_400/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/put/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/put/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unlock_passphrase/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/request_body/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/request_body/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/request_body/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/request_body/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/response_204/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/response_400/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/health_alive/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/health_alive/get/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/health_alive/get/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/health_alive/get/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/health_alive/get/responses/response_200/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/health_alive/get/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/health_alive/get/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/health_ready/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/health_ready/get/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/health_ready/get/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/health_ready/get/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/health_ready/get/responses/response_200/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/health_ready/get/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/health_ready/get/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/health_state/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/health_state/get/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/health_state/get/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/health_state/get/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/health_state/get/responses/response_200/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/health_state/get/responses/response_200/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/health_state/get/responses/response_200/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/health_state/get/responses/response_200/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/health_state/get/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/info/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/info/get/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/info/get/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/info/get/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/info/get/responses/response_200/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/info/get/responses/response_200/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/info/get/responses/response_200/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/info/get/responses/response_200/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/info/get/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/get/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/get/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/get/parameters/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/get/parameters/parameter_0/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/get/parameters/parameter_0/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/get/query_parameters.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/get/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/get/responses/response_200/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/get/responses/response_200/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/get/responses/response_200/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/get/responses/response_200/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/get/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/get/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/get/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/get/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/get/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/get/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/post/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/post/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/post/parameters/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/post/parameters/parameter_0/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/post/parameters/parameter_0/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/post/parameters/parameter_1/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/post/parameters/parameter_1/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/post/query_parameters.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/post/request_body/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/post/request_body/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/post/request_body/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/post/request_body/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/post/request_body/content/application_x_pem_file/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/post/request_body/content/application_x_pem_file/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/post/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/post/responses/response_201/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/post/responses/response_201/header_parameters.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/post/responses/response_201/headers/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/post/responses/response_201/headers/header_location/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/post/responses/response_201/headers/header_location/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/post/responses/response_400/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/post/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/post/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/post/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/post/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/post/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/post/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_generate/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/request_body/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/request_body/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/request_body/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/request_body/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_201/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_201/header_parameters.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_201/headers/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_201/headers/header_location/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_201/headers/header_location/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_400/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/delete/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/delete/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/delete/parameters/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/delete/parameters/parameter_0/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/delete/parameters/parameter_0/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/delete/path_parameters.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/response_204/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/response_404/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/delete/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/delete/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/parameters/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/parameters/parameter_0/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/parameters/parameter_0/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/path_parameters.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_200/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_200/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_200/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_200/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_400/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_404/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/parameter_0/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/parameter_0/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/parameter_1/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/parameter_1/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/parameter_2/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/parameter_2/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/path_parameters.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/query_parameters.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/request_body/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/request_body/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/request_body/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/request_body/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/request_body/content/application_x_pem_file/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/request_body/content/application_x_pem_file/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_204/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_400/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_409/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/parameters/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/parameters/parameter_0/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/parameters/parameter_0/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/path_parameters.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_204/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_404/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_409/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/parameters/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/parameters/parameter_0/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/parameters/parameter_0/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/path_parameters.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/content/application_pgp_keys/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/content/application_pgp_keys/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/content/application_x_pem_file/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/content/application_x_pem_file/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/content/application_xx509_ca_cert/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/content/application_xx509_ca_cert/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_400/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_404/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/parameters/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/parameters/parameter_0/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/parameters/parameter_0/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/path_parameters.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/content/application_pgp_keys/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/content/application_pgp_keys/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/content/application_x_pem_file/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/content/application_x_pem_file/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/content/application_xx509_ca_cert/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/content/application_xx509_ca_cert/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/response_201/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/response_409/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/parameters/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/parameters/parameter_0/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/parameters/parameter_0/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/path_parameters.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/request_body/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/request_body/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/request_body/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/request_body/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_200/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_200/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_200/content/application_x_pem_file/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_200/content/application_x_pem_file/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_400/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_404/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/parameters/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/parameters/parameter_0/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/parameters/parameter_0/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/path_parameters.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/request_body/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/request_body/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/request_body/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/request_body/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_200/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_200/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_200/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_200/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_400/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_404/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/parameters/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/parameters/parameter_0/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/parameters/parameter_0/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/path_parameters.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/request_body/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/request_body/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/request_body/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/request_body/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_200/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_200/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_200/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_200/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_400/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_404/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/parameters/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/parameters/parameter_0/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/parameters/parameter_0/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/path_parameters.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_200/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_200/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_200/content/application_x_pem_file/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_200/content/application_x_pem_file/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_400/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_404/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/parameters/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/parameters/parameter_0/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/parameters/parameter_0/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/parameters/parameter_1/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/parameters/parameter_1/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/path_parameters.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/response_204/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/response_404/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/parameters/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/parameters/parameter_0/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/parameters/parameter_0/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/parameters/parameter_1/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/parameters/parameter_1/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/path_parameters.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_204/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_304/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_400/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_404/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/parameters/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/parameters/parameter_0/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/parameters/parameter_0/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/path_parameters.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/request_body/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/request_body/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/request_body/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/request_body/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_200/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_200/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_200/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_200/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_400/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_404/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/lock/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/lock/post/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/lock/post/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/lock/post/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/lock/post/responses/response_204/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/lock/post/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/lock/post/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/lock/post/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/lock/post/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/lock/post/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/lock/post/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/metrics/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/metrics/get/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/metrics/get/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/metrics/get/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/metrics/get/responses/response_200/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/metrics/get/responses/response_200/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/metrics/get/responses/response_200/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/metrics/get/responses/response_200/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/metrics/get/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/metrics/get/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/metrics/get/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/metrics/get/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/metrics/get/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/metrics/get/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/provision/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/provision/post/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/provision/post/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/provision/post/request_body/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/provision/post/request_body/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/provision/post/request_body/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/provision/post/request_body/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/provision/post/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/provision/post/responses/response_204/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/provision/post/responses/response_400/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/provision/post/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/provision/post/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/random/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/random/post/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/random/post/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/random/post/request_body/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/random/post/request_body/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/random/post/request_body/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/random/post/request_body/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/random/post/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/random/post/responses/response_200/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/random/post/responses/response_200/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/random/post/responses/response_200/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/random/post/responses/response_200/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/random/post/responses/response_400/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/random/post/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/random/post/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/random/post/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/random/post/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/random/post/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/random/post/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/system_backup/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_backup/post/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_backup/post/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/system_backup/post/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_backup/post/responses/response_200/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_backup/post/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_backup/post/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_backup/post/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_backup/post/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_backup/post/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_backup/post/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/system_cancel_update/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_cancel_update/post/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_cancel_update/post/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/system_cancel_update/post/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_cancel_update/post/responses/response_204/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_cancel_update/post/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_cancel_update/post/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_cancel_update/post/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_cancel_update/post/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_cancel_update/post/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_cancel_update/post/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/system_commit_update/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_commit_update/post/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_commit_update/post/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/system_commit_update/post/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_commit_update/post/responses/response_204/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_commit_update/post/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_commit_update/post/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_commit_update/post/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_commit_update/post/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_commit_update/post/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_commit_update/post/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/system_factory_reset/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_factory_reset/post/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_factory_reset/post/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/system_factory_reset/post/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_factory_reset/post/responses/response_204/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_factory_reset/post/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_factory_reset/post/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_factory_reset/post/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_factory_reset/post/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_factory_reset/post/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_factory_reset/post/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/system_info/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_info/get/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_info/get/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/system_info/get/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_info/get/responses/response_200/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_info/get/responses/response_200/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_info/get/responses/response_200/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_info/get/responses/response_200/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/system_info/get/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_info/get/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_info/get/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_info/get/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_info/get/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_info/get/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/system_reboot/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_reboot/post/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_reboot/post/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/system_reboot/post/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_reboot/post/responses/response_204/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_reboot/post/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_reboot/post/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_reboot/post/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_reboot/post/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_reboot/post/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_reboot/post/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/system_restore/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_restore/post/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_restore/post/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/system_restore/post/parameters/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_restore/post/parameters/parameter_0/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_restore/post/parameters/parameter_0/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/system_restore/post/parameters/parameter_1/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_restore/post/parameters/parameter_1/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/system_restore/post/query_parameters.py delete mode 100644 pynitrokey/nethsm/client/paths/system_restore/post/request_body/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_restore/post/request_body/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_restore/post/request_body/content/application_octet_stream/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_restore/post/request_body/content/application_octet_stream/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/system_restore/post/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_restore/post/responses/response_204/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_restore/post/responses/response_400/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_restore/post/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_restore/post/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_shutdown/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_shutdown/post/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_shutdown/post/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/system_shutdown/post/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_shutdown/post/responses/response_204/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_shutdown/post/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_shutdown/post/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_shutdown/post/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_shutdown/post/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_shutdown/post/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_shutdown/post/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/system_update/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_update/post/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_update/post/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/system_update/post/request_body/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_update/post/request_body/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_update/post/request_body/content/application_octet_stream/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_update/post/request_body/content/application_octet_stream/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/system_update/post/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_update/post/responses/response_200/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_update/post/responses/response_200/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_update/post/responses/response_200/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_update/post/responses/response_200/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/system_update/post/responses/response_400/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_update/post/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_update/post/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_update/post/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_update/post/responses/response_409/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_update/post/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_update/post/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_update/post/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/unlock/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/unlock/post/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/unlock/post/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/unlock/post/request_body/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/unlock/post/request_body/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/unlock/post/request_body/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/unlock/post/request_body/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/unlock/post/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/unlock/post/responses/response_204/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/unlock/post/responses/response_400/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/unlock/post/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/unlock/post/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/unlock/post/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users/get/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users/get/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/users/get/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users/get/responses/response_200/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users/get/responses/response_200/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users/get/responses/response_200/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users/get/responses/response_200/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/users/get/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users/get/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users/get/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users/get/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users/get/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users/get/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/users/post/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users/post/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/users/post/request_body/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users/post/request_body/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users/post/request_body/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users/post/request_body/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/users/post/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users/post/responses/response_201/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users/post/responses/response_400/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users/post/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users/post/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users/post/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users/post/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users/post/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users/post/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/delete/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/delete/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/delete/parameters/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/delete/parameters/parameter_0/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/delete/parameters/parameter_0/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/delete/path_parameters.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/delete/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/delete/responses/response_204/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/delete/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/delete/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/delete/responses/response_404/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/delete/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/delete/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/delete/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/delete/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/parameters/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/parameters/parameter_0/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/parameters/parameter_0/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/path_parameters.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_200/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_200/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_200/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_200/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_400/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_404/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/parameters/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/parameters/parameter_0/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/parameters/parameter_0/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/path_parameters.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/request_body/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/request_body/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/request_body/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/request_body/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_201/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_400/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_409/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/parameters/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/parameters/parameter_0/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/parameters/parameter_0/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/path_parameters.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/request_body/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/request_body/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/request_body/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/request_body/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_204/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_400/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_404/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/parameters/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/parameters/parameter_0/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/parameters/parameter_0/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/path_parameters.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_200/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_200/content/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_200/content/application_json/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_200/content/application_json/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_400/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_404/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/parameters/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/parameters/parameter_0/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/parameters/parameter_0/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/parameters/parameter_1/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/parameters/parameter_1/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/path_parameters.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/response_204/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/response_404/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/operation.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/parameters/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/parameters/parameter_0/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/parameters/parameter_0/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/parameters/parameter_1/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/parameters/parameter_1/schema.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/path_parameters.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_204/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_304/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_400/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_401/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_403/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_404/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/security/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/py.typed delete mode 100644 pynitrokey/nethsm/client/rest.py delete mode 100644 pynitrokey/nethsm/client/schemas/__init__.py delete mode 100644 pynitrokey/nethsm/client/schemas/format.py delete mode 100644 pynitrokey/nethsm/client/schemas/original_immutabledict.py delete mode 100644 pynitrokey/nethsm/client/schemas/schema.py delete mode 100644 pynitrokey/nethsm/client/schemas/schemas.py delete mode 100644 pynitrokey/nethsm/client/schemas/validation.py delete mode 100644 pynitrokey/nethsm/client/security_schemes.py delete mode 100644 pynitrokey/nethsm/client/server.py delete mode 100644 pynitrokey/nethsm/client/servers/__init__.py delete mode 100644 pynitrokey/nethsm/client/servers/server_0.py delete mode 100644 pynitrokey/nethsm/client/shared_imports/__init__.py delete mode 100644 pynitrokey/nethsm/client/shared_imports/header_imports.py delete mode 100644 pynitrokey/nethsm/client/shared_imports/operation_imports.py delete mode 100644 pynitrokey/nethsm/client/shared_imports/response_imports.py delete mode 100644 pynitrokey/nethsm/client/shared_imports/schema_imports.py delete mode 100644 pynitrokey/nethsm/client/shared_imports/security_scheme_imports.py delete mode 100644 pynitrokey/nethsm/client/shared_imports/server_imports.py diff --git a/Makefile b/Makefile index fa01c16b..327d9a3d 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ PYTHON3=python3 PYTHON3_VENV=venv/bin/python3 # whitelist of directories for flake8 -FLAKE8_DIRS=pynitrokey/nethsm pynitrokey/cli/nk3 pynitrokey/nk3 +FLAKE8_DIRS=pynitrokey/cli/nk3 pynitrokey/nk3 all: init @@ -132,22 +132,6 @@ build-CI-test: CI-test: sudo docker run -it --rm -v $(PWD):/app nitro-python-ci make CI VENV=venv-ci -OPENAPI_OUTPUT_DIR=${PWD}/tmp/openapi-client - -nethsm-api.yaml: - curl "https://nethsmdemo.nitrokey.com/api_docs/nethsm-api.yaml" --output nethsm-api.yaml - -# Generates the OpenAPI client for the NetHSM REST API -.PHONY: nethsm-client -nethsm-client: nethsm-api.yaml - mkdir -p "${OPENAPI_OUTPUT_DIR}" - python tools/transform_nethsm_api_spec.py nethsm-api.yaml "${OPENAPI_OUTPUT_DIR}/nethsm-api.json" - docker run --rm -ti -v "${OPENAPI_OUTPUT_DIR}:/out" \ - openapijsonschematools/openapi-json-schema-generator-cli:3.0.0 generate \ - -i=/out/nethsm-api.json \ - -g=python -o=/out/python --package-name=pynitrokey.nethsm.client - cp -r "${OPENAPI_OUTPUT_DIR}/python/src/pynitrokey/nethsm/client" pynitrokey/nethsm - .PHONY: secrets-test-all secrets-test secrets-test-report LOG=info TESTADD= diff --git a/docs/developer-guide.rst b/docs/developer-guide.rst index 8bb84cd5..f30ed418 100644 --- a/docs/developer-guide.rst +++ b/docs/developer-guide.rst @@ -86,29 +86,4 @@ Commands that require a password should first try to read the password from an e Updating the NetHSM client -------------------------- -To update the NetHSM HTTP client, you need to download the updated ``nethsm-api.yml`` OpenAPI specification. The easiest is to download it from the NetHSM demo server (``curl`` required): - -.. code:: bash - - make nethsm-api.yaml --always-make - -Then, run the generation script, docker is required: - -.. code:: bash - - make nethsm-client - -Be sure to run the linter, tests and check that everything is working as expected after the update. - -Custom functions -~~~~~~~~~~~~~~~~ - -The generator doesn't support upload of binary files and custom ``Content-Type`` headers (fails to serialize). -To work around this, some functions are written manually, using ``NetHSM.request()`` to send the request. - -The current list of such functions is: - -- ``NetHSM.restore()`` : ``/system/restore`` -- ``NetHSM.set_key_certificate()`` : ``/keys/{KeyID}/cert`` -- ``NetHSM.set_certificate()`` : ``/config/tls/cert.pem`` -- ``NetHSM.update()`` : ``/system/update`` +The NetHSM client is now managed in a `separate repo `__ diff --git a/nethsm-api.yaml b/nethsm-api.yaml deleted file mode 100644 index 2bbbd646..00000000 --- a/nethsm-api.yaml +++ /dev/null @@ -1,2595 +0,0 @@ -openapi: 3.0.0 -info: - title: NetHSM - version: v1 - description: | - All endpoints expect exactly the specified JSON. - Additional properties will cause a Bad Request Error (400). - All HTTP errors contain a JSON structure with an explanation of type string. - All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. -servers: - - url: https://{host}/api/{version} - variables: - host: - default: nethsmdemo.nitrokey.com - version: - default: v1 -paths: - /info: - get: - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/InfoData" - "406": - description: Content type in Accept header not supported. - description: Information about the vendor and product. - x-annotation-state: - - Locked - - Operational - - Unprovisioned - x-annotation-role: - - Public - /health/alive: - get: - responses: - "200": - description: Yes, it is alive. - "406": - description: Content type in Accept header not supported. - "412": - description: Not locked or unprovisioned (in operational state). - description: | - Retrieve wether NetHSM is alive (powered up). - This corresponds to the state *Locked* or *Unprovisioned*. - x-annotation-role: - - Public - x-annotation-state: - - Locked - - Unprovisioned - /health/ready: - get: - responses: - "200": - description: Yes, it is alive and ready. - "406": - description: Content type in Accept header not supported. - "412": - description: Not alive and ready (not in operational state). - description: | - Retrieve wether NetHSM is alive and ready to take traffic. - This corresponds to the state *Operational*. - x-annotation-role: - - Public - x-annotation-state: - - Operational - /health/state: - get: - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/HealthStateData" - "406": - description: Content type in Accept header not supported. - description: Retrieve the state of NetHSM. - x-annotation-role: - - Public - x-annotation-state: - - Locked - - Operational - - Unprovisioned - /metrics: - get: - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/MetricsData" - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: | - Get metrics. - Precondition: NetHSM is *Operational* and a **R-Metrics** can be authenticated. - security: - - basic: [] - x-annotation-role: - - Metrics - x-annotation-state: - - Operational - /provision: - post: - responses: - "204": - description: Provisioning was successful, NetHSM is *Operational* now. - "400": - description: Malformed request data (e.g. malformed time, weak passphrase). - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Unprovisioned*). - description: Initial provisioning, only available in *Unprovisioned* state. - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/ProvisionRequestData" - required: true - x-annotation-role: - - Public - x-annotation-state: - - Unprovisioned - /unlock: - post: - responses: - "204": - description: Unlock was successful, NetHSM is *Operational* now. - "400": - description: Bad request (invalid passphrase). - "403": - description: Unlock failed (access denied). - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Locked*). - description: Brings a *Locked* NetHSM into *Operational* state. - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/UnlockRequestData" - required: true - x-annotation-role: - - Public - x-annotation-state: - - Locked - /lock: - post: - responses: - "204": - description: Lock was successful, NetHSM is *Locked* now. - "401": - description: Authentication required but none provided. - "403": - description: Lock failed (access denied). - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: Brings an *Operational* NetHSM into *Locked* state. - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - /random: - post: - responses: - "200": - description: Successful request for *length* random bytes. - content: - application/json: - schema: - $ref: "#/components/schemas/RandomData" - "400": - description: Bad request (invalid length). - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: | - Retrieve cryptographically strong random bytes from NetHSM. - Precondition: NetHSM is *Operational* and a **R-Operator** can be authenticated. - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/RandomRequestData" - required: true - security: - - basic: [] - x-annotation-role: - - Operator - x-annotation-state: - - Operational - /keys: - get: - responses: - "200": - description: Successful request for the list of keys. - content: - application/json: - schema: - $ref: "#/components/schemas/KeyList" - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: | - Get a list of the identifiers of all keys that are currently stored in NetHSM. - Separate requests need to be made to request the individual key data. - parameters: - - name: filter - in: query - description: Only return keys that are can be used by the requester, according to restrictions. - schema: - type: string - security: - - basic: [] - x-annotation-role: - - Administrator - - Operator - x-annotation-state: - - Operational - post: - responses: - "201": - headers: - location: - description: Where to find the newly added key. - schema: - type: string - description: | - Successful import of a private key. - The response contains a Location header, - e.g. "https://nethsm.local/v1/keys/I8mhHYJ1T3uk2lXrwXehVaw9KZzg7K". - "400": - description: Bad request (specified properties are invalid). - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: | - Import a private key into NetHSM and let NetHSM generate a KeyID. - The public key will be automatically derived. - The parameters of the key can be passed as a PEM file or a JSON object. - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/PrivateKey" - application/x-pem-file: - schema: - $ref: "#/components/schemas/PemPrivateKey" - required: true - parameters: - - name: mechanisms - in: query - schema: - type: array - items: - $ref: "#/components/schemas/KeyMechanism" - - name: tags - in: query - schema: - type: array - items: - $ref: "#/components/schemas/ID" - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - /keys/generate: - post: - responses: - "201": - description: | - Successful creation of new public and private key pair. - Set Location header to the new KeyID. - headers: - location: - description: Where to find the newly added key. - schema: - type: string - "400": - description: Bad request (specified properties are invalid). - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: | - Generate a pair of public and private key and store it in NetHSM. - KeyID is optional as a parameter and will be generated by NetHSM if not present. - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/KeyGenerateRequestData" - required: true - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - /keys/{KeyID}: - get: - responses: - "200": - description: | - For response body with content type `application/json`: - * *RSA* keys include `modulus` and `publicExponent` properties. - * P* keys include the common format (0x04 followed by big-endian \ - encoded affine coordinates x and y). - * Curve25519 keys are 32 byte, and follow the RFC8032 5.1.2 encoding \ - (little endian, x over y). - content: - application/json: - schema: - $ref: "#/components/schemas/PublicKey" - examples: - rsa: - summary: "RSA" - value: - mechanisms: - - RSA_Signature_PSS_SHA256 - type: RSA - restrictions: - tags: - - berlin - key: - modulus: FhJQl11CiY0ifRHXeAqFh4rdSl6 - publicExponent: FhJQl11CiY0ifRHXeAqFh4rdSl6 - operations: 242 - - ecdsa: - summary: "P* Keys" - value: - mechanisms: - - ECDSA_Signature - type: EC_P224 - operations: 242 - restrictions: - tags: - - berlin - key: - data: BMKlPJ60PNFgsekRwg7n5mTIJkWWy6XLy0ORj14HumKi5qH63JaJzFOWLxYiaB6KH0NOgEKb7rUt - eddsa: - summary: "Curve25519" - value: - mechanisms: - - EdDSA_Signature - type: Curve25519 - operations: 242 - restrictions: - tags: - - berlin - key: - data: htnjTKRUz3XnLys5YD2+bKvzXZuu9cvXKwsCnWdzR+4= - generic: - summary: Generic - value: - mechanisms: - - AES_Encryption_CBC - - AES_Decryption_CBC - type: Generic - operations: 242 - restrictions: - tags: - - berlin - "400": - description: Invalid character in the KeyID. - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "404": - description: Key for KeyID not found. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: Retrieve the public key. - security: - - basic: [] - x-annotation-role: - - Administrator - - Operator - x-annotation-state: - - Operational - x-test-value-KeyID: myKey1 - put: - responses: - "204": - description: Successful import of a private key. - "400": - description: Bad request (specified properties are invalid). - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "406": - description: Content type in Accept header not supported. - "409": - description: Conflict, key already exists for this keyID. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: | - Import a private key into NetHSM and store it under the *KeyID* path. - The public key will be automatically derived. - The parameters of the key can be passed as a PEM file or a JSON object. - requestBody: - description: | - For request body with content type `application/json`: - * *RSA* includes `primeP`, `primeQ`, and `publicExponent` properties. - The remaining properties `privateExponent`, `modulus`, ..) are computed. - * *EC_P224*, *EC_P256*, *EC_P384*, *EC_P521* uses the `data` property. - Keys are the raw (big endian) scalar. - * *Curve25519* uses the `data` property. - Keys are the raw (little endian) key. - content: - application/json: - schema: - $ref: "#/components/schemas/PrivateKey" - examples: - rsa: - summary: RSA - value: - type: RSA - mechanisms: - - RSA_Signature_PSS_SHA256 - key: - primeP: AOnWFZ+JrI/xOXJU04uYCZOiPVUWd6CSbVseEYrYQYxc7dVroePshz29tc+VEOUP5T0O8lXMEkjFAwjW6C9QTAsPyl6jwyOQluMRIkdN4/7BAg3HAMuGd7VmkGyYrnZWW54sLWp1JD6XJG33kF+9OSar9ETPoVyBgK5punfiUFEL - primeQ: ANT1kWDdP9hZoFKT49dwdM/S+3ZDnxQa7kZk9p+JKU5RaU9e8pS2GOJljHwkES1FH6CUGeIaUi81tRKe2XZhe/163sEyMcxkaaRbBbTc1v6ZDKILFKKt4eX7LAQfhL/iFlgi6pcyUM8QDrm1QeFgGz11ChM0JuQw1WwkX06lg8iv - publicExponent: AQAB - restrictions: - tags: - - berlin - ecdsa: - summary: P* Keys - value: - type: EC_P224 - mechanisms: - - ECDSA_Signature - key: - data: "BgcqhkjOPQIBBgUrgQQAIQM6AATZOhHS/Sed4w==" - restrictions: - tags: - - berlin - eddsa: - summary: Curve25519 - value: - type: Curve25519 - mechanisms: - - EdDSA_Signature - key: - data: "m0o4HHT5tiwxxJ3hCzK6H9pXt9R854qyJ+q4Lmei/Kg=" - restrictions: - tags: - - berlin - application/x-pem-file: - schema: - $ref: "#/components/schemas/PemPrivateKey" - required: true - parameters: - - name: mechanisms - in: query - schema: - type: array - items: - $ref: "#/components/schemas/KeyMechanism" - - name: tags - in: query - schema: - type: array - items: - $ref: "#/components/schemas/ID" - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - x-test-value-KeyID: MyNewKey - delete: - responses: - "204": - description: Key was successfully deleted. - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "404": - description: Key for KeyID not found. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: Delete a pair of public and private key. - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - x-test-value-KeyID: myKey1 - parameters: - - name: KeyID - in: path - required: true - schema: - type: string - /keys/{KeyID}/public.pem: - get: - responses: - "200": - description: | - For response body with content type `application/x-pem-file`: - * Returns the PEM encoded public key, as specified in PKCS #8. - content: - application/x-pem-file: - schema: - $ref: "#/components/schemas/PemPublicKey" - "400": - description: Invalid character in the KeyID. - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "404": - description: Key for KeyID not found. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: Retrieve public key in PEM format. - security: - - basic: [] - x-annotation-role: - - Administrator - - Operator - x-annotation-state: - - Operational - x-test-value-KeyID: myKey1 - parameters: - - name: KeyID - in: path - required: true - schema: - type: string - /keys/{KeyID}/csr.pem: - post: - responses: - "200": - description: Successful generation of certificate signing request. - content: - application/x-pem-file: - schema: - $ref: "#/components/schemas/PemCSR" - "400": - description: Bad request (specified properties are invalid). - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "404": - description: Key for KeyID not found. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: Retrieve a certificate signing request in PEM format. - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/DistinguishedName" - required: true - security: - - basic: [] - x-annotation-role: - - Administrator - - Operator - x-annotation-state: - - Operational - x-test-value-KeyID: myKey1 - parameters: - - name: KeyID - in: path - required: true - schema: - type: string - /keys/{KeyID}/decrypt: - post: - responses: - "200": - description: | - For response body with content type `application/json`: - * Mode `RAW` returns the raw binary data. - * Mode `PKCS1` returns the raw binary data. - * Mode `OAEP_*` returns the raw binary data. - content: - application/json: - schema: - $ref: "#/components/schemas/DecryptData" - "400": - description: | - Bad Request, e.g. invalid encryption mode. - * Mode `RAW` returns failure if input is bigger than key size. - * Mode `PKCS1` returns failure if input is bigger than key size. - * Mode `OAEP_*` returns failure is input is bigger than key size. - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "404": - description: Key for KeyID not found. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: Decrypt an encrypted message with the secret key. - requestBody: - description: | - For request body with content type `application/json`: - * Mode `RAW` expects raw binary data. - * Mode `PKCS1` expects PKCS1-encoded and padded binary data. - * Mode `OAEP_*` expects EME-OAEP-encoded and padded binary data. - content: - application/json: - schema: - $ref: "#/components/schemas/DecryptRequestData" - required: true - security: - - basic: [] - x-annotation-role: - - Operator - x-annotation-state: - - Operational - x-test-value-KeyID: myKey1 - parameters: - - name: KeyID - in: path - required: true - schema: - type: string - /keys/{KeyID}/encrypt: - post: - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/EncryptData" - "400": - description: Bad Request, e.g. invalid mechanism. - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "404": - description: Key for KeyID not found. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: Encrypt a message with the secret key. - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/EncryptRequestData" - required: true - security: - - basic: [] - x-annotation-role: - - Operator - x-annotation-state: - - Operational - x-test-value-KeyID: MyAESKey - parameters: - - name: KeyID - in: path - required: true - schema: - type: string - /keys/{KeyID}/sign: - post: - responses: - "200": - description: | - For response body with content type `application/json`: - * Mode `PKCS1` returns the PKCS1 padded signature - (no signatureAlgorithm OID prepended, since the used hash is not known). - * Mode `PSS_*` returns the EMSA-PSS encoded signature. - * Mode `EdDSA` returns the RFC 8032 (5.1.6) encoding: - r appened with s, in total 64 bytes (each 32 bytes). - * Mode `ECDSA` returns the ASN.1 DER encoded signature - (a SEQUENCE of INTEGER r INTEGER s). - content: - application/json: - schema: - $ref: "#/components/schemas/SignData" - "400": - description: | - Bad Request, e.g. invalid signing mode. - * Mode `PKCS1` returns failure if input is bigger than key size - * Mode `PSS_*` returns failure if the input is not the hash length, - or the private key is smaller than hash length. - * Mode `ECDSA` returns failure if the input exceeds the group size in bits. - The hash algorithm is not part of the encoding. - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "404": - description: Key for KeyID not found. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: Sign a message with the secret key. - requestBody: - description: | - For request body with content type `application/json`: - * Mode `PKCS1` expects the already hashed data. - * Mode `PSS_*` expects the already hashed data. - * Mode `EdDSA` expects the raw message - (ED25519 applies the SHA512 hash internally, - also to derive the nonce). - * Mode `ECDSA` expects the hashed data - (using SHA224 for P224, SHA256 for P256, - SHA384 for P384 and SHA512 for P521). - content: - application/json: - schema: - $ref: "#/components/schemas/SignRequestData" - required: true - security: - - basic: [] - x-annotation-role: - - Operator - x-annotation-state: - - Operational - x-test-value-KeyID: myKey1 - parameters: - - name: KeyID - in: path - required: true - schema: - type: string - /keys/{KeyID}/cert: - get: - responses: - "200": - description: "" - content: - application/x-pem-file: - schema: - $ref: "#/components/schemas/PemCert" - application/x-x509-ca-cert: - schema: - type: string - application/pgp-keys: - schema: - $ref: "#/components/schemas/PGPPrivateKey" - "400": - description: Invalid character in the KeyID. - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "404": - description: Certificate for KeyID not found. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: | - Retrieve stored certificate. - The content-type header will display the media type of the stored data. - security: - - basic: [] - x-annotation-role: - - Administrator - - Operator - x-annotation-state: - - Operational - x-test-value-KeyID: myKey1 - put: - responses: - "201": - description: Successful import of a certificate. - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "406": - description: Content type in Accept header not supported. - "409": - description: Conflict, certificate already exists for this KeyID. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: | - Store a certificate. - Maximum size 1MB. - The content-type header provides the media type. - Only application/json, application/x-pem-file, application/x-x509-ca-cert, - application/octet-stream, text/plain and application/pgp-keys is allowed. - requestBody: - content: - application/x-pem-file: - schema: - $ref: "#/components/schemas/PemCert" - application/x-x509-ca-cert: - schema: - type: string - application/pgp-keys: - schema: - $ref: "#/components/schemas/PGPPrivateKey" - required: true - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - x-test-value-KeyID: myKey1 - delete: - responses: - "204": - description: Successful deletion of a certificate. - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "404": - description: Certificate with this KeyID not found. - "406": - description: Content type in Accept header not supported. - "409": - description: Certificate for key not found. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: Delete the certificate. - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - x-test-value-KeyID: myKey1 - parameters: - - name: KeyID - in: path - required: true - schema: - type: string - x-test-value: myKey1 - /keys/{KeyID}/restrictions/tags/{Tag}: - put: - responses: - "204": - description: Successful addition of the tag. - "304": - description: Tag is already present for this key. - "400": - description: Bad request, tag format is invalid. - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "404": - description: KeyID not found. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: Add a tag to the authorized set - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - x-test-value-KeyID: myKey1 - x-test-value-Tag: MyNewTag - delete: - responses: - "204": - description: Successful deletion of the tag. - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "404": - description: Tag or keyID not found. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: Delete a tag from the authorized set - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - x-test-value-KeyID: myKey1 - x-test-value-Tag: MyTag - parameters: - - name: Tag - in: path - required: true - schema: - type: string - - name: KeyID - in: path - required: true - schema: - type: string - /users: - get: - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/UserList" - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: Get a list of all user ids that have accounts on NetHSM. - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - post: - responses: - "201": - description: | - Successful creation of user. - The response contains a Location header, - e.g. "https://nethsm.local/v1/users/I8mhHYJ1T3uk2lXrwXehVaw9KZzg7K". - "400": - description: Bad request (specified properties are invalid, e.g. weak passphrase). - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: Create a new user on NetHSM. The user-ID is generated by NetHSM. - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/UserPostData" - required: true - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - /users/{UserID}: - get: - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/UserData" - - "400": - description: Invalid character in the UserID. - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "404": - description: User for UserID not found. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: "Get user info: name and role." - security: - - basic: [] - x-annotation-role: - - Administrator - - Operator - x-annotation-state: - - Operational - x-test-value-UserID: operator - put: - responses: - "201": - description: Successful creation of user. - "400": - description: Bad request (specified properties are invalid, e.g. weak passphrase). - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "406": - description: Content type in Accept header not supported. - "409": - description: Conflict - user already exists for this user-ID. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: Create a user on keyfender. - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/UserPostData" - required: true - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - x-test-value-UserID: newOperator - delete: - responses: - "204": - description: Successful deletion of user. - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "404": - description: User not found for this user-ID. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: Delete a user from keyfender. - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - x-test-value-UserID: operator - parameters: - - name: UserID - in: path - required: true - schema: - type: string - /users/{UserID}/passphrase: - post: - responses: - "204": - description: Successful change of passphrase. - "400": - description: Bad request - weak passphrase. - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "404": - description: User not found for this user-ID. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: Update the passphrase. - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/UserPassphrasePostData" - required: true - security: - - basic: [] - x-annotation-role: - - Administrator - - Operator - x-annotation-state: - - Operational - x-test-value-UserID: operator - parameters: - - name: UserID - in: path - required: true - schema: - type: string - /users/{UserID}/tags: - get: - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/TagList" - "400": - description: Invalid character in the UserID. - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "404": - description: User not found for this user-ID. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: Get the list of tags set to an Operator user. - security: - - basic: [] - x-annotation-role: - - Administrator - - Operator - x-annotation-state: - - Operational - x-test-value-UserID: operator - parameters: - - name: UserID - in: path - required: true - schema: - type: string - /users/{UserID}/tags/{Tag}: - put: - responses: - "204": - description: Successful addition of the tag. - "304": - description: Tag is already present for this UserID. - "400": - description: Bad request, tag format is invalid or user is not an operator. - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "404": - description: UserID not found. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: Add a tag to the Operator user. - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - x-test-value-UserID: operator - x-test-value-Tag: munich - delete: - responses: - "204": - description: Successful deletion of the tag. - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "404": - description: Tag or user not found. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: Delete a tag from the Operator user - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - x-test-value-UserID: operator - x-test-value-Tag: berlin - parameters: - - name: UserID - in: path - required: true - schema: - type: string - - name: Tag - in: path - required: true - schema: - type: string - /config/unlock-passphrase: - put: - responses: - "204": - description: Successful change of passphrase. - "400": - description: Bad request - weak passphrase. - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: Update the unlock passphrase. - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/UnlockPassphraseConfig" - required: true - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - /config/unattended-boot: - get: - responses: - "200": - description: Successful read of unattended boot configuration. - content: - application/json: - schema: - $ref: "#/components/schemas/UnattendedBootConfig" - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: "Read unattended boot configuration: is it on or off?" - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - put: - responses: - "204": - description: Successful change of unattended boot mode. - "400": - description: Bad request - invalid status setting. - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: "Configure unattended boot: switch it on or off (flip the switch)." - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/UnattendedBootConfig" - required: true - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - /config/tls/public.pem: - get: - responses: - "200": - description: Successful retrieval of public key. - content: - application/x-pem-file: - schema: - $ref: "#/components/schemas/PemPublicKey" - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: Get public key for NetHSMs https API. - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - /config/tls/cert.pem: - get: - responses: - "200": - description: Successful retrieval of certificate. - content: - application/x-pem-file: - schema: - $ref: "#/components/schemas/PemCert" - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - "415": - description: Content type in Accept header not supported or not present. - description: Get certificate for NetHSMs https API. - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - put: - responses: - "201": - description: Successfully set certificate. - "400": - description: Certificate malformed. - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: Set certificate for NetHSMs https API e.g. to replace self-signed intital certificate. - requestBody: - content: - application/x-pem-file: - schema: - $ref: "#/components/schemas/PemCert" - required: true - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - /config/tls/csr.pem: - post: - responses: - "200": - description: Successful generation of certificate signing request. - content: - application/x-pem-file: - schema: - $ref: "#/components/schemas/PemCSR" - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: Get NetHSM certificate signing request e.g. to replace self-signed intital certificate. - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/DistinguishedName" - required: true - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - /config/tls/generate: - post: - responses: - "204": - description: Successful creation of new public and private key pair for NetHSM's https API. - "400": - description: Bad request (specified properties are invalid). - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: Generate a new pair of public and private key for NetHSM's https API. - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/TlsKeyGenerateRequestData" - required: true - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - /config/network: - get: - responses: - "200": - description: Successful retrieval of network configuration. - content: - application/json: - schema: - $ref: "#/components/schemas/NetworkConfig" - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: Get network configuration. IP address, netmask, router. - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - put: - responses: - "204": - description: Succesful update of network configuration. - "400": - description: Bad request - invalid input format. - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: Configure network. - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/NetworkConfig" - required: true - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - /config/logging: - get: - responses: - "200": - description: Successful retrieval of logging configuration. - content: - application/json: - schema: - $ref: "#/components/schemas/LoggingConfig" - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: | - Get logging configuration. - Protocol is always syslog over UDP. - Configurable are IP adress and port, log level. - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - put: - responses: - "204": - description: Succesful update of logging configuration. - "400": - description: Bad request - invalid input format. - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: Configure log level and destination. - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/LoggingConfig" - required: true - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - /config/backup-passphrase: - put: - responses: - "204": - description: Successful change of passphrase. - "400": - description: Bad request - weak passphrase. - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: Update the backup passphrase. - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/BackupPassphraseConfig" - required: true - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - /config/time: - get: - responses: - "200": - description: Successful retrieval of system time. - content: - application/json: - schema: - $ref: "#/components/schemas/TimeConfig" - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: Get system time. - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - put: - responses: - "204": - description: Succesful update of system time. - "400": - description: Bad request - invalid input format. - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: Configure system time. - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/TimeConfig" - required: true - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - /system/info: - get: - responses: - "200": - description: Successful retrieval of system information. - content: - application/json: - schema: - $ref: "#/components/schemas/SystemInfo" - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: | - Get detailed system information, including firmware, system, and hardware version. - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - /system/reboot: - post: - responses: - "204": - description: About to reboot NetHSM. - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: Reboot NetHSM. - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - /system/shutdown: - post: - responses: - "204": - description: About to shut down NetHSM. - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: Shut down NetHSM. - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - /system/factory-reset: - post: - responses: - "204": - description: About to reset NetHSM. - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "406": - description: Content type in Accept header not supported. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: Reset NetHSM to factory settings. - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - /system/update: - post: - responses: - "200": - description: Successfully verified update image (authenticity, integrity, and version number). - content: - application/json: - schema: - $ref: "#/components/schemas/SystemUpdateData" - "400": - description: Update malformed. - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "406": - description: Content type in Accept header not supported. - "409": - description: Conflict - Major version downgrade is not allowed. - "412": - description: Precondition failed (NetHSM was not *Operational*). - description: Update NetHSM software. - requestBody: - content: - application/octet-stream: - schema: - type: string - required: true - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - /system/commit-update: - post: - responses: - "204": - description: About to update NetHSM. - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "406": - description: Content type in Accept header not supported. - "412": - description: | - Precondition failed (NetHSM was not *Operational* or - update image is not present - call `/update` first). - description: Commit update of NetHSM software. - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - /system/cancel-update: - post: - responses: - "204": - description: Update successfully cancelled. - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "406": - description: Content type in Accept header not supported. - "412": - description: | - Precondition failed (NetHSM was not *Operational* or - update image is not present - call `/update` first). - description: Cancel update of NetHSM software. - security: - - basic: [] - x-annotation-role: - - Administrator - x-annotation-state: - - Operational - /system/backup: - post: - responses: - "200": - description: Successful retrieval of backup data. - "401": - description: Authentication required but none provided. - "403": - description: Access denied. - "406": - description: Content type in Accept header not supported. - "412": - description: | - Precondition failed (NetHSM was not *Operational* or - *Backup Passphrase* was not set). - description: Back up the key store to a backup file. - security: - - basic: [] - x-annotation-role: - - Backup - x-annotation-state: - - Operational - /system/restore: - post: - responses: - "204": - description: Successful restore from backup data. - "400": - description: Bad request - restore did not apply. - "406": - description: Content type in Accept header not supported. - "412": - description: | - Precondition failed (NetHSM was not *Unprovisioned* or - *Operational*). - description: | - Restore the key store and user store from a backup file. If NetHSM is - *Unprovisioned*, then the configuration is restored. - requestBody: - content: - application/octet-stream: - schema: - type: string - required: true - parameters: - - name: backupPassphrase - in: query - required: true - schema: - $ref: "#/components/schemas/Passphrase" - - name: systemTime - in: query - schema: - type: string - format: date-time - x-annotation-role: - - Public - x-annotation-state: - - Unprovisioned - - Operational -components: - schemas: - Passphrase: - minLength: 1 - type: string - ID: - pattern: ^[a-zA-Z0-9]+$ - minLength: 1 - maxLength: 128 - type: string - Base64: - pattern: ^[a-zA-Z0-9+/]+={0,3}$ - type: string - Switch: - enum: - - "on" - - "off" - type: string - SystemState: - enum: - - Unprovisioned - - Locked - - Operational - type: string - UserRole: - enum: - - Administrator - - Operator - - Metrics - - Backup - type: string - LogLevel: - enum: - - debug - - info - - warning - - error - type: string - KeyType: - enum: - - RSA - - Curve25519 - - EC_P224 - - EC_P256 - - EC_P384 - - EC_P521 - - Generic - type: string - TlsKeyType: - enum: - - RSA - - Curve25519 - - EC_P224 - - EC_P256 - - EC_P384 - - EC_P521 - type: string - KeyMechanism: - enum: - - RSA_Decryption_RAW - - RSA_Decryption_PKCS1 - - RSA_Decryption_OAEP_MD5 - - RSA_Decryption_OAEP_SHA1 - - RSA_Decryption_OAEP_SHA224 - - RSA_Decryption_OAEP_SHA256 - - RSA_Decryption_OAEP_SHA384 - - RSA_Decryption_OAEP_SHA512 - - RSA_Signature_PKCS1 - - RSA_Signature_PSS_MD5 - - RSA_Signature_PSS_SHA1 - - RSA_Signature_PSS_SHA224 - - RSA_Signature_PSS_SHA256 - - RSA_Signature_PSS_SHA384 - - RSA_Signature_PSS_SHA512 - - EdDSA_Signature - - ECDSA_Signature - - AES_Encryption_CBC - - AES_Decryption_CBC - type: string - EncryptMode: - enum: - - AES_CBC - type: string - DecryptMode: - enum: - - RAW - - PKCS1 - - OAEP_MD5 - - OAEP_SHA1 - - OAEP_SHA224 - - OAEP_SHA256 - - OAEP_SHA384 - - OAEP_SHA512 - - AES_CBC - type: string - SignMode: - enum: - - PKCS1 - - PSS_MD5 - - PSS_SHA1 - - PSS_SHA224 - - PSS_SHA256 - - PSS_SHA384 - - PSS_SHA512 - - EdDSA - - ECDSA - type: string - KeyList: - example: - - key: KeyID - type: array - items: - $ref: "#/components/schemas/KeyItem" - KeyItem: - example: - key: KeyID - type: object - properties: - key: - $ref: "#/components/schemas/ID" - required: - - key - KeyRestrictions: - type: object - properties: - tags: - $ref: "#/components/schemas/TagList" - UserList: - example: - - user: admin - - user: backup - - user: metrics - - user: operator - type: array - items: - $ref: "#/components/schemas/UserItem" - UserItem: - type: object - properties: - user: - $ref: "#/components/schemas/ID" - required: - - user - TagList: - example: - - berlin - - frankfurt - type: array - items: - $ref: "#/components/schemas/ID" - KeyMechanisms: - type: array - items: - $ref: "#/components/schemas/KeyMechanism" - PrivateKey: - example: - mechanisms: - - RSA_Signature_PSS_SHA256 - type: RSA - key: - primeP: AOnWFZ+JrI/xOXJU04uYCZOiPVUWd6CSbVseEYrYQYxc7dVroePshz29tc+VEOUP5T0O8lXMEkjFAwjW6C9QTAsPyl6jwyOQluMRIkdN4/7BAg3HAMuGd7VmkGyYrnZWW54sLWp1JD6XJG33kF+9OSar9ETPoVyBgK5punfiUFEL - primeQ: ANT1kWDdP9hZoFKT49dwdM/S+3ZDnxQa7kZk9p+JKU5RaU9e8pS2GOJljHwkES1FH6CUGeIaUi81tRKe2XZhe/163sEyMcxkaaRbBbTc1v6ZDKILFKKt4eX7LAQfhL/iFlgi6pcyUM8QDrm1QeFgGz11ChM0JuQw1WwkX06lg8iv - publicExponent: AQAB - restrictions: - tags: - - berlin - type: object - properties: - mechanisms: - $ref: "#/components/schemas/KeyMechanisms" - type: - $ref: "#/components/schemas/KeyType" - key: - $ref: "#/components/schemas/KeyPrivateData" - restrictions: - $ref: "#/components/schemas/KeyRestrictions" - required: - - mechanisms - - type - - key - KeyPrivateData: - type: object - properties: - primeP: - $ref: "#/components/schemas/Base64" - primeQ: - $ref: "#/components/schemas/Base64" - publicExponent: - $ref: "#/components/schemas/Base64" - data: - $ref: "#/components/schemas/Base64" - PublicKey: - example: - mechanisms: - - RSA_Signature_PSS_SHA256 - type: RSA - restrictions: - tags: - - berlin - key: - modulus: FhJQl11CiY0ifRHXeAqFh4rdSl6 - publicExponent: FhJQl11CiY0ifRHXeAqFh4rdSl6 - operations: 242 - type: object - properties: - mechanisms: - $ref: "#/components/schemas/KeyMechanisms" - type: - $ref: "#/components/schemas/KeyType" - restrictions: - $ref: "#/components/schemas/KeyRestrictions" - key: - $ref: "#/components/schemas/KeyPublicData" - operations: - type: integer - required: - - mechanisms - - type - - restrictions - - operations - KeyPublicData: - description: | - The public key data is either a *modulus* and a *publicExponent* or - a *data* field. The *data* field is used for EC keys. - This field is null for Generic keys. - type: object - properties: - modulus: - $ref: "#/components/schemas/Base64" - publicExponent: - $ref: "#/components/schemas/Base64" - data: - $ref: "#/components/schemas/Base64" - DistinguishedName: - example: - countryName: DE - stateOrProvinceName: "" - localityName: Berlin - organizationName: Nitrokey - organizationalUnitName: "" - commonName: nethsm.local - emailAddress: info@nitrokey.com - type: object - properties: - countryName: - type: string - stateOrProvinceName: - type: string - localityName: - type: string - organizationName: - type: string - organizationalUnitName: - type: string - commonName: - type: string - emailAddress: - type: string - required: - - commonName - InfoData: - example: - vendor: Nitrokey GmbH - product: NetHSM - type: object - properties: - vendor: - type: string - product: - type: string - required: - - vendor - - product - HealthStateData: - example: - state: Unprovisioned - type: object - properties: - state: - $ref: "#/components/schemas/SystemState" - required: - - state - MetricsData: - example: - keyOperations: 1132412 - someOtherMetric: 2222 - type: object - ProvisionRequestData: - example: - unlockPassphrase: UnlockPassphrase - adminPassphrase: Administrator - systemTime: "2018-10-30T11:20:50Z" - type: object - properties: - unlockPassphrase: - $ref: "#/components/schemas/Passphrase" - adminPassphrase: - $ref: "#/components/schemas/Passphrase" - systemTime: - type: string - format: date-time - required: - - unlockPassphrase - - adminPassphrase - - systemTime - UnlockRequestData: - example: - passphrase: UnlockPassphrase - type: object - properties: - passphrase: - $ref: "#/components/schemas/Passphrase" - required: - - passphrase - RandomRequestData: - example: - length: 5 - type: object - properties: - length: - minimum: 1 - maximum: 1024 - type: integer - required: - - length - RandomData: - example: - random: VGhlIHE= - type: object - properties: - random: - $ref: "#/components/schemas/Base64" - required: - - random - KeyGenerateRequestData: - example: - mechanisms: - - RSA_Signature_PSS_SHA256 - type: RSA - length: 2048 - id: myKey2 - type: object - properties: - mechanisms: - $ref: "#/components/schemas/KeyMechanisms" - type: - $ref: "#/components/schemas/KeyType" - length: - minimum: 128 - maximum: 8192 - type: integer - id: - $ref: "#/components/schemas/ID" - restrictions: - $ref: "#/components/schemas/KeyRestrictions" - required: - - mechanisms - - type - TlsKeyGenerateRequestData: - example: - type: RSA - length: 2048 - type: object - properties: - type: - $ref: "#/components/schemas/TlsKeyType" - length: - minimum: 128 - maximum: 8192 - type: integer - required: - - type - EncryptRequestData: - example: - mode: AES_CBC - message: nhrfotu32409ru0rgert45z54z099u23r03498uhtrq= - iv: aYlwUI4A9zL9tjs4dMAq+A== - type: object - properties: - mode: - $ref: "#/components/schemas/EncryptMode" - message: - $ref: "#/components/schemas/Base64" - iv: - $ref: "#/components/schemas/Base64" - required: - - mode - - message - EncryptData: - example: - encrypted: HQsTMBVvk19G9wrVQXPT0sDfjIglsJyZJl+VNWVSc0s= - iv: aYlwUI4A9zL9tjs4dMAq+A== - type: object - properties: - encrypted: - $ref: "#/components/schemas/Base64" - iv: - $ref: "#/components/schemas/Base64" - required: - - encrypted - - iv - DecryptRequestData: - example: - mode: RAW - encrypted: nhrfotu32409ru0rgert45z54z099u23r03498uhtr== - type: object - properties: - mode: - $ref: "#/components/schemas/DecryptMode" - encrypted: - $ref: "#/components/schemas/Base64" - iv: - $ref: "#/components/schemas/Base64" - required: - - mode - - encrypted - DecryptData: - example: - decrypted: IBCS8Sc4NkG/O+kqInz7mq/+Pr+5eJUJ/QpfwMp7pPjLn02U7ggyUrxJfN97MChHGekvGEK4Q1LCJ2juHTgjxJ94/QoEAN0dWZ7x3NxjlUgw7yBm7ylldVvToum3lWOVo3wPm5ozSGxpslrqgz2Rid9+uH5ytV8//CrkMOlqlUoj0DWMYbp/sUbYDGwG8lcfvKua67AxT3X/exSKCAwBuxPBr2p3DCTHepdmZCyexL809ZvBRopOQ41ve9X1jXqKzihrCPeoCwEok06EGYhPt3/EKFoer401S0MYtz5J1BvO1cv7ITDOYUCG4Ze8aXEjtnt6MMRx4jY7IqssYO8GrA== - type: object - properties: - decrypted: - $ref: "#/components/schemas/Base64" - required: - - decrypted - SignRequestData: - example: - mode: PKCS1 - message: nhrfotu32409ru0rgert45z54z099u23r03498uhtr== - type: object - properties: - mode: - $ref: "#/components/schemas/SignMode" - message: - $ref: "#/components/schemas/Base64" - required: - - mode - - message - SignData: - example: - signature: n4geMX1g8zcfipfcmn+XjM1ccWZULemAa0cuYoh1aXG9UhbE6f54NMp4NjboLf63SQyieJYjjV8q+/o1rFlkZCtKtHAheds+g90zdjOMmXFlXyBTKMhGOSHuleGz0c99x7Alg19KN9wB3Jj2niwweBOR/F4Qv0mdBUv+oO8uPl6vM1fS4tX/VJoCZkDnZzL8duKRNFT0SNQZ+ryLiqQMG53fEPhTplK/wK0Cco8JAYCMh9cxSzpBoCEO+9woxoBGehAjHuLxs6ed6q08W67leuibxZ8c6Q6upmwDlca/gSw0y4w1VIxxts2PORZdNsTWcr3lojcNgWXJcfAqF9/n4A== - type: object - properties: - signature: - $ref: "#/components/schemas/Base64" - required: - - signature - UserPostData: - example: - realName: Jane User - role: Administrator - passphrase: My cool passphrase - type: object - properties: - realName: - type: string - role: - $ref: "#/components/schemas/UserRole" - passphrase: - $ref: "#/components/schemas/Passphrase" - required: - - realName - - role - - passphrase - UserData: - example: - realName: Jane User - role: Administrator - type: object - properties: - realName: - type: string - role: - $ref: "#/components/schemas/UserRole" - required: - - realName - - role - UserPassphrasePostData: - example: - passphrase: Some cool new passphrase - type: object - properties: - passphrase: - $ref: "#/components/schemas/Passphrase" - required: - - passphrase - UnlockPassphraseConfig: - example: - passphrase: This is my unlock passphrase - type: object - properties: - passphrase: - $ref: "#/components/schemas/Passphrase" - required: - - passphrase - UnattendedBootConfig: - example: - status: "off" - type: object - properties: - status: - $ref: "#/components/schemas/Switch" - required: - - status - NetworkConfig: - example: - ipAddress: 192.168.1.1 - netmask: 255.255.255.0 - gateway: 0.0.0.0 - type: object - properties: - ipAddress: - type: string - netmask: - type: string - gateway: - type: string - required: - - ipAddress - - netmask - - gateway - LoggingConfig: - example: - ipAddress: 0.0.0.0 - port: 514 - logLevel: info - type: object - properties: - ipAddress: - type: string - port: - type: integer - logLevel: - $ref: "#/components/schemas/LogLevel" - required: - - ipAddress - - port - - logLevel - BackupPassphraseConfig: - example: - passphrase: This is my backup passphrase - type: object - properties: - passphrase: - $ref: "#/components/schemas/Passphrase" - required: - - passphrase - TimeConfig: - example: - time: "2018-10-30T11:20:50Z" - type: object - properties: - time: - type: string - format: date-time - required: - - time - SystemInfo: - example: - softwareVersion: "1.7" - softwareBuild: f3f6292 - firmwareVersion: 1.0-devel - hardwareVersion: prodrive-hermes-1.0 - deviceId: 5UMIP364R2 - akPub: - P256: MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEup7z8QYvkzkBuLryG1SgVQjlPhSFW3PzYn1l3uLNd+pSBxX0OBpslcbnmPFr5wSs/iP46+H8MFlEAYUkYv6uuQ== - P384: MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEfQiurLvEmjsAmumRtIqu70HKehRo8A/nVrqQGiR8Rcr+SUujwgtQByORX5BoRtv4sZNJW4FyLGqvXCIF9IV1puob2+9Qq5oEjz4x4malLbFdyXDmQK8o2NpvcbgOr215 - pcr: - 0: 0f6064779fba55b102a6ecc20498c2020deaf2aebef23716ec293b25873647f8 - 2: 2b0d25a4a92b4df5205742954243db9d306a4c3277a6b6958bcbaf3d47def26f - type: object - properties: - softwareVersion: - type: string - softwareBuild: - type: string - firmwareVersion: - type: string - hardwareVersion: - type: string - deviceId: - type: string - akPub: - type: object - pcr: - type: object - required: - - softwareVersion - - softwareBuild - - firmwareVersion - - hardwareVersion - - deviceId - - akPub - - pcr - SystemUpdateData: - example: - releaseNotes: Some new feature is available. - type: object - properties: - releaseNotes: - type: string - required: - - releaseNotes - PemPrivateKey: - example: | - -----BEGIN RSA PRIVATE KEY----- - MIIEpAIBAAKCAQEAseU3o1Ix2euXUi50ht/mpDYnE2J4maJrIOLmDrmz+jv20hsR - vPsWnKevYZqEYmvQFNO2Mv9DB5MZfnJ3jL3Aq71Ls1wqOnW9++bZAvqvEVUtlHh0 - 5Rz9k1Ga32/OaHHEZj+lG9PlKI8y63K+sKZLuDYiVy1/gzARjpf2hCmTyQSAvtcA - 07WXAqorNI8mhcbIhnrGCeKfB8HYJ1T3uk2lXrwXehVaw9KZzg7KuRO0Qnk+IfR6 - LZjiKiEB9malzqSx3N20vibI672bMR+fqID2oC+ovNOEdRhPlCnztaY1HsnDhJt8 - MDTjlVGveCElvesuSVnNVHmVugDjEYTU1KV3TwIDAQABAoIBAQClSL5QDX9p5R28 - apMz+XYW3oWh2h0JScHVVVvBFMNm3S3vet0ZRAV3Wcl2mxUjSN6Vazte2JKTyBWo - yXvQFUGdj4x1Qk2t8VWqZYr93KKqLQTjbKPXd/8WUHzf2sbhfcqn4bxrRY4mCB6c - aglIocm6hvmTHB/caN33KbQOiX7ZBbwoZG3AKgoJU3SMXnVUfQzl/xnVrWLKESqm - 5kL0OTGLP091jZyMhcceh54RIuaJjPU4opL0bm46DLeQE4z20GfGCcRK/CUt4bNc - c0wvuOyyzGI5p7QB/HCUJqR33m9ydwDkqC4vrORDxpMaSRNerpoGA+cNHREULh2P - gaPydXq5AoGBAN3xIhci5LpIVvscNjPyxD6WQq5EZx251IzTnwQ/5E/+qxfYHvwe - qAuLJ2+QvNQBuNKk85jwZsfUgPR6kku9dOt3n61lnrBRgGcqWnR0j8/NbpVe1qOe - WArLeijpKKnCZ6uwpE6NND398dCmm3WLZZH64+1eLT8PbX/AIzId5zyzAoGBAM0x - vWEsKi4pjNMBdaawJMbHEoDmMuib4t+FkbHDkqqSe/OIkHZ9tDQuHWpzDHmb30Na - KNwQSNLwu3QK64z1NcjZUJFmu0+3NxSyI/EvNA9tiGCT5iSonsz04oa51AYt+IK5 - 7JjMjo128INrQwtRFSYHx3hoVVW06tZNE037NiD1AoGABqeNOx5bt04l9X+CDIqx - 4aKFu03nvZdtzQ8nTGxR/ygGnz9mpm6Q4U+5zfmL/9tRXFd/yk0i98jiWPI34rd6 - gvjiO8O5P1YiQHWforBAA54IO8hNLTi5MRGqxwE+q+BdVWOFeal4MIelsXjdXmfg - ksDwBpT1TFe9E8CCDaWh4ksCgYAhHCiR2H2J61x04+RnHD8i8BZ1RC/sxtKp/LSQ - uZ0d9vsXRe8Bn7EHRnWqqpvVt6gkBxVWxS3rE7s7s1Nk8GBYY3CTtb790vOJXGFe - Vp6Q6ry50MOvIKJXMiCnWq7yvFJATd32nfNWsl2G5zTvS4sdEt5F+Jfkd4f5QoCd - 8a4/TQKBgQDEdY3XTibkDt80zUFIP6RRAyfM6p2grk+o08De0BBZD/1GX9V9ARNT - bC3+2qXXDYGxbMWgsoqsQTREJD78+sdD3q+IfIc1m7XvuIgyLMAalm+Kd1HlUF/J - 7VCKjgchT0OKwmi0d52TEOiz6U35Jv4GWBstsh1KVpHYiTnwnhAwKg== - -----END RSA PRIVATE KEY----- - type: string - PemPublicKey: - example: | - -----BEGIN PUBLIC KEY----- - MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx7ghfro+VEepYmy2V7HP - n5PSRdmGzxewcpmzxTtrZ10BygbEqhPsAr4fWI9pG7iRXzeza7DMjrQptzKsfSy6 - dBFmSEZer+hJxuOdhBG/FX6pjwRrZpbOQxyr+aTlE3jm2XP12Cqx0wsYGIoJlWHb - Gb90IAx9zpdYQgHoJZ4x5ims5vo7h3puPEyVycJH5fMBB9h+2Bxc4BxaPKMm15JR - 1B7ToB3g16SJY2B1t/aqNmqSBZC4HP1fCuSbBm83OgqRhdk1P6r/vqOVKrxVupDq - Kkdcf/dRBiQalJ9tQbVbs9OOYfQ6n25GvJTvGtqOEuggit32tV16JXCZjnYePAvt - NwIDAQAB - -----END PUBLIC KEY----- - type: string - PemCSR: - example: | - -----BEGIN CERTIFICATE REQUEST----- - MIICpzCCAY8CAQAwYjFgMAkGA1UEBhMCREUwDQYDVQQHDAZCZXJsaW4wDwYDVQQK - DAhOaXRyb2tleTATBgNVBAMMDG5ldGhzbS5sb2NhbDAeBgkqhkiG9w0BCQEWEWlu - Zm9Abml0cm9rZXkuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA - x7ghfro+VEepYmy2V7HPn5PSRdmGzxewcpmzxTtrZ10BygbEqhPsAr4fWI9pG7iR - Xzeza7DMjrQptzKsfSy6dBFmSEZer+hJxuOdhBG/FX6pjwRrZpbOQxyr+aTlE3jm - 2XP12Cqx0wsYGIoJlWHbGb90IAx9zpdYQgHoJZ4x5ims5vo7h3puPEyVycJH5fMB - B9h+2Bxc4BxaPKMm15JR1B7ToB3g16SJY2B1t/aqNmqSBZC4HP1fCuSbBm83OgqR - hdk1P6r/vqOVKrxVupDqKkdcf/dRBiQalJ9tQbVbs9OOYfQ6n25GvJTvGtqOEugg - it32tV16JXCZjnYePAvtNwIDAQABoAAwDQYJKoZIhvcNAQELBQADggEBABVz67ib - ngef9acHkwTYHHQk3MHxQRSLOxUKoDjk1URMgJ2hgL5HR91yQ3gBPxVuEGWdEQXJ - C4sM9S3OoM5yFJFj56Y8MaASHFo58V5N1FaFqf3BbVKNzM4Jgrtghw1teJU45xZR - 0+sjA0YjVJwGnNXfBJdQVNXgWJcXy4bmPSaF7khxDnoP7dmxMcpQ2HKL8X9E/kef - KOhz+HtlCWoqwD77aR3wKrYWdn+fwMeTRGNpJLPdKl7vyleb8pjtWUYnNTIP4Zh+ - BLX93udZxl8sVpJBnLcIWplwJB16hxk5ZODjWUOrhkwZ0MbiPFbKkihc8GMLLEyp - dHRjrbgAUrx5DuY= - -----END CERTIFICATE REQUEST----- - type: string - PemCert: - example: | - -----BEGIN CERTIFICATE----- - MIIEvDCCAqQCCQCZ9VKHZSKydDANBgkqhkiG9w0BAQsFADAgMQ4wDAYDVQQIDAVo - ZWxsbzEOMAwGA1UEBwwFaGVsbG8wHhcNMTgxMDMwMTI0MDQ3WhcNMTkxMDMwMTI0 - MDQ3WjAgMQ4wDAYDVQQIDAVoZWxsbzEOMAwGA1UEBwwFaGVsbG8wggIiMA0GCSqG - SIb3DQEBAQUAA4ICDwAwggIKAoICAQC8WRImgeu4U6Yg5q0/SvoieQL5JwPHaCrN - 6Cc0mj8pnzTBu/f0QYNentcnu0EclD99kla6/gdiJnt0b/IT23o37+t2n0BvEgVQ - MJxJ/BjIqSZCykq4SWHKia1OS7tJKE2Q/hgGq/RQJ0zecWKA9SuafXDt0plw0saz - P8ZosFyToMYnPB54SzXj4qeD5t2L2dOamTTyziw/GJDGdwssImEDfeWyMRRyHcIa - u9HNGaTxjCdBGzCR+PEX3ZHhGzl5iMlgtZUICgXMgAvFZHHEYNtyCW9ZzUB2ZKE2 - nMbu8hbl7GXRCdJaAqlJfKiGp/WvbmrLhCzcwqhu4UnqGXOxeEQryrkPAbiLafqb - fPLHB7dr8OEGlUzp1SCHR1JxwdBVohuO2lL+O5nMD3ZVdVnh2F5Et6I9lO4w9+5n - aI6pmO4oy9PsqKvUjxVnEeo1Ee1n9o/4T6fe6XBIQLPqEmy2IXynZP0eJn1Yu9SF - TkTSmJ+jRiU7EMaagQrM4Ds5seVNVWKOvUjDQCV+QRZaaPcrkMoFtjLCVMhLgy7M - /Dfl63qCcdVkPwdbI/apjfG8qMrez4k3qAZDYgS3fujyuq9wv7xbq2+o0Ck4Ono2 - mMAA6JDSZr8XwR3ac/UK1KGv+weh1fOVO+c6mSN9M+W1MtkJS+i4/Aj2yDCJzVk3 - GZpd5/E6WwIDAQABMA0GCSqGSIb3DQEBCwUAA4ICAQAB+8+1dk20P6R+RvDRs1mo - e1CegaPH2bl9t1WVuXJIUkrIGDceVr5f19pcaNQRYwZuoQd8VQXCZUpWbo//TWxl - ItS3prQgcrfcTi7gCzp1+q1bZk6H21tzESDJTXPFp019/ypdUB4Jsty7qQL73sE3 - nj67DH+srPCknAhfFag0dPOOjAY19IrIomtBMlvYNpb5XupEUAQFCjk6VdLVAzzl - M5Swj+kmLA0OUHTF2zAwj2k+B9RAkbetu/lXLwUiiQNG00j8YP03lErxDd29m2jl - NFlSn8YYsgzmihF5fUFTJXP5tS7lF4FnLNbw9pfdeVZBT1uTOcckmFv6n6edttZS - FhC70hBB8tFFtemGFquZ0N7w8O7DmIYI936n283rzxyuWdi+JqOUQ0KzpGbFOP3t - AOdVcx/JW8kjDdWRcRDr85M4MnkG6HEzW4uzGBtxBplL7KH0L8LX+lx6ySjIrbRD - QtwBxwZGtHZJAqskO6vobzzybCKuVUaQwkPrQsK5iLA6Nn1Yxu6XmtlvoPeNIc63 - Pa3ix8vNFbBTtS6iBdbOPse5qgRV0DC94ocedzKw4QzQRa5REIniJ2X8hVoVAcBh - 3nQKyZApl2I/pZMlbZ0Cg5yxjhBaxKwci7jyoMerMMo2EdbZN87gP+2x6tKuY1MO - 35mqzHn+FjWq0eAtpzhO5Q== - -----END CERTIFICATE----- - type: string - PGPPrivateKey: - example: | - -----BEGIN PGP PRIVATE KEY BLOCK----- - Version: GnuPG v2 - - MIIEvDCCAqQCCQCZ9VKHZSKydDANBgkqhkiG9w0BAQsFADAgMQ4wDAYDVQQIDAVo - ZWxsbzEOMAwGA1UEBwwFaGVsbG8wHhcNMTgxMDMwMTI0MDQ3WhcNMTkxMDMwMTI0 - MDQ3WjAgMQ4wDAYDVQQIDAVoZWxsbzEOMAwGA1UEBwwFaGVsbG8wggIiMA0GCSqG - SIb3DQEBAQUAA4ICDwAwggIKAoICAQC8WRImgeu4U6Yg5q0/SvoieQL5JwPHaCrN - 6Cc0mj8pnzTBu/f0QYNentcnu0EclD99kla6/gdiJnt0b/IT23o37+t2n0BvEgVQ - MJxJ/BjIqSZCykq4SWHKia1OS7tJKE2Q/hgGq/RQJ0zecWKA9SuafXDt0plw0saz - P8ZosFyToMYnPB54SzXj4qeD5t2L2dOamTTyziw/GJDGdwssImEDfeWyMRRyHcIa - u9HNGaTxjCdBGzCR+PEX3ZHhGzl5iMlgtZUICgXMgAvFZHHEYNtyCW9ZzUB2ZKE2 - nMbu8hbl7GXRCdJaAqlJfKiGp/WvbmrLhCzcwqhu4UnqGXOxeEQryrkPAbiLafqb - fPLHB7dr8OEGlUzp1SCHR1JxwdBVohuO2lL+O5nMD3ZVdVnh2F5Et6I9lO4w9+5n - aI6pmO4oy9PsqKvUjxVnEeo1Ee1n9o/4T6fe6XBIQLPqEmy2IXynZP0eJn1Yu9SF - TkTSmJ+jRiU7EMaagQrM4Ds5seVNVWKOvUjDQCV+QRZaaPcrkMoFtjLCVMhLgy7M - /Dfl63qCcdVkPwdbI/apjfG8qMrez4k3qAZDYgS3fujyuq9wv7xbq2+o0Ck4Ono2 - mMAA6JDSZr8XwR3ac/UK1KGv+weh1fOVO+c6mSN9M+W1MtkJS+i4/Aj2yDCJzVk3 - GZpd5/E6WwIDAQABMA0GCSqGSIb3DQEBCwUAA4ICAQAB+8+1dk20P6R+RvDRs1mo - e1CegaPH2bl9t1WVuXJIUkrIGDceVr5f19pcaNQRYwZuoQd8VQXCZUpWbo//TWxl - ItS3prQgcrfcTi7gCzp1+q1bZk6H21tzESDJTXPFp019/ypdUB4Jsty7qQL73sE3 - nj67DH+srPCknAhfFag0dPOOjAY19IrIomtBMlvYNpb5XupEUAQFCjk6VdLVAzzl - M5Swj+kmLA0OUHTF2zAwj2k+B9RAkbetu/lXLwUiiQNG00j8YP03lErxDd29m2jl - NFlSn8YYsgzmihF5fUFTJXP5tS7lF4FnLNbw9pfdeVZBT1uTOcckmFv6n6edttZS - FhC70hBB8tFFtemGFquZ0N7w8O7DmIYI936n283rzxyuWdi+JqOUQ0KzpGbFOP3t - AOdVcx/JW8kjDdWRcRDr85M4MnkG6HEzW4uzGBtxBplL7KH0L8LX+lx6ySjIrbRD - QtwBxwZGtHZJAqskO6vobzzybCKuVUaQwkPrQsK5iLA6Nn1Yxu6XmtlvoPeNIc63 - Pa3ix8vNFbBTtS6iBdbOPse5qgRV0DC94ocedzKw4QzQRa5REIniJ2X8hVoVAcBh - 3nQKyZApl2I/pZMlbZ0Cg5yxjhBaxKwci7jyoMerMMo2EdbZN87gP+2x6tKuY1MO - 35mqzHn+FjWq0eAtpzhO5Q== - -----END PGP PRIVATE KEY BLOCK----- - type: string - responses: {} - parameters: {} - examples: {} - requestBodies: {} - headers: {} - securitySchemes: - basic: - description: | - NetHSM supports Basic Authentication. - type: http - scheme: basic - links: {} - callbacks: {} diff --git a/pynitrokey/cli/nethsm.py b/pynitrokey/cli/nethsm.py index a74f8b6f..c7195d6e 100644 --- a/pynitrokey/cli/nethsm.py +++ b/pynitrokey/cli/nethsm.py @@ -13,10 +13,8 @@ import os.path import click -import requests -import urllib3 +import nethsm as nethsm_sdk -import pynitrokey.nethsm from pynitrokey.helpers import prompt @@ -33,15 +31,15 @@ def make_enum_type(enum_cls): DATETIME_TYPE = click.DateTime(formats=["%Y-%m-%dT%H:%M:%S%z"]) -ROLE_TYPE = make_enum_type(pynitrokey.nethsm.Role) -LOG_LEVEL_TYPE = make_enum_type(pynitrokey.nethsm.LogLevel) -UNATTENDED_BOOT_STATUS_TYPE = make_enum_type(pynitrokey.nethsm.UnattendedBootStatus) -TYPE_TYPE = make_enum_type(pynitrokey.nethsm.KeyType) -TYPE_TLS_KEY_TYPE = make_enum_type(pynitrokey.nethsm.TlsKeyType) -MECHANISM_TYPE = make_enum_type(pynitrokey.nethsm.KeyMechanism) -ENCRYPT_MODE_TYPE = make_enum_type(pynitrokey.nethsm.EncryptMode) -DECRYPT_MODE_TYPE = make_enum_type(pynitrokey.nethsm.DecryptMode) -SIGN_MODE_TYPE = make_enum_type(pynitrokey.nethsm.SignMode) +ROLE_TYPE = make_enum_type(nethsm_sdk.Role) +LOG_LEVEL_TYPE = make_enum_type(nethsm_sdk.LogLevel) +UNATTENDED_BOOT_STATUS_TYPE = make_enum_type(nethsm_sdk.UnattendedBootStatus) +TYPE_TYPE = make_enum_type(nethsm_sdk.KeyType) +TYPE_TLS_KEY_TYPE = make_enum_type(nethsm_sdk.TlsKeyType) +MECHANISM_TYPE = make_enum_type(nethsm_sdk.KeyMechanism) +ENCRYPT_MODE_TYPE = make_enum_type(nethsm_sdk.EncryptMode) +DECRYPT_MODE_TYPE = make_enum_type(nethsm_sdk.DecryptMode) +SIGN_MODE_TYPE = make_enum_type(nethsm_sdk.SignMode) def print_row(values, widths): @@ -91,9 +89,6 @@ def nethsm(ctx, host, version, username, password, verify_tls): ctx.obj["NETHSM_PASSWORD"] = password ctx.obj["NETHSM_VERIFY_TLS"] = verify_tls - if not verify_tls: - urllib3.disable_warnings() - @contextlib.contextmanager def connect(ctx, require_auth=True): @@ -113,26 +108,20 @@ def connect(ctx, require_auth=True): f"[auth] Password for user {username} on NetHSM {host}", hide_input=True ) - with pynitrokey.nethsm.connect( - host, version, username, password, verify_tls - ) as nethsm: - import urllib3.exceptions - + with nethsm_sdk.connect(host, version, username, password, verify_tls) as nethsm: try: yield nethsm - except pynitrokey.nethsm.NetHSMError as e: + except nethsm_sdk.NetHSMError as e: raise click.ClickException(e) - except urllib3.exceptions.MaxRetryError as e: - if isinstance(e.reason, urllib3.exceptions.SSLError): + except nethsm_sdk.NetHSMRequestError as e: + if e.type == nethsm_sdk.RequestErrorType.SSL_ERROR: raise click.ClickException( f"Could not connect to the NetHSM: {e.reason}\nIf you use a self-signed certificate, please set the --no-verify-tls option." ) else: - raise e - except requests.exceptions.SSLError as e: - raise click.ClickException( - f"Could not connect to the NetHSM: {e}\nIf you use a self-signed certificate, please set the --no-verify-tls option." - ) + raise click.ClickException( + f"Cound not connect to the NetHSM: {e.reason}\nIs the NetHSM running and reachable?" + ) @nethsm.command() @@ -517,14 +506,14 @@ def delete_key(ctx, key_id): def prompt_mechanisms(type): # We assume that key type X corresponds to the mechanisms starting with X. # This is no longer true for curves, so we have to adapt the type - if type == pynitrokey.nethsm.KeyType.CURVE25519.value: + if type == nethsm_sdk.KeyType.CURVE25519.value: type = "EdDSA" elif type.startswith("EC_"): type = "ECDSA" available_mechanisms = [] print("Supported mechanisms for this key type:") - for mechanism in pynitrokey.nethsm.KeyMechanism: + for mechanism in nethsm_sdk.KeyMechanism: if mechanism.value.startswith(type): available_mechanisms.append(mechanism.value) print(f" {mechanism.value}") diff --git a/pynitrokey/nethsm/__init__.py b/pynitrokey/nethsm/__init__.py deleted file mode 100644 index 4b036f0c..00000000 --- a/pynitrokey/nethsm/__init__.py +++ /dev/null @@ -1,1312 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2021 Nitrokey Developers -# -# Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be -# copied, modified, or distributed except according to those terms. - -import contextlib -import enum -import json -import re - -import click -import requests - -from . import client -from .client import ApiException - - -class Role(enum.Enum): - ADMINISTRATOR = "Administrator" - OPERATOR = "Operator" - METRICS = "Metrics" - BACKUP = "Backup" - - @staticmethod - def from_model(model_role): - return Role.from_string(model_role.value) - - @staticmethod - def from_string(s): - for role in Role: - if role.value == s: - return role - raise ValueError(f"Unsupported user role {s}") - - -class State(enum.Enum): - UNPROVISIONED = "Unprovisioned" - LOCKED = "Locked" - OPERATIONAL = "Operational" - - @staticmethod - def from_model(model_state): - return State.from_string(model_state.value) - - @staticmethod - def from_string(s): - for state in State: - if state.value == s: - return state - raise ValueError(f"Unsupported system state {s}") - - -class LogLevel(enum.Enum): - DEBUG = "debug" - INFO = "info" - WARNING = "warning" - ERROR = "error" - - @staticmethod - def from_model(model_log_level): - return LogLevel.from_string(model_log_level.value) - - @staticmethod - def from_string(s): - for log_level in LogLevel: - if log_level.value == s: - return log_level - raise ValueError(f"Unsupported log level {s}") - - -class UnattendedBootStatus(enum.Enum): - ON = "on" - OFF = "off" - - -class KeyType(enum.Enum): - RSA = "RSA" - CURVE25519 = "Curve25519" - EC_P224 = "EC_P224" - EC_P256 = "EC_P256" - EC_P384 = "EC_P384" - EC_P521 = "EC_P521" - GENERIC = "Generic" - - -class KeyMechanism(enum.Enum): - RSA_DECRYPTION_RAW = "RSA_Decryption_RAW" - RSA_DECRYPTION_PKCS1 = "RSA_Decryption_PKCS1" - RSA_DECRYPTION_OAEP_MD5 = "RSA_Decryption_OAEP_MD5" - RSA_DECRYPTION_OAEP_SHA1 = "RSA_Decryption_OAEP_SHA1" - RSA_DECRYPTION_OAEP_SHA224 = "RSA_Decryption_OAEP_SHA224" - RSA_DECRYPTION_OAEP_SHA256 = "RSA_Decryption_OAEP_SHA256" - RSA_DECRYPTION_OAEP_SHA384 = "RSA_Decryption_OAEP_SHA384" - RSA_DECRYPTION_OAEP_SHA512 = "RSA_Decryption_OAEP_SHA512" - RSA_SIGNATURE_PKCS1 = "RSA_Signature_PKCS1" - RSA_SIGNATURE_PSS_MD5 = "RSA_Signature_PSS_MD5" - RSA_SIGNATURE_PSS_SHA1 = "RSA_Signature_PSS_SHA1" - RSA_SIGNATURE_PSS_SHA224 = "RSA_Signature_PSS_SHA224" - RSA_SIGNATURE_PSS_SHA256 = "RSA_Signature_PSS_SHA256" - RSA_SIGNATURE_PSS_SHA384 = "RSA_Signature_PSS_SHA384" - RSA_SIGNATURE_PSS_SHA512 = "RSA_Signature_PSS_SHA512" - EDDSA_SIGNATURE = "EdDSA_Signature" - ECDSA_SIGNATURE = "ECDSA_Signature" - AES_ENCRYPTION_CBC = "AES_Encryption_CBC" - AES_DECRYPTION_CBC = "AES_Decryption_CBC" - - -class EncryptMode(enum.Enum): - AES_CBC = "AES_CBC" - - -class DecryptMode(enum.Enum): - RAW = "RAW" - PKCS1 = "PKCS1" - OAEP_MD5 = "OAEP_MD5" - OAEP_SHA1 = "OAEP_SHA1" - OAEP_SHA224 = "OAEP_SHA224" - OAEP_SHA256 = "OAEP_SHA256" - OAEP_SHA384 = "OAEP_SHA384" - OAEP_SHA512 = "OAEP_SHA512" - AES_CBC = "AES_CBC" - - -class SignMode(enum.Enum): - PKCS1 = "PKCS1" - PSS_MD5 = "PSS_MD5" - PSS_SHA1 = "PSS_SHA1" - PSS_SHA224 = "PSS_SHA224" - PSS_SHA256 = "PSS_SHA256" - PSS_SHA384 = "PSS_SHA384" - PSS_SHA512 = "PSS_SHA512" - EDDSA = "EdDSA" - ECDSA = "ECDSA" - - -class TlsKeyType(enum.Enum): - RSA = "RSA" - CURVE25519 = "Curve25519" - EC_P224 = "EC_P224" - EC_P256 = "EC_P256" - EC_P384 = "EC_P384" - EC_P521 = "EC_P521" - - -class SystemInfo: - def __init__(self, firmware_version, software_version, hardware_version, build_tag): - self.firmware_version = firmware_version - self.software_version = software_version - self.hardware_version = hardware_version - self.build_tag = build_tag - - -class User: - def __init__(self, user_id, real_name, role): - self.user_id = user_id - self.real_name = real_name - self.role = role - - -class Key: - def __init__( - self, key_id, mechanisms, type, operations, tags, modulus, public_exponent, data - ): - self.key_id = key_id - self.mechanisms = mechanisms - self.type = type - self.operations = operations - self.tags = tags - self.modulus = modulus - self.public_exponent = public_exponent - self.data = data - - -def _handle_api_exception(e, messages={}, roles=[], state=None): - # give priority to custom messages - if e.status in messages: - message = messages[e.status] - raise NetHSMError(message) - - if e.status == 401 and roles: - message = "Unauthorized -- invalid username or password" - elif e.status == 403 and roles: - roles = [role.value for role in roles] - message = "Access denied -- this operation requires the role " + " or ".join( - roles - ) - elif e.status == 405: - # 405 "Method Not Allowed" mostly happens when the UserID or KeyID contains a character - # - that ends the path of the URL like a question mark '?' : - # /api/v1/keys/?/cert will hit the keys listing endpoint instead of the key/{KeyID}/cert endpoint - # - that doesn't count as a path parameter like a slash '/' : - # /api/v1/keys///cert will be interpreted as /api/v1/keys/cert with cert as the KeyID - message = "The ID you provided contains invalid characters" - elif e.status == 406: - message = "Invalid content type requested" - elif e.status == 412 and state: - message = f"Precondition failed -- this operation can only be used on a NetHSM in the state {state.value}" - elif e.status == 429: - message = ( - "Too many requests -- you may have tried the wrong credentials too often" - ) - else: - message = f"Unexpected API error {e.status}: {e.reason}" - - if e.api_response: - try: - body = None - # "custom" requests - if hasattr(e.api_response, "text") and e.api_response.text != "": - body = json.loads(e.api_response.text) - # generated code - elif ( - hasattr(e.api_response, "response") - and e.api_response.response.data != "" - ): - body = json.loads(e.api_response.response.data) - if body is not None and "message" in body: - message += "\n" + body["message"] - except json.JSONDecodeError: - pass - - raise NetHSMError(message) - - -class NetHSMError(Exception): - def __init__(self, message): - super().__init__(message) - - -class NetHSM: - def __init__(self, host, version, username, password, verify_tls=True): - from .client.components.security_schemes import security_scheme_basic - from .client.configurations.api_configuration import SecuritySchemeInfo - from .client.servers.server_0 import Server0, VariablesDict - - self.host = host - self.version = version - self.username = username - self.password = password - - security_info = SecuritySchemeInfo( - { - "basic": security_scheme_basic.Basic( - user_id=username, - password=password, - ) - } - ) - - server_config = { - "servers/0": Server0(variables=VariablesDict(host=host, version=version)) - } - config = client.ApiConfiguration( - server_info=server_config, security_scheme_info=security_info - ) - config.verify_ssl = verify_tls - self.client = client.ApiClient(configuration=config) - - self.session = requests.Session() - self.session.auth = (self.username, self.password) - self.session.verify = verify_tls - - def close(self): - self.client.close() - self.session.close() - - def request( - self, method, endpoint, params=None, data=None, mime_type=None, json=None - ): - url = f"https://{self.host}/api/{self.version}/{endpoint}" - headers = {} - if mime_type: - headers["Content-Type"] = mime_type - response = self.session.request( - method, url, params=params, data=data, headers=headers, json=json - ) - if not response.ok: - raise ApiException( - status=response.status_code, - reason=response.reason, - api_response=response, - ) - return response - - def get_api(self): - from .client.apis.tags.default_api import DefaultApi - - return DefaultApi(self.client) - - def get_location(self, headers): - return headers.get("location") - - def get_key_id_from_location(self, headers): - location = self.get_location(headers) - key_id_match = re.fullmatch(f"/api/{self.version}/keys/(.*)", location) - if not key_id_match: - raise click.ClickException("Could not determine the ID of the new key") - return key_id_match[1] - - def get_user_id_from_location(self, headers): - location = self.get_location(headers) - user_id_match = re.fullmatch(f"/api/{self.version}/users/(.*)", location) - if not user_id_match: - raise click.ClickException("Could not determine the ID of the new user") - return user_id_match[1] - - def unlock(self, passphrase): - from .client.components.schema.unlock_request_data import UnlockRequestDataDict - - request_body = UnlockRequestDataDict( - passphrase=passphrase, - ) - try: - self.get_api().unlock_post(request_body) - except ApiException as e: - _handle_api_exception( - e, - state=State.LOCKED, - messages={ - # Doc says 400 could happen when the passphrase is invalid? - 400: "Access denied -- wrong unlock passphrase", - 403: "Access denied -- wrong unlock passphrase", - }, - ) - - def lock(self): - try: - self.get_api().lock_post() - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.ADMINISTRATOR], - ) - - def provision(self, unlock_passphrase, admin_passphrase, system_time): - from .client.components.schema.provision_request_data import ( - ProvisionRequestDataDict, - ) - - request_body = ProvisionRequestDataDict( - unlockPassphrase=unlock_passphrase, - adminPassphrase=admin_passphrase, - systemTime=system_time, - ) - try: - self.get_api().provision_post(request_body) - except ApiException as e: - _handle_api_exception( - e, - state=State.UNPROVISIONED, - messages={ - 400: "Malformed request data -- e. g. weak passphrase or invalid time", - }, - ) - - def list_users(self): - try: - response = self.get_api().users_get() - return [item["user"] for item in response.body] - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.ADMINISTRATOR], - ) - - def get_user(self, user_id): - from .client.paths.users_user_id.get.path_parameters import PathParametersDict - - path_params = PathParametersDict(UserID=user_id) - try: - response = self.get_api().users_user_id_get(path_params=path_params) - return User( - user_id=user_id, - real_name=response.body.realName, - role=Role.from_string(response.body.role), - ) - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.ADMINISTRATOR, Role.OPERATOR], - messages={ - 404: f"User {user_id} not found", - }, - ) - - def add_user(self, real_name, role, passphrase, user_id=None): - from .client.components.schema.user_post_data import UserPostDataDict - from .client.paths.users_user_id.put.path_parameters import PathParametersDict - - body = UserPostDataDict( - realName=real_name, - role=role, - passphrase=passphrase, - ) - try: - if user_id: - path_params = PathParametersDict(UserID=user_id) - self.get_api().users_user_id_put(path_params=path_params, body=body) - return user_id - else: - response = self.get_api().users_post(body=body) - return self.get_user_id_from_location(response.response.getheaders()) - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.ADMINISTRATOR], - messages={ - 400: "Bad request -- e. g. weak passphrase", - 409: f"Conflict -- a user with the ID {user_id} already exists", - }, - ) - - def delete_user(self, user_id): - from .client.paths.users_user_id.delete.path_parameters import ( - PathParametersDict, - ) - - try: - path_params = PathParametersDict(UserID=user_id) - self.get_api().users_user_id_delete(path_params=path_params) - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.ADMINISTRATOR], - messages={ - 404: f"User {user_id} not found", - }, - ) - - def set_passphrase(self, user_id, passphrase): - from .client.components.schema.user_passphrase_post_data import ( - UserPassphrasePostDataDict, - ) - from .client.paths.users_user_id_passphrase.post.path_parameters import ( - PathParametersDict, - ) - - path_params = PathParametersDict(UserID=user_id) - body = UserPassphrasePostDataDict(passphrase=passphrase) - try: - self.get_api().users_user_id_passphrase_post( - path_params=path_params, body=body - ) - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.ADMINISTRATOR, Role.OPERATOR], - messages={ - 400: "Bad request -- e. g. weak passphrase", - 404: f"User {user_id} not found", - }, - ) - - def list_operator_tags(self, user_id): - from .client.paths.users_user_id_tags.get.path_parameters import ( - PathParametersDict, - ) - - path_params = PathParametersDict(UserID=user_id) - try: - response = self.get_api().users_user_id_tags_get(path_params=path_params) - return response.body - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.ADMINISTRATOR], - messages={ - 404: f"User {user_id} not found", - }, - ) - - def add_operator_tag(self, user_id, tag): - from .client.paths.users_user_id_tags_tag.put.path_parameters import ( - PathParametersDict, - ) - - path_params = PathParametersDict(UserID=user_id, Tag=tag) - try: - return self.get_api().users_user_id_tags_tag_put(path_params=path_params) - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.ADMINISTRATOR], - messages={ - 304: f"Tag is already present for {user_id}", - 400: "Invalid tag format or user is not an operator", - 404: f"User {user_id} not found", - }, - ) - - def delete_operator_tag(self, user_id, tag): - from .client.paths.users_user_id_tags_tag.delete.path_parameters import ( - PathParametersDict, - ) - - path_params = PathParametersDict(UserID=user_id, Tag=tag) - try: - return self.get_api().users_user_id_tags_tag_delete(path_params=path_params) - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.ADMINISTRATOR], - messages={ - 404: f"User {user_id} or tag {tag} not found", - }, - ) - - def add_key_tag(self, key_id, tag): - from .client.paths.keys_key_id_restrictions_tags_tag.put.path_parameters import ( - PathParametersDict, - ) - - path_params = PathParametersDict(KeyID=key_id, Tag=tag) - try: - return self.get_api().keys_key_id_restrictions_tags_tag_put( - path_params=path_params - ) - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.ADMINISTRATOR], - messages={ - 304: f"Tag is already present for {key_id}", - 400: f"Tag {tag} has invalid format", - 404: f"Key {key_id} not found", - }, - ) - - def delete_key_tag(self, key_id, tag): - from .client.paths.keys_key_id_restrictions_tags_tag.delete.path_parameters import ( - PathParametersDict, - ) - - path_params = PathParametersDict(KeyID=key_id, Tag=tag) - try: - return self.get_api().keys_key_id_restrictions_tags_tag_delete( - path_params=path_params - ) - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.ADMINISTRATOR], - messages={ - 404: f"Key {key_id} or tag {tag} not found", - }, - ) - - def get_info(self): - try: - response = self.get_api().info_get() - return (response.body["vendor"], response.body["product"]) - except ApiException as e: - _handle_api_exception(e) - - def get_state(self): - try: - response = self.get_api().health_state_get() - return State.from_string(response.body["state"]) - except ApiException as e: - _handle_api_exception(e) - - def get_random_data(self, n): - from .client.components.schema.random_request_data import RandomRequestDataDict - - body = RandomRequestDataDict(length=n) - try: - response = self.get_api().random_post(body=body) - return response.body["random"] - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.OPERATOR], - messages={ - 400: "Invalid length. Must be between 1 and 1024", - }, - ) - - def get_metrics(self): - try: - response = self.get_api().metrics_get() - return response.body - except ApiException as e: - _handle_api_exception(e, state=State.OPERATIONAL, roles=[Role.METRICS]) - - def list_keys(self, filter): - from .client.paths.keys.get.query_parameters import QueryParametersDict - - try: - if filter: - query_params = QueryParametersDict(filter=filter) - response = self.get_api().keys_get(query_params=query_params) - else: - response = self.get_api().keys_get() - return [item["key"] for item in response.body] - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.ADMINISTRATOR, Role.OPERATOR], - ) - - def get_key(self, key_id): - from .client.paths.keys_key_id.get.path_parameters import PathParametersDict - - path_params = PathParametersDict(KeyID=key_id) - try: - response = self.get_api().keys_key_id_get(path_params=path_params) - key = response.body - return Key( - key_id=key_id, - mechanisms=[mechanism for mechanism in key.mechanisms], - type=key.type, - operations=key.operations, - tags=[tag for tag in key.restrictions["tags"]] - if "tags" in key.restrictions.keys() - else None, - modulus=getattr(key.key, "modulus", None), - public_exponent=getattr(key.key, "public_exponent", None), - data=getattr(key.key, "data", None), - ) - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.ADMINISTRATOR, Role.OPERATOR], - messages={ - 404: f"Key {key_id} not found", - }, - ) - - def get_key_public_key(self, key_id): - from .client.paths.keys_key_id_public_pem.get.path_parameters import ( - PathParametersDict, - ) - - path_params = PathParametersDict(KeyID=key_id) - try: - response = self.get_api().keys_key_id_public_pem_get( - path_params=path_params, skip_deserialization=True - ) - return response.response.data.decode("utf-8") - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.ADMINISTRATOR, Role.OPERATOR], - messages={ - 404: f"Key {key_id} not found", - }, - ) - - def add_key( - self, key_id, type, mechanisms, tags, prime_p, prime_q, public_exponent, data - ): - from .client.components.schema.key_private_data import KeyPrivateDataDict - from .client.components.schema.key_restrictions import KeyRestrictionsDict - from .client.components.schema.private_key import PrivateKeyDict - from .client.components.schema.tag_list import TagListTuple - - if type == "RSA": - key_data = KeyPrivateDataDict( - primeP=prime_p, - primeQ=prime_q, - publicExponent=public_exponent, - ) - else: - key_data = KeyPrivateDataDict(data=data) - - if tags: - body = PrivateKeyDict( - type=type, - mechanisms=mechanisms, - key=key_data, - restrictions=KeyRestrictionsDict( - tags=TagListTuple([tag for tag in tags]) - ), - ) - else: - body = PrivateKeyDict( - type=type, - mechanisms=mechanisms, - key=key_data, - ) - - try: - if key_id: - from .client.paths.keys_key_id.put.path_parameters import ( - PathParametersDict, - ) - - path_params = PathParametersDict(KeyID=key_id) - self.get_api().keys_key_id_put( - path_params=path_params, - body=body, - content_type="application/json", - ) - return key_id - else: - response = self.get_api().keys_post( - body=body, - content_type="application/json", - skip_deserialization=True, - ) - return self.get_key_id_from_location(response.response.getheaders()) - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.ADMINISTRATOR], - messages={ - 400: "Bad request -- specified properties are invalid", - 409: f"Conflict -- a key with the ID {key_id} already exists", - }, - ) - - def delete_key(self, key_id): - from .client.paths.keys_key_id.delete.path_parameters import PathParametersDict - - path_params = PathParametersDict(KeyID=key_id) - try: - self.get_api().keys_key_id_delete(path_params=path_params) - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.ADMINISTRATOR], - messages={ - 404: f"Key {key_id} not found", - }, - ) - - def generate_key(self, type, mechanisms, length, key_id): - from .client.components.schema.key_generate_request_data import ( - KeyGenerateRequestDataDict, - ) - from .client.components.schema.key_mechanisms import KeyMechanismsTuple - - if key_id: - body = KeyGenerateRequestDataDict( - type=type, - mechanisms=KeyMechanismsTuple(mechanisms), - length=length, - id=key_id, - ) - else: - body = KeyGenerateRequestDataDict( - type=type, - mechanisms=KeyMechanismsTuple(mechanisms), - length=length, - ) - try: - response = self.get_api().keys_generate_post( - body=body, skip_deserialization=True - ) - return key_id or self.get_key_id_from_location( - response.response.getheaders() - ) - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.ADMINISTRATOR], - messages={ - 400: "Bad request -- invalid input data", - 409: f"Conflict -- a key with the ID {key_id} already exists", - }, - ) - - def get_config_logging(self): - try: - response = self.get_api().config_logging_get() - return response.body - except ApiException as e: - _handle_api_exception( - e, state=State.OPERATIONAL, roles=[Role.ADMINISTRATOR] - ) - - def get_config_network(self): - try: - response = self.get_api().config_network_get() - return response.body - except ApiException as e: - _handle_api_exception( - e, state=State.OPERATIONAL, roles=[Role.ADMINISTRATOR] - ) - - def get_config_time(self): - try: - response = self.get_api().config_time_get() - return response.body.time - except ApiException as e: - _handle_api_exception( - e, state=State.OPERATIONAL, roles=[Role.ADMINISTRATOR] - ) - - def get_config_unattended_boot(self): - try: - return self.get_api().config_unattended_boot_get().body.status - except ApiException as e: - _handle_api_exception( - e, state=State.OPERATIONAL, roles=[Role.ADMINISTRATOR] - ) - - def get_public_key(self): - try: - response = self.get_api().config_tls_public_pem_get( - skip_deserialization=True - ) - return response.response.data.decode("utf-8") - except ApiException as e: - _handle_api_exception( - e, state=State.OPERATIONAL, roles=[Role.ADMINISTRATOR] - ) - - def get_certificate(self): - try: - response = self.get_api().config_tls_cert_pem_get(skip_deserialization=True) - return response.response.data.decode("utf-8") - except ApiException as e: - _handle_api_exception( - e, state=State.OPERATIONAL, roles=[Role.ADMINISTRATOR] - ) - - def get_key_certificate(self, key_id): - try: - from .client.paths.keys_key_id_cert.get.path_parameters import ( - PathParametersDict, - ) - - path_params = PathParametersDict(KeyID=key_id) - - response = self.get_api().keys_key_id_cert_get( - path_params=path_params, skip_deserialization=True - ) - return response.response.data.decode("utf-8") - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.ADMINISTRATOR, Role.OPERATOR], - messages={ - 404: f"Certificate for key {key_id} not found", - # The API returns a 406 if there is no certificate or if the key does not exist - 406: f"Certificate for key {key_id} not found", - }, - ) - - def set_certificate(self, cert): - try: - self.request( - "PUT", - "config/tls/cert.pem", - data=cert, - mime_type="application/x-pem-file", - ) - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.ADMINISTRATOR], - messages={ - 400: "Bad Request -- invalid certificate", - }, - ) - - def set_key_certificate(self, key_id, cert, mime_type): - try: - self.request("PUT", f"keys/{key_id}/cert", data=cert, mime_type=mime_type) - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.ADMINISTRATOR], - messages={ - 400: "Bad Request -- invalid certificate", - 404: f"Key {key_id} not found", - 409: f"Conflict -- key {key_id} already has a certificate", - 415: "Invalid mime type", - }, - ) - - def delete_key_certificate(self, key_id): - from .client.paths.keys_key_id_cert.delete.path_parameters import ( - PathParametersDict, - ) - - path_params = PathParametersDict(KeyID=key_id) - try: - return self.get_api().keys_key_id_cert_delete(path_params=path_params) - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.ADMINISTRATOR], - messages={ - 404: f"Key {key_id} not found", - 409: f"Certificate for key {key_id} not found", - }, - ) - - def csr( - self, - country, - state_or_province, - locality, - organization, - organizational_unit, - common_name, - email_address, - ): - body = { - "countryName": country, - "stateOrProvinceName": state_or_province, - "localityName": locality, - "organizationName": organization, - "organizationalUnitName": organizational_unit, - "commonName": common_name, - "emailAddress": email_address, - } - try: - response = self.get_api().config_tls_csr_pem_post( - body=body, skip_deserialization=True - ) - return response.response.data.decode("utf-8") - except ApiException as e: - _handle_api_exception( - e, state=State.OPERATIONAL, roles=[Role.ADMINISTRATOR] - ) - - def generate_tls_key( - self, - type, - length, - ): - from .client.components.schema.tls_key_generate_request_data import ( - TlsKeyGenerateRequestDataDict, - ) - - if type == "RSA": - body = TlsKeyGenerateRequestDataDict( - type=type, - length=length, - ) - else: - body = TlsKeyGenerateRequestDataDict( - type=type, - ) - - try: - return self.get_api().config_tls_generate_post(body=body) - except ApiException as e: - _handle_api_exception( - e, state=State.OPERATIONAL, roles=[Role.ADMINISTRATOR] - ) - - def key_csr( - self, - key_id, - country, - state_or_province, - locality, - organization, - organizational_unit, - common_name, - email_address, - ): - from .client.paths.keys_key_id_csr_pem.post.path_parameters import ( - PathParametersDict, - ) - - path_params = PathParametersDict(KeyID=key_id) - body = { - "countryName": country, - "stateOrProvinceName": state_or_province, - "localityName": locality, - "organizationName": organization, - "organizationalUnitName": organizational_unit, - "commonName": common_name, - "emailAddress": email_address, - } - try: - response = self.get_api().keys_key_id_csr_pem_post( - path_params=path_params, body=body, skip_deserialization=True - ) - return response.response.data.decode("utf-8") - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.ADMINISTRATOR, Role.OPERATOR], - messages={ - 404: f"Key {key_id} not found", - }, - ) - - def set_backup_passphrase(self, passphrase): - from .client.components.schema.backup_passphrase_config import ( - BackupPassphraseConfigDict, - ) - - body = BackupPassphraseConfigDict(passphrase=passphrase) - try: - self.get_api().config_backup_passphrase_put(body=body) - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.ADMINISTRATOR], - messages={ - 400: "Bad request -- e. g. weak passphrase", - }, - ) - - def set_unlock_passphrase(self, passphrase): - from .client.components.schema.unlock_passphrase_config import ( - UnlockPassphraseConfigDict, - ) - - body = UnlockPassphraseConfigDict(passphrase=passphrase) - try: - self.get_api().config_unlock_passphrase_put(body=body) - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.ADMINISTRATOR], - messages={ - 400: "Bad request -- e. g. weak passphrase", - }, - ) - - def set_logging_config(self, ip_address, port, log_level): - from .client.components.schema.logging_config import LoggingConfigDict - - body = LoggingConfigDict(ipAddress=ip_address, port=port, logLevel=log_level) - try: - self.get_api().config_logging_put(body=body) - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.ADMINISTRATOR], - messages={ - 400: "Bad request -- invalid input data", - }, - ) - - def set_network_config(self, ip_address, netmask, gateway): - from .client.components.schema.network_config import NetworkConfigDict - - body = NetworkConfigDict(ipAddress=ip_address, netmask=netmask, gateway=gateway) - try: - self.get_api().config_network_put(body=body) - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.ADMINISTRATOR], - messages={ - 400: "Bad request -- invalid input data", - }, - ) - - def set_time(self, time): - from .client.components.schema.time_config import TimeConfigDict - - body = TimeConfigDict(time=time) - try: - self.get_api().config_time_put(body=body) - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.ADMINISTRATOR], - messages={ - 400: "Bad request -- invalid time format", - }, - ) - - def set_unattended_boot(self, status): - from .client.components.schema.unattended_boot_config import ( - UnattendedBootConfigDict, - ) - - body = UnattendedBootConfigDict(status=status) - try: - self.get_api().config_unattended_boot_put(body=body) - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.ADMINISTRATOR], - messages={ - 400: "Bad request -- invalid status setting", - }, - ) - - def get_system_info(self): - try: - response = self.get_api().system_info_get() - return SystemInfo( - firmware_version=response.body["firmwareVersion"], - software_version=response.body["softwareVersion"], - hardware_version=response.body["hardwareVersion"], - build_tag=response.body["softwareBuild"], - ) - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.ADMINISTRATOR], - ) - - def backup(self): - try: - response = self.get_api().system_backup_post() - return response.response.data - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.BACKUP], - messages={ - 412: "NetHSM is not Operational or the backup passphrase is not set", - }, - ) - - def restore(self, backup, passphrase, time): - try: - params = { - "backupPassphrase": passphrase, - "systemTime": time.isoformat(), - } - self.request("POST", "system/restore", params=params, data=backup) - except ApiException as e: - _handle_api_exception( - e, - state=State.UNPROVISIONED, - messages={ - 400: "Bad request -- backup did not apply", - }, - ) - - def update(self, image): - try: - response = self.request("POST", "system/update", data=image) - return response.json().get("releaseNotes") - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.ADMINISTRATOR], - messages={ - 400: "Bad request -- malformed image", - 409: "Conflict -- major version downgrade is not allowed", - }, - ) - - def cancel_update(self): - try: - self.get_api().system_cancel_update_post() - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.ADMINISTRATOR], - ) - - def commit_update(self): - try: - self.get_api().system_commit_update_post() - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.ADMINISTRATOR], - ) - - def reboot(self): - try: - self.get_api().system_reboot_post() - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.ADMINISTRATOR], - ) - - def shutdown(self): - try: - self.get_api().system_shutdown_post() - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.ADMINISTRATOR], - ) - - def factory_reset(self): - try: - self.get_api().system_factory_reset_post() - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.ADMINISTRATOR], - ) - - def encrypt(self, key_id, data, mode, iv): - from .client.components.schema.encrypt_request_data import ( - EncryptRequestDataDict, - ) - from .client.paths.keys_key_id_encrypt.post.path_parameters import ( - PathParametersDict, - ) - - path_params = PathParametersDict(KeyID=key_id) - body = EncryptRequestDataDict(message=data, mode=mode, iv=iv) - try: - response = self.get_api().keys_key_id_encrypt_post( - path_params=path_params, body=body - ) - return (response.body.encrypted, response.body.iv) - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.OPERATOR], - messages={ - 400: "Bad request -- e. g. invalid encryption mode, or wrong padding", - 404: f"Key {key_id} not found", - }, - ) - - def decrypt(self, key_id, data, mode, iv): - from .client.components.schema.decrypt_request_data import ( - DecryptRequestDataDict, - ) - from .client.paths.keys_key_id_decrypt.post.path_parameters import ( - PathParametersDict, - ) - - body = DecryptRequestDataDict(encrypted=data, mode=mode, iv=iv) - - if len(iv) == 0: - body = DecryptRequestDataDict(encrypted=data, mode=mode) - - path_params = PathParametersDict(KeyID=key_id) - try: - response = self.get_api().keys_key_id_decrypt_post( - path_params=path_params, body=body - ) - return response.body.decrypted - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.OPERATOR], - messages={ - 400: "Bad request -- e. g. invalid encryption mode", - 404: f"Key {key_id} not found", - }, - ) - - def sign(self, key_id, data, mode): - from .client.components.schema.sign_request_data import SignRequestDataDict - from .client.paths.keys_key_id_sign.post.path_parameters import ( - PathParametersDict, - ) - - path_params = PathParametersDict(KeyID=key_id) - body = SignRequestDataDict(message=data, mode=mode) - try: - response = self.get_api().keys_key_id_sign_post( - path_params=path_params, body=body - ) - return response.body.signature - except ApiException as e: - _handle_api_exception( - e, - state=State.OPERATIONAL, - roles=[Role.OPERATOR], - messages={ - 400: "Bad request -- e. g. invalid sign mode", - 404: f"Key {key_id} not found", - }, - ) - - -@contextlib.contextmanager -def connect(host, version, username, password, verify_tls=True): - nethsm = NetHSM(host, version, username, password, verify_tls) - try: - yield nethsm - finally: - nethsm.close() diff --git a/pynitrokey/nethsm/client/__init__.py b/pynitrokey/nethsm/client/__init__.py deleted file mode 100644 index 4d7946be..00000000 --- a/pynitrokey/nethsm/client/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding: utf-8 - -# flake8: noqa - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -__version__ = "1.0.0" - -# import ApiClient -from pynitrokey.nethsm.client.api_client import ApiClient - -# import Configuration -from pynitrokey.nethsm.client.configurations.api_configuration import ApiConfiguration - -# import exceptions -from pynitrokey.nethsm.client.exceptions import OpenApiException -from pynitrokey.nethsm.client.exceptions import ApiAttributeError -from pynitrokey.nethsm.client.exceptions import ApiTypeError -from pynitrokey.nethsm.client.exceptions import ApiValueError -from pynitrokey.nethsm.client.exceptions import ApiKeyError -from pynitrokey.nethsm.client.exceptions import ApiException diff --git a/pynitrokey/nethsm/client/api_client.py b/pynitrokey/nethsm/client/api_client.py deleted file mode 100644 index 5cec9937..00000000 --- a/pynitrokey/nethsm/client/api_client.py +++ /dev/null @@ -1,1419 +0,0 @@ -# coding: utf-8 -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -import abc -import datetime -import dataclasses -import decimal -import enum -import email -import json -import os -import io -import atexit -from multiprocessing import pool -import re -import tempfile -import typing -import typing_extensions -from urllib import parse -import urllib3 -from urllib3 import _collections, fields - - -from pynitrokey.nethsm.client import exceptions, rest, schemas, security_schemes, api_response -from pynitrokey.nethsm.client.configurations import api_configuration, schema_configuration as schema_configuration_ - - -class JSONEncoder(json.JSONEncoder): - compact_separators = (',', ':') - - def default(self, obj: typing.Any): - if isinstance(obj, str): - return str(obj) - elif isinstance(obj, float): - return obj - elif isinstance(obj, bool): - # must be before int check - return obj - elif isinstance(obj, int): - return obj - elif obj is None: - return None - elif isinstance(obj, (dict, schemas.immutabledict)): - return {key: self.default(val) for key, val in obj.items()} - elif isinstance(obj, (list, tuple)): - return [self.default(item) for item in obj] - raise exceptions.ApiValueError('Unable to prepare type {} for serialization'.format(obj.__class__.__name__)) - - -class ParameterInType(enum.Enum): - QUERY = 'query' - HEADER = 'header' - PATH = 'path' - COOKIE = 'cookie' - - -class ParameterStyle(enum.Enum): - MATRIX = 'matrix' - LABEL = 'label' - FORM = 'form' - SIMPLE = 'simple' - SPACE_DELIMITED = 'spaceDelimited' - PIPE_DELIMITED = 'pipeDelimited' - DEEP_OBJECT = 'deepObject' - - -@dataclasses.dataclass -class PrefixSeparatorIterator: - # A class to store prefixes and separators for rfc6570 expansions - prefix: str - separator: str - first: bool = True - item_separator: str = dataclasses.field(init=False) - - def __post_init__(self): - self.item_separator = self.separator if self.separator in {'.', '|', '%20'} else ',' - - def __iter__(self): - return self - - def __next__(self): - if self.first: - self.first = False - return self.prefix - return self.separator - - -class ParameterSerializerBase: - @staticmethod - def __ref6570_item_value(in_data: typing.Any, percent_encode: bool): - """ - Get representation if str/float/int/None/items in list/ values in dict - None is returned if an item is undefined, use cases are value= - - None - - [] - - {} - - [None, None None] - - {'a': None, 'b': None} - """ - if type(in_data) in {str, float, int}: - if percent_encode: - return parse.quote(str(in_data)) - return str(in_data) - elif in_data is None: - # ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 - return None - elif isinstance(in_data, list) and not in_data: - # ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 - return None - elif isinstance(in_data, dict) and not in_data: - # ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 - return None - raise exceptions.ApiValueError('Unable to generate a ref6570 item representation of {}'.format(in_data)) - - @staticmethod - def _to_dict(name: str, value: str): - return {name: value} - - @classmethod - def __ref6570_str_float_int_expansion( - cls, - variable_name: str, - in_data: typing.Any, - explode: bool, - percent_encode: bool, - prefix_separator_iterator: PrefixSeparatorIterator, - var_name_piece: str, - named_parameter_expansion: bool - ) -> str: - item_value = cls.__ref6570_item_value(in_data, percent_encode) - if item_value is None or (item_value == '' and prefix_separator_iterator.separator == ';'): - return next(prefix_separator_iterator) + var_name_piece - value_pair_equals = '=' if named_parameter_expansion else '' - return next(prefix_separator_iterator) + var_name_piece + value_pair_equals + item_value - - @classmethod - def __ref6570_list_expansion( - cls, - variable_name: str, - in_data: typing.Any, - explode: bool, - percent_encode: bool, - prefix_separator_iterator: PrefixSeparatorIterator, - var_name_piece: str, - named_parameter_expansion: bool - ) -> str: - item_values = [cls.__ref6570_item_value(v, percent_encode) for v in in_data] - item_values = [v for v in item_values if v is not None] - if not item_values: - # ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 - return "" - value_pair_equals = '=' if named_parameter_expansion else '' - if not explode: - return ( - next(prefix_separator_iterator) + - var_name_piece + - value_pair_equals + - prefix_separator_iterator.item_separator.join(item_values) - ) - # exploded - return next(prefix_separator_iterator) + next(prefix_separator_iterator).join( - [var_name_piece + value_pair_equals + val for val in item_values] - ) - - @classmethod - def __ref6570_dict_expansion( - cls, - variable_name: str, - in_data: typing.Any, - explode: bool, - percent_encode: bool, - prefix_separator_iterator: PrefixSeparatorIterator, - var_name_piece: str, - named_parameter_expansion: bool - ) -> str: - in_data_transformed = {key: cls.__ref6570_item_value(val, percent_encode) for key, val in in_data.items()} - in_data_transformed = {key: val for key, val in in_data_transformed.items() if val is not None} - if not in_data_transformed: - # ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 - return "" - value_pair_equals = '=' if named_parameter_expansion else '' - if not explode: - return ( - next(prefix_separator_iterator) + - var_name_piece + value_pair_equals + - prefix_separator_iterator.item_separator.join( - prefix_separator_iterator.item_separator.join( - item_pair - ) for item_pair in in_data_transformed.items() - ) - ) - # exploded - return next(prefix_separator_iterator) + next(prefix_separator_iterator).join( - [key + '=' + val for key, val in in_data_transformed.items()] - ) - - @classmethod - def _ref6570_expansion( - cls, - variable_name: str, - in_data: typing.Any, - explode: bool, - percent_encode: bool, - prefix_separator_iterator: PrefixSeparatorIterator - ) -> str: - """ - Separator is for separate variables like dict with explode true, not for array item separation - """ - named_parameter_expansion = prefix_separator_iterator.separator in {'&', ';'} - var_name_piece = variable_name if named_parameter_expansion else '' - if type(in_data) in {str, float, int}: - return cls.__ref6570_str_float_int_expansion( - variable_name, - in_data, - explode, - percent_encode, - prefix_separator_iterator, - var_name_piece, - named_parameter_expansion - ) - elif in_data is None: - # ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 - return "" - elif isinstance(in_data, list): - return cls.__ref6570_list_expansion( - variable_name, - in_data, - explode, - percent_encode, - prefix_separator_iterator, - var_name_piece, - named_parameter_expansion - ) - elif isinstance(in_data, dict): - return cls.__ref6570_dict_expansion( - variable_name, - in_data, - explode, - percent_encode, - prefix_separator_iterator, - var_name_piece, - named_parameter_expansion - ) - # bool, bytes, etc - raise exceptions.ApiValueError('Unable to generate a ref6570 representation of {}'.format(in_data)) - - -class StyleFormSerializer(ParameterSerializerBase): - @classmethod - def _serialize_form( - cls, - in_data: typing.Union[None, int, float, str, bool, dict, list], - name: str, - explode: bool, - percent_encode: bool, - prefix_separator_iterator: typing.Optional[PrefixSeparatorIterator] = None - ) -> str: - if prefix_separator_iterator is None: - prefix_separator_iterator = PrefixSeparatorIterator('', '&') - return cls._ref6570_expansion( - variable_name=name, - in_data=in_data, - explode=explode, - percent_encode=percent_encode, - prefix_separator_iterator=prefix_separator_iterator - ) - - -class StyleSimpleSerializer(ParameterSerializerBase): - - @classmethod - def _serialize_simple( - cls, - in_data: typing.Union[None, int, float, str, bool, dict, list], - name: str, - explode: bool, - percent_encode: bool - ) -> str: - prefix_separator_iterator = PrefixSeparatorIterator('', ',') - return cls._ref6570_expansion( - variable_name=name, - in_data=in_data, - explode=explode, - percent_encode=percent_encode, - prefix_separator_iterator=prefix_separator_iterator - ) - - @classmethod - def _deserialize_simple( - cls, - in_data: str, - name: str, - explode: bool, - percent_encode: bool - ) -> typing.Union[str, typing.List[str], typing.Dict[str, str]]: - raise NotImplementedError( - "Deserialization of style=simple has not yet been added. " - "If you need this how about you submit a PR adding it?" - ) - - -class JSONDetector: - """ - Works for: - application/json - application/json; charset=UTF-8 - application/json-patch+json - application/geo+json - """ - __json_content_type_pattern = re.compile("application/[^+]*[+]?(json);?.*") - - @classmethod - def _content_type_is_json(cls, content_type: str) -> bool: - if cls.__json_content_type_pattern.match(content_type): - return True - return False - - -class Encoding: - content_type: str - headers: typing.Optional[typing.Dict[str, 'HeaderParameter']] = None - style: typing.Optional[ParameterStyle] = None - explode: bool = False - allow_reserved: bool = False - - -class MediaType: - """ - Used to store request and response body schema information - encoding: - A map between a property name and its encoding information. - The key, being the property name, MUST exist in the schema as a property. - The encoding object SHALL only apply to requestBody objects when the media type is - multipart or application/x-www-form-urlencoded. - """ - schema: typing.Optional[typing.Type[schemas.Schema]] = None - encoding: typing.Optional[typing.Dict[str, Encoding]] = None - - -class ParameterBase(JSONDetector): - in_type: ParameterInType - required: bool - style: typing.Optional[ParameterStyle] - explode: typing.Optional[bool] - allow_reserved: typing.Optional[bool] - schema: typing.Optional[typing.Type[schemas.Schema]] - content: typing.Optional[typing.Dict[str, typing.Type[MediaType]]] - - _json_encoder = JSONEncoder() - - def __init_subclass__(cls, **kwargs): - if cls.explode is None: - if cls.style is ParameterStyle.FORM: - cls.explode = True - else: - cls.explode = False - - @classmethod - def _serialize_json( - cls, - in_data: typing.Union[None, int, float, str, bool, dict, list], - eliminate_whitespace: bool = False - ) -> str: - if eliminate_whitespace: - return json.dumps(in_data, separators=cls._json_encoder.compact_separators) - return json.dumps(in_data) - -_SERIALIZE_TYPES = typing.Union[ - int, - float, - str, - datetime.date, - datetime.datetime, - None, - bool, - list, - tuple, - dict, - schemas.immutabledict -] - -_JSON_TYPES = typing.Union[ - int, - float, - str, - None, - bool, - typing.Tuple['_JSON_TYPES', ...], - schemas.immutabledict[str, '_JSON_TYPES'], -] - -@dataclasses.dataclass -class PathParameter(ParameterBase, StyleSimpleSerializer): - name: str - required: bool = False - in_type: ParameterInType = ParameterInType.PATH - style: ParameterStyle = ParameterStyle.SIMPLE - explode: bool = False - allow_reserved: typing.Optional[bool] = None - schema: typing.Optional[typing.Type[schemas.Schema]] = None - content: typing.Optional[typing.Dict[str, typing.Type[MediaType]]] = None - - @classmethod - def __serialize_label( - cls, - in_data: typing.Union[None, int, float, str, bool, dict, list] - ) -> typing.Dict[str, str]: - prefix_separator_iterator = PrefixSeparatorIterator('.', '.') - value = cls._ref6570_expansion( - variable_name=cls.name, - in_data=in_data, - explode=cls.explode, - percent_encode=True, - prefix_separator_iterator=prefix_separator_iterator - ) - return cls._to_dict(cls.name, value) - - @classmethod - def __serialize_matrix( - cls, - in_data: typing.Union[None, int, float, str, bool, dict, list] - ) -> typing.Dict[str, str]: - prefix_separator_iterator = PrefixSeparatorIterator(';', ';') - value = cls._ref6570_expansion( - variable_name=cls.name, - in_data=in_data, - explode=cls.explode, - percent_encode=True, - prefix_separator_iterator=prefix_separator_iterator - ) - return cls._to_dict(cls.name, value) - - @classmethod - def __serialize_simple( - cls, - in_data: typing.Union[None, int, float, str, bool, dict, list], - ) -> typing.Dict[str, str]: - value = cls._serialize_simple( - in_data=in_data, - name=cls.name, - explode=cls.explode, - percent_encode=True - ) - return cls._to_dict(cls.name, value) - - @classmethod - def serialize( - cls, - in_data: _SERIALIZE_TYPES, - skip_validation: bool = False - ) -> typing.Dict[str, str]: - if cls.schema: - cast_in_data = in_data if skip_validation else cls.schema.validate_base(in_data) - cast_in_data = cls._json_encoder.default(cast_in_data) - """ - simple -> path - path: - returns path_params: dict - label -> path - returns path_params - matrix -> path - returns path_params - """ - if cls.style: - if cls.style is ParameterStyle.SIMPLE: - return cls.__serialize_simple(cast_in_data) - elif cls.style is ParameterStyle.LABEL: - return cls.__serialize_label(cast_in_data) - elif cls.style is ParameterStyle.MATRIX: - return cls.__serialize_matrix(cast_in_data) - assert cls.content is not None - for content_type, media_type in cls.content.items(): - assert media_type.schema is not None - cast_in_data = in_data if skip_validation else media_type.schema.validate_base(in_data) - cast_in_data = cls._json_encoder.default(cast_in_data) - if cls._content_type_is_json(content_type): - value = cls._serialize_json(cast_in_data) - return cls._to_dict(cls.name, value) - else: - raise NotImplementedError('Serialization of {} has not yet been implemented'.format(content_type)) - raise ValueError('Invalid value for content, it was empty and must have 1 key value pair') - - -@dataclasses.dataclass -class QueryParameter(ParameterBase, StyleFormSerializer): - name: str - required: bool = False - in_type: ParameterInType = ParameterInType.QUERY - style: ParameterStyle = ParameterStyle.FORM - explode: typing.Optional[bool] = None - allow_reserved: typing.Optional[bool] = None - schema: typing.Optional[typing.Type[schemas.Schema]] = None - content: typing.Optional[typing.Dict[str, typing.Type[MediaType]]] = None - - @classmethod - def __serialize_space_delimited( - cls, - in_data: typing.Union[None, int, float, str, bool, dict, list], - prefix_separator_iterator: typing.Optional[PrefixSeparatorIterator], - explode: bool - ) -> typing.Dict[str, str]: - if prefix_separator_iterator is None: - prefix_separator_iterator = cls.get_prefix_separator_iterator() - value = cls._ref6570_expansion( - variable_name=cls.name, - in_data=in_data, - explode=explode, - percent_encode=True, - prefix_separator_iterator=prefix_separator_iterator - ) - return cls._to_dict(cls.name, value) - - @classmethod - def __serialize_pipe_delimited( - cls, - in_data: typing.Union[None, int, float, str, bool, dict, list], - prefix_separator_iterator: typing.Optional[PrefixSeparatorIterator], - explode: bool - ) -> typing.Dict[str, str]: - if prefix_separator_iterator is None: - prefix_separator_iterator = cls.get_prefix_separator_iterator() - value = cls._ref6570_expansion( - variable_name=cls.name, - in_data=in_data, - explode=explode, - percent_encode=True, - prefix_separator_iterator=prefix_separator_iterator - ) - return cls._to_dict(cls.name, value) - - @classmethod - def __serialize_form( - cls, - in_data: typing.Union[None, int, float, str, bool, dict, list], - prefix_separator_iterator: typing.Optional[PrefixSeparatorIterator], - explode: bool - ) -> typing.Dict[str, str]: - if prefix_separator_iterator is None: - prefix_separator_iterator = cls.get_prefix_separator_iterator() - value = cls._serialize_form( - in_data, - name=cls.name, - explode=explode, - percent_encode=True, - prefix_separator_iterator=prefix_separator_iterator - ) - return cls._to_dict(cls.name, value) - - @classmethod - def get_prefix_separator_iterator(cls) -> PrefixSeparatorIterator: - if cls.style is ParameterStyle.FORM: - return PrefixSeparatorIterator('?', '&') - elif cls.style is ParameterStyle.SPACE_DELIMITED: - return PrefixSeparatorIterator('', '%20') - elif cls.style is ParameterStyle.PIPE_DELIMITED: - return PrefixSeparatorIterator('', '|') - raise ValueError(f'No iterator possible for style={cls.style}') - - @classmethod - def serialize( - cls, - in_data: _SERIALIZE_TYPES, - prefix_separator_iterator: typing.Optional[PrefixSeparatorIterator] = None, - skip_validation: bool = False - ) -> typing.Dict[str, str]: - if cls.schema: - cast_in_data = in_data if skip_validation else cls.schema.validate_base(in_data) - cast_in_data = cls._json_encoder.default(cast_in_data) - """ - form -> query - query: - - GET/HEAD/DELETE: could use fields - - PUT/POST: must use urlencode to send parameters - returns fields: tuple - spaceDelimited -> query - returns fields - pipeDelimited -> query - returns fields - deepObject -> query, https://github.com/OAI/OpenAPI-Specification/issues/1706 - returns fields - """ - if cls.style: - # TODO update query ones to omit setting values when [] {} or None is input - explode = cls.explode if cls.explode is not None else cls.style == ParameterStyle.FORM - if cls.style is ParameterStyle.FORM: - return cls.__serialize_form(cast_in_data, prefix_separator_iterator, explode) - elif cls.style is ParameterStyle.SPACE_DELIMITED: - return cls.__serialize_space_delimited(cast_in_data, prefix_separator_iterator, explode) - elif cls.style is ParameterStyle.PIPE_DELIMITED: - return cls.__serialize_pipe_delimited(cast_in_data, prefix_separator_iterator, explode) - if prefix_separator_iterator is None: - prefix_separator_iterator = cls.get_prefix_separator_iterator() - assert cls.content is not None - for content_type, media_type in cls.content.items(): - assert media_type.schema is not None - cast_in_data = in_data if skip_validation else media_type.schema.validate_base(in_data) - cast_in_data = cls._json_encoder.default(cast_in_data) - if cls._content_type_is_json(content_type): - value = cls._serialize_json(cast_in_data, eliminate_whitespace=True) - return cls._to_dict( - cls.name, - next(prefix_separator_iterator) + cls.name + '=' + parse.quote(value) - ) - else: - raise NotImplementedError('Serialization of {} has not yet been implemented'.format(content_type)) - raise ValueError('Invalid value for content, it was empty and must have 1 key value pair') - - -@dataclasses.dataclass -class CookieParameter(ParameterBase, StyleFormSerializer): - name: str - required: bool = False - style: ParameterStyle = ParameterStyle.FORM - in_type: ParameterInType = ParameterInType.COOKIE - explode: typing.Optional[bool] = None - allow_reserved: typing.Optional[bool] = None - schema: typing.Optional[typing.Type[schemas.Schema]] = None - content: typing.Optional[typing.Dict[str, typing.Type[MediaType]]] = None - - @classmethod - def serialize( - cls, - in_data: _SERIALIZE_TYPES, - skip_validation: bool = False - ) -> typing.Dict[str, str]: - if cls.schema: - cast_in_data = in_data if skip_validation else cls.schema.validate_base(in_data) - cast_in_data = cls._json_encoder.default(cast_in_data) - """ - form -> cookie - returns fields: tuple - """ - if cls.style: - """ - TODO add escaping of comma, space, equals - or turn encoding on - """ - explode = cls.explode if cls.explode is not None else cls.style == ParameterStyle.FORM - value = cls._serialize_form( - cast_in_data, - explode=explode, - name=cls.name, - percent_encode=False, - prefix_separator_iterator=PrefixSeparatorIterator('', '&') - ) - return cls._to_dict(cls.name, value) - assert cls.content is not None - for content_type, media_type in cls.content.items(): - assert media_type.schema is not None - cast_in_data = in_data if skip_validation else media_type.schema.validate_base(in_data) - cast_in_data = cls._json_encoder.default(cast_in_data) - if cls._content_type_is_json(content_type): - value = cls._serialize_json(cast_in_data) - return cls._to_dict(cls.name, value) - else: - raise NotImplementedError('Serialization of {} has not yet been implemented'.format(content_type)) - raise ValueError('Invalid value for content, it was empty and must have 1 key value pair') - - -class __HeaderParameterBase(ParameterBase, StyleSimpleSerializer): - style: ParameterStyle = ParameterStyle.SIMPLE - schema: typing.Optional[typing.Type[schemas.Schema]] = None - content: typing.Optional[typing.Dict[str, typing.Type[MediaType]]] = None - explode: bool = False - - @staticmethod - def __to_headers(in_data: typing.Tuple[typing.Tuple[str, str], ...]) -> _collections.HTTPHeaderDict: - data = tuple(t for t in in_data if t) - headers = _collections.HTTPHeaderDict() - if not data: - return headers - headers.extend(data) - return headers - - @classmethod - def serialize_with_name( - cls, - in_data: _SERIALIZE_TYPES, - name: str, - skip_validation: bool = False - ) -> _collections.HTTPHeaderDict: - if cls.schema: - cast_in_data = in_data if skip_validation else cls.schema.validate_base(in_data) - cast_in_data = cls._json_encoder.default(cast_in_data) - """ - simple -> header - headers: PoolManager needs a mapping, tuple is close - returns headers: dict - """ - if cls.style: - value = cls._serialize_simple(cast_in_data, name, cls.explode, False) - return cls.__to_headers(((name, value),)) - assert cls.content is not None - for content_type, media_type in cls.content.items(): - assert media_type.schema is not None - cast_in_data = in_data if skip_validation else media_type.schema.validate_base(in_data) - cast_in_data = cls._json_encoder.default(cast_in_data) - if cls._content_type_is_json(content_type): - value = cls._serialize_json(cast_in_data) - return cls.__to_headers(((name, value),)) - else: - raise NotImplementedError('Serialization of {} has not yet been implemented'.format(content_type)) - raise ValueError('Invalid value for content, it was empty and must have 1 key value pair') - - @classmethod - def deserialize( - cls, - in_data: str, - name: str - ): - if cls.schema: - """ - simple -> header - headers: PoolManager needs a mapping, tuple is close - returns headers: dict - """ - if cls.style: - extracted_data = cls._deserialize_simple(in_data, name, cls.explode, False) - return cls.schema.validate_base(extracted_data) - assert cls.content is not None - for content_type, media_type in cls.content.items(): - if cls._content_type_is_json(content_type): - cast_in_data: typing.Union[dict, list, None, int, float, str] = json.loads(in_data) - assert media_type.schema is not None - return media_type.schema.validate_base(cast_in_data) - else: - raise NotImplementedError('Deserialization of {} has not yet been implemented'.format(content_type)) - raise ValueError('Invalid value for content, it was empty and must have 1 key value pair') - - -class HeaderParameterWithoutName(__HeaderParameterBase): - required: bool = False - style: ParameterStyle = ParameterStyle.SIMPLE - in_type: ParameterInType = ParameterInType.HEADER - explode: bool = False - allow_reserved: typing.Optional[bool] = None - schema: typing.Optional[typing.Type[schemas.Schema]] = None - content: typing.Optional[typing.Dict[str, typing.Type[MediaType]]] = None - - @classmethod - def serialize( - cls, - in_data: _SERIALIZE_TYPES, - name: str, - skip_validation: bool = False - ) -> _collections.HTTPHeaderDict: - return cls.serialize_with_name( - in_data, - name, - skip_validation=skip_validation - ) - - -class HeaderParameter(__HeaderParameterBase): - name: str - required: bool = False - style: ParameterStyle = ParameterStyle.SIMPLE - in_type: ParameterInType = ParameterInType.HEADER - explode: bool = False - allow_reserved: typing.Optional[bool] = None - schema: typing.Optional[typing.Type[schemas.Schema]] = None - content: typing.Optional[typing.Dict[str, typing.Type[MediaType]]] = None - - @classmethod - def serialize( - cls, - in_data: _SERIALIZE_TYPES, - skip_validation: bool = False - ) -> _collections.HTTPHeaderDict: - return cls.serialize_with_name( - in_data, - cls.name, - skip_validation=skip_validation - ) - -T = typing.TypeVar("T", bound=api_response.ApiResponse) - - -class OpenApiResponse(typing.Generic[T], JSONDetector, abc.ABC): - __filename_content_disposition_pattern = re.compile('filename="(.+?)"') - content: typing.Optional[typing.Dict[str, typing.Type[MediaType]]] = None - headers: typing.Optional[typing.Dict[str, typing.Type[HeaderParameterWithoutName]]] = None - headers_schema: typing.Optional[typing.Type[schemas.Schema]] = None - - @classmethod - @abc.abstractmethod - def get_response(cls, response, headers, body) -> T: ... - - @staticmethod - def __deserialize_json(response: urllib3.HTTPResponse) -> typing.Any: - # python must be >= 3.9 so we can pass in bytes into json.loads - return json.loads(response.data) - - @staticmethod - def __file_name_from_response_url(response_url: typing.Optional[str]) -> typing.Optional[str]: - if response_url is None: - return None - url_path = parse.urlparse(response_url).path - if url_path: - path_basename = os.path.basename(url_path) - if path_basename: - _filename, ext = os.path.splitext(path_basename) - if ext: - return path_basename - return None - - @classmethod - def __file_name_from_content_disposition(cls, content_disposition: typing.Optional[str]) -> typing.Optional[str]: - if content_disposition is None: - return None - match = cls.__filename_content_disposition_pattern.search(content_disposition) - if not match: - return None - return match.group(1) - - @classmethod - def __deserialize_application_octet_stream( - cls, response: urllib3.HTTPResponse - ) -> typing.Union[bytes, io.BufferedReader]: - """ - urllib3 use cases: - 1. when preload_content=True (stream=False) then supports_chunked_reads is False and bytes are returned - 2. when preload_content=False (stream=True) then supports_chunked_reads is True and - a file will be written and returned - """ - if response.supports_chunked_reads(): - file_name = ( - cls.__file_name_from_content_disposition(response.headers.get('content-disposition')) - or cls.__file_name_from_response_url(response.geturl()) - ) - - if file_name is None: - _fd, path = tempfile.mkstemp() - else: - path = os.path.join(tempfile.gettempdir(), file_name) - - with open(path, 'wb') as write_file: - chunk_size = 1024 - while True: - data = response.read(chunk_size) - if not data: - break - write_file.write(data) - # release_conn is needed for streaming connections only - response.release_conn() - new_file = open(path, 'rb') - return new_file - else: - return response.data - - @staticmethod - def __deserialize_multipart_form_data( - response: urllib3.HTTPResponse - ) -> typing.Dict[str, typing.Any]: - msg = email.message_from_bytes(response.data) - return { - part.get_param("name", header="Content-Disposition"): part.get_payload( - decode=True - ).decode(part.get_content_charset()) - if part.get_content_charset() - else part.get_payload() - for part in msg.get_payload() - } - - @classmethod - def deserialize(cls, response: urllib3.HTTPResponse, configuration: schema_configuration_.SchemaConfiguration) -> T: - content_type = response.headers.get('content-type') - deserialized_body = schemas.unset - streamed = response.supports_chunked_reads() - - deserialized_headers: typing.Union[schemas.Unset, typing.Dict[str, typing.Any]] = schemas.unset - if cls.headers is not None and cls.headers_schema is not None: - deserialized_headers = {} - for header_name, header_param in cls.headers.items(): - header_value = response.headers.get(header_name) - if header_value is None: - continue - header_value = header_param.deserialize(header_value, header_name) - deserialized_headers[header_name] = header_value - deserialized_headers = cls.headers_schema.validate_base(deserialized_headers, configuration=configuration) - - if cls.content is not None: - if content_type not in cls.content: - raise exceptions.ApiValueError( - f"Invalid content_type returned. Content_type='{content_type}' was returned " - f"when only {str(set(cls.content))} are defined for status_code={str(response.status)}" - ) - body_schema = cls.content[content_type].schema - if body_schema is None: - # some specs do not define response content media type schemas - return cls.get_response( - response=response, - headers=deserialized_headers, - body=schemas.unset - ) - - if cls._content_type_is_json(content_type): - body_data = cls.__deserialize_json(response) - elif content_type == 'application/octet-stream': - body_data = cls.__deserialize_application_octet_stream(response) - elif content_type.startswith('multipart/form-data'): - body_data = cls.__deserialize_multipart_form_data(response) - content_type = 'multipart/form-data' - else: - raise NotImplementedError('Deserialization of {} has not yet been implemented'.format(content_type)) - body_schema = schemas.get_class(body_schema) - if body_schema is schemas.BinarySchema: - deserialized_body = body_schema.validate_base(body_data) - else: - deserialized_body = body_schema.validate_base( - body_data, configuration=configuration) - elif streamed: - response.release_conn() - - return cls.get_response( - response=response, - headers=deserialized_headers, - body=deserialized_body - ) - - -@dataclasses.dataclass -class ApiClient: - """Generic API client for OpenAPI client library builds. - - OpenAPI generic API client. This client handles the client- - server communication, and is invariant across implementations. Specifics of - the methods and models for each application are generated from the OpenAPI - templates. - - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - Do not edit the class manually. - - :param configuration: api_configuration.ApiConfiguration object for this client - :param schema_configuration: schema_configuration_.SchemaConfiguration object for this client - :param default_headers: any default headers to include when making calls to the API. - :param pool_threads: The number of threads to use for async requests - to the API. More threads means more concurrent API requests. - """ - configuration: api_configuration.ApiConfiguration = dataclasses.field( - default_factory=lambda: api_configuration.ApiConfiguration()) - schema_configuration: schema_configuration_.SchemaConfiguration = dataclasses.field( - default_factory=lambda: schema_configuration_.SchemaConfiguration()) - default_headers: _collections.HTTPHeaderDict = dataclasses.field( - default_factory=lambda: _collections.HTTPHeaderDict()) - pool_threads: int = 1 - user_agent: str = 'OpenAPI-JSON-Schema-Generator/1.0.0/python' - rest_client: rest.RESTClientObject = dataclasses.field(init=False) - - def __post_init__(self): - self._pool = None - self.rest_client = rest.RESTClientObject(self.configuration) - - def __enter__(self): - return self - - def __exit__(self, exc_type, exc_value, traceback): - self.close() - - def close(self): - if self._pool: - self._pool.close() - self._pool.join() - self._pool = None - if hasattr(atexit, 'unregister'): - atexit.unregister(self.close) - - @property - def pool(self): - """Create thread pool on first request - avoids instantiating unused threadpool for blocking clients. - """ - if self._pool is None: - atexit.register(self.close) - self._pool = pool.ThreadPool(self.pool_threads) - return self._pool - - def set_default_header(self, header_name: str, header_value: str): - self.default_headers[header_name] = header_value - - def call_api( - self, - resource_path: str, - method: str, - host: str, - query_params_suffix: typing.Optional[str] = None, - headers: typing.Optional[_collections.HTTPHeaderDict] = None, - body: typing.Union[str, bytes, None] = None, - fields: typing.Optional[typing.Tuple[rest.RequestField, ...]] = None, - security_requirement_object: typing.Optional[security_schemes.SecurityRequirementObject] = None, - stream: bool = False, - timeout: typing.Union[int, float, typing.Tuple, None] = None, - ) -> urllib3.HTTPResponse: - """Makes the HTTP request (synchronous) and returns deserialized data. - - :param resource_path: Path to method endpoint. - :param method: Method to call. - :param headers: Header parameters to be - placed in the request header. - :param body: Request body. - :param fields: Request post form parameters, - for `application/x-www-form-urlencoded`, `multipart/form-data` - :param security_requirement_object: The security requirement object, used to apply auth when making the call - :param async_req: execute request asynchronously - :param stream: if True, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Also when True, if the openapi spec describes a file download, - the data will be written to a local filesystem file and the schemas.BinarySchema - instance will also inherit from FileSchema and schemas.FileIO - Default is False. - :type stream: bool, optional - :param timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :param host: api endpoint host - :return: - the method will return the response directly. - """ - # header parameters - used_headers = _collections.HTTPHeaderDict(self.default_headers) - user_agent_key = 'User-Agent' - if user_agent_key not in used_headers and self.user_agent: - used_headers[user_agent_key] = self.user_agent - - # auth setting - self.update_params_for_auth( - used_headers, - security_requirement_object, - resource_path, - method, - body, - query_params_suffix - ) - - # must happen after auth setting in case user is overriding those - if headers: - used_headers.update(headers) - - # request url - url = host + resource_path - if query_params_suffix: - url += query_params_suffix - - # perform request and return response - response = self.request( - method, - url, - headers=used_headers, - fields=fields, - body=body, - stream=stream, - timeout=timeout, - ) - return response - - def request( - self, - method: str, - url: str, - headers: typing.Optional[_collections.HTTPHeaderDict] = None, - fields: typing.Optional[typing.Tuple[rest.RequestField, ...]] = None, - body: typing.Union[str, bytes, None] = None, - stream: bool = False, - timeout: typing.Union[int, float, typing.Tuple, None] = None, - ) -> urllib3.HTTPResponse: - """Makes the HTTP request using RESTClient.""" - if method == "get": - return self.rest_client.get(url, - stream=stream, - timeout=timeout, - headers=headers) - elif method == "head": - return self.rest_client.head(url, - stream=stream, - timeout=timeout, - headers=headers) - elif method == "options": - return self.rest_client.options(url, - headers=headers, - fields=fields, - stream=stream, - timeout=timeout, - body=body) - elif method == "post": - return self.rest_client.post(url, - headers=headers, - fields=fields, - stream=stream, - timeout=timeout, - body=body) - elif method == "put": - return self.rest_client.put(url, - headers=headers, - fields=fields, - stream=stream, - timeout=timeout, - body=body) - elif method == "patch": - return self.rest_client.patch(url, - headers=headers, - fields=fields, - stream=stream, - timeout=timeout, - body=body) - elif method == "delete": - return self.rest_client.delete(url, - headers=headers, - stream=stream, - timeout=timeout, - body=body) - else: - raise exceptions.ApiValueError( - "http method must be `GET`, `HEAD`, `OPTIONS`," - " `POST`, `PATCH`, `PUT` or `DELETE`." - ) - - def update_params_for_auth( - self, - headers: _collections.HTTPHeaderDict, - security_requirement_object: typing.Optional[security_schemes.SecurityRequirementObject], - resource_path: str, - method: str, - body: typing.Union[str, bytes, None] = None, - query_params_suffix: typing.Optional[str] = None - ): - """Updates header and query params based on authentication setting. - - :param headers: Header parameters dict to be updated. - :param security_requirement_object: the openapi security requirement object - :param resource_path: A string representation of the HTTP request resource path. - :param method: A string representation of the HTTP request method. - :param body: A object representing the body of the HTTP request. - The object type is the return value of _encoder.default(). - """ - if not security_requirement_object: - # optional auth cause, use no auth - return - for security_scheme_component_name, scope_names in security_requirement_object.items(): - scope_names = typing.cast(typing.Tuple[str, ...], scope_names) - security_scheme_component_name = typing.cast(typing.Literal[ - 'basic', - ], - security_scheme_component_name - ) - try: - security_scheme_instance = self.configuration.security_scheme_info[security_scheme_component_name] - security_scheme_instance.apply_auth( - headers, - resource_path, - method, - body, - query_params_suffix, - scope_names - ) - except KeyError as ex: - raise ex - -@dataclasses.dataclass -class Api: - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - api_client: ApiClient = dataclasses.field(default_factory=lambda: ApiClient()) - - @staticmethod - def _get_used_path( - used_path: str, - path_parameters: typing.Tuple[typing.Type[PathParameter], ...] = (), - path_params: typing.Optional[typing.Mapping[str, schemas.OUTPUT_BASE_TYPES]] = None, - query_parameters: typing.Tuple[typing.Type[QueryParameter], ...] = (), - query_params: typing.Optional[typing.Mapping[str, schemas.OUTPUT_BASE_TYPES]] = None, - skip_validation: bool = False - ) -> typing.Tuple[str, str]: - used_path_params = {} - if path_params is not None: - for path_parameter in path_parameters: - parameter_data = path_params.get(path_parameter.name, schemas.unset) - if isinstance(parameter_data, schemas.Unset): - continue - assert not isinstance(parameter_data, (bytes, schemas.FileIO)) - serialized_data = path_parameter.serialize(parameter_data, skip_validation=skip_validation) - used_path_params.update(serialized_data) - - for k, v in used_path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - query_params_suffix = "" - if query_params is not None: - prefix_separator_iterator = None - for query_parameter in query_parameters: - parameter_data = query_params.get(query_parameter.name, schemas.unset) - if isinstance(parameter_data, schemas.Unset): - continue - if prefix_separator_iterator is None: - prefix_separator_iterator = query_parameter.get_prefix_separator_iterator() - assert not isinstance(parameter_data, (bytes, schemas.FileIO)) - serialized_data = query_parameter.serialize( - parameter_data, - prefix_separator_iterator=prefix_separator_iterator, - skip_validation=skip_validation - ) - for serialized_value in serialized_data.values(): - query_params_suffix += serialized_value - return used_path, query_params_suffix - - @staticmethod - def _get_headers( - header_parameters: typing.Tuple[typing.Type[HeaderParameter], ...] = (), - header_params: typing.Optional[typing.Mapping[str, schemas.OUTPUT_BASE_TYPES]] = None, - accept_content_types: typing.Tuple[str, ...] = (), - skip_validation: bool = False - ) -> _collections.HTTPHeaderDict: - headers = _collections.HTTPHeaderDict() - if header_params is not None: - for parameter in header_parameters: - parameter_data = header_params.get(parameter.name, schemas.unset) - if isinstance(parameter_data, schemas.Unset): - continue - assert not isinstance(parameter_data, (bytes, schemas.FileIO)) - serialized_data = parameter.serialize(parameter_data, skip_validation=skip_validation) - headers.extend(serialized_data) - if accept_content_types: - for accept_content_type in accept_content_types: - headers.add('Accept', accept_content_type) - return headers - - @staticmethod - def _get_fields_and_body( - request_body: typing.Type[RequestBody], - body: typing.Union[schemas.INPUT_TYPES_ALL, schemas.Unset], - content_type: str, - headers: _collections.HTTPHeaderDict - ): - if request_body.required and body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - - if isinstance(body, schemas.Unset): - return None, None - - serialized_fields = None - serialized_body = None - serialized_data = request_body.serialize(body, content_type) - headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - serialized_fields = serialized_data['fields'] - elif 'body' in serialized_data: - serialized_body = serialized_data['body'] - return serialized_fields, serialized_body - - @staticmethod - def _verify_response_status(response: api_response.ApiResponse): - if not 200 <= response.response.status <= 399: - raise exceptions.ApiException( - status=response.response.status, - reason=response.response.reason, - api_response=response - ) - - -class SerializedRequestBody(typing.TypedDict, total=False): - body: typing.Union[str, bytes] - fields: typing.Tuple[rest.RequestField, ...] - - -class RequestBody(StyleFormSerializer, JSONDetector): - """ - A request body parameter - content: content_type to MediaType schemas.Schema info - """ - __json_encoder = JSONEncoder() - content: typing.Dict[str, typing.Type[MediaType]] - required: bool = False - - @classmethod - def __serialize_json( - cls, - in_data: _JSON_TYPES - ) -> SerializedRequestBody: - in_data = cls.__json_encoder.default(in_data) - json_str = json.dumps(in_data, separators=(",", ":"), ensure_ascii=False).encode( - "utf-8" - ) - return {'body': json_str} - - @staticmethod - def __serialize_text_plain(in_data: typing.Union[int, float, str]) -> SerializedRequestBody: - return {'body': str(in_data)} - - @classmethod - def __multipart_json_item(cls, key: str, value: _JSON_TYPES) -> rest.RequestField: - json_value = cls.__json_encoder.default(value) - request_field = rest.RequestField(name=key, data=json.dumps(json_value)) - request_field.make_multipart(content_type='application/json') - return request_field - - @classmethod - def __multipart_form_item(cls, key: str, value: typing.Union[_JSON_TYPES, bytes, schemas.FileIO]) -> rest.RequestField: - if isinstance(value, str): - request_field = rest.RequestField(name=key, data=str(value)) - request_field.make_multipart(content_type='text/plain') - elif isinstance(value, bytes): - request_field = rest.RequestField(name=key, data=value) - request_field.make_multipart(content_type='application/octet-stream') - elif isinstance(value, schemas.FileIO): - # TODO use content.encoding to limit allowed content types if they are present - urllib3_request_field = rest.RequestField.from_tuples(key, (os.path.basename(str(value.name)), value.read())) - request_field = typing.cast(rest.RequestField, urllib3_request_field) - value.close() - else: - request_field = cls.__multipart_json_item(key=key, value=value) - return request_field - - @classmethod - def __serialize_multipart_form_data( - cls, in_data: schemas.immutabledict[str, typing.Union[_JSON_TYPES, bytes, schemas.FileIO]] - ) -> SerializedRequestBody: - """ - In a multipart/form-data request body, each schema property, or each element of a schema array property, - takes a section in the payload with an internal header as defined by RFC7578. The serialization strategy - for each property of a multipart/form-data request body can be specified in an associated Encoding Object. - - When passing in multipart types, boundaries MAY be used to separate sections of the content being - transferred – thus, the following default Content-Types are defined for multipart: - - If the (object) property is a primitive, or an array of primitive values, the default Content-Type is text/plain - If the property is complex, or an array of complex values, the default Content-Type is application/json - Question: how is the array of primitives encoded? - If the property is a type: string with a contentEncoding, the default Content-Type is application/octet-stream - """ - fields = [] - for key, value in in_data.items(): - if isinstance(value, tuple): - if value: - # values use explode = True, so the code makes a rest.RequestField for each item with name=key - for item in value: - request_field = cls.__multipart_form_item(key=key, value=item) - fields.append(request_field) - else: - # send an empty array as json because exploding will not send it - request_field = cls.__multipart_json_item(key=key, value=value) # type: ignore - fields.append(request_field) - else: - request_field = cls.__multipart_form_item(key=key, value=value) - fields.append(request_field) - - return {'fields': tuple(fields)} - - @staticmethod - def __serialize_application_octet_stream(in_data: typing.Union[schemas.FileIO, bytes]) -> SerializedRequestBody: - if isinstance(in_data, bytes): - return {'body': in_data} - # schemas.FileIO type - used_in_data = in_data.read() - in_data.close() - return {'body': used_in_data} - - @classmethod - def __serialize_application_x_www_form_data( - cls, in_data: schemas.immutabledict[str, _JSON_TYPES] - ) -> SerializedRequestBody: - """ - POST submission of form data in body - """ - cast_in_data = cls.__json_encoder.default(in_data) - value = cls._serialize_form(cast_in_data, name='', explode=True, percent_encode=True) - return {'body': value} - - @classmethod - def serialize( - cls, in_data: schemas.INPUT_TYPES_ALL, content_type: str - ) -> SerializedRequestBody: - """ - If a str is returned then the result will be assigned to data when making the request - If a tuple is returned then the result will be used as fields input in encode_multipart_formdata - Return a tuple of - - The key of the return dict is - - body for application/json - - encode_multipart and fields for multipart/form-data - """ - media_type = cls.content[content_type] - assert media_type.schema is not None - schema = schemas.get_class(media_type.schema) - cast_in_data = schema.validate_base(in_data) - # TODO check for and use encoding if it exists - # and content_type is multipart or application/x-www-form-urlencoded - if cls._content_type_is_json(content_type): - if isinstance(cast_in_data, (schemas.FileIO, bytes)): - raise ValueError(f"Invalid input data type. Data must be int/float/str/bool/None/tuple/immutabledict and it was type {type(cast_in_data)}") - return cls.__serialize_json(cast_in_data) - elif content_type == 'text/plain': - if not isinstance(cast_in_data, (int, float, str)): - raise ValueError(f"Unable to serialize type {type(cast_in_data)} to text/plain") - return cls.__serialize_text_plain(cast_in_data) - elif content_type == 'multipart/form-data': - if not isinstance(cast_in_data, schemas.immutabledict): - raise ValueError(f"Unable to serialize {cast_in_data} to multipart/form-data because it is not a dict of data") - return cls.__serialize_multipart_form_data(cast_in_data) - elif content_type == 'application/x-www-form-urlencoded': - if not isinstance(cast_in_data, schemas.immutabledict): - raise ValueError( - f"Unable to serialize {cast_in_data} to application/x-www-form-urlencoded because it is not a dict of data") - return cls.__serialize_application_x_www_form_data(cast_in_data) - elif content_type == 'application/octet-stream': - if not isinstance(cast_in_data, (schemas.FileIO, bytes)): - raise ValueError(f"Invalid input data type. Data must be bytes or File for content_type={content_type}") - return cls.__serialize_application_octet_stream(cast_in_data) - raise NotImplementedError('Serialization has not yet been implemented for {}'.format(content_type)) diff --git a/pynitrokey/nethsm/client/api_response.py b/pynitrokey/nethsm/client/api_response.py deleted file mode 100644 index 08845665..00000000 --- a/pynitrokey/nethsm/client/api_response.py +++ /dev/null @@ -1,28 +0,0 @@ -# coding: utf-8 -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -import dataclasses -import typing - -import urllib3 - -from pynitrokey.nethsm.client import schemas - - -@dataclasses.dataclass -class ApiResponse: - response: urllib3.HTTPResponse - body: typing.Union[schemas.Unset, schemas.OUTPUT_BASE_TYPES] = schemas.unset - headers: typing.Union[schemas.Unset, typing.Mapping[str, schemas.OUTPUT_BASE_TYPES]] = schemas.unset - - -@dataclasses.dataclass -class ApiResponseWithoutDeserialization(ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset diff --git a/pynitrokey/nethsm/client/apis/__init__.py b/pynitrokey/nethsm/client/apis/__init__.py deleted file mode 100644 index 7840f772..00000000 --- a/pynitrokey/nethsm/client/apis/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints then import them from -# tags, paths, or path_to_api, or tag_to_api \ No newline at end of file diff --git a/pynitrokey/nethsm/client/apis/path_to_api.py b/pynitrokey/nethsm/client/apis/path_to_api.py deleted file mode 100644 index 32973686..00000000 --- a/pynitrokey/nethsm/client/apis/path_to_api.py +++ /dev/null @@ -1,143 +0,0 @@ -import typing -import typing_extensions - -from pynitrokey.nethsm.client.apis.paths.config_backup_passphrase import ConfigBackupPassphrase -from pynitrokey.nethsm.client.apis.paths.config_logging import ConfigLogging -from pynitrokey.nethsm.client.apis.paths.config_network import ConfigNetwork -from pynitrokey.nethsm.client.apis.paths.config_time import ConfigTime -from pynitrokey.nethsm.client.apis.paths.config_tls_cert_pem import ConfigTlsCertPem -from pynitrokey.nethsm.client.apis.paths.config_tls_csr_pem import ConfigTlsCsrPem -from pynitrokey.nethsm.client.apis.paths.config_tls_generate import ConfigTlsGenerate -from pynitrokey.nethsm.client.apis.paths.config_tls_public_pem import ConfigTlsPublicPem -from pynitrokey.nethsm.client.apis.paths.config_unattended_boot import ConfigUnattendedBoot -from pynitrokey.nethsm.client.apis.paths.config_unlock_passphrase import ConfigUnlockPassphrase -from pynitrokey.nethsm.client.apis.paths.health_alive import HealthAlive -from pynitrokey.nethsm.client.apis.paths.health_ready import HealthReady -from pynitrokey.nethsm.client.apis.paths.health_state import HealthState -from pynitrokey.nethsm.client.apis.paths.info import Info -from pynitrokey.nethsm.client.apis.paths.keys import Keys -from pynitrokey.nethsm.client.apis.paths.keys_generate import KeysGenerate -from pynitrokey.nethsm.client.apis.paths.keys_key_id import KeysKeyID -from pynitrokey.nethsm.client.apis.paths.keys_key_id_cert import KeysKeyIDCert -from pynitrokey.nethsm.client.apis.paths.keys_key_id_csr_pem import KeysKeyIDCsrPem -from pynitrokey.nethsm.client.apis.paths.keys_key_id_decrypt import KeysKeyIDDecrypt -from pynitrokey.nethsm.client.apis.paths.keys_key_id_encrypt import KeysKeyIDEncrypt -from pynitrokey.nethsm.client.apis.paths.keys_key_id_public_pem import KeysKeyIDPublicPem -from pynitrokey.nethsm.client.apis.paths.keys_key_id_restrictions_tags_tag import KeysKeyIDRestrictionsTagsTag -from pynitrokey.nethsm.client.apis.paths.keys_key_id_sign import KeysKeyIDSign -from pynitrokey.nethsm.client.apis.paths.lock import Lock -from pynitrokey.nethsm.client.apis.paths.metrics import Metrics -from pynitrokey.nethsm.client.apis.paths.provision import Provision -from pynitrokey.nethsm.client.apis.paths.random import Random -from pynitrokey.nethsm.client.apis.paths.system_backup import SystemBackup -from pynitrokey.nethsm.client.apis.paths.system_cancel_update import SystemCancelUpdate -from pynitrokey.nethsm.client.apis.paths.system_commit_update import SystemCommitUpdate -from pynitrokey.nethsm.client.apis.paths.system_factory_reset import SystemFactoryReset -from pynitrokey.nethsm.client.apis.paths.system_info import SystemInfo -from pynitrokey.nethsm.client.apis.paths.system_reboot import SystemReboot -from pynitrokey.nethsm.client.apis.paths.system_restore import SystemRestore -from pynitrokey.nethsm.client.apis.paths.system_shutdown import SystemShutdown -from pynitrokey.nethsm.client.apis.paths.system_update import SystemUpdate -from pynitrokey.nethsm.client.apis.paths.unlock import Unlock -from pynitrokey.nethsm.client.apis.paths.users import Users -from pynitrokey.nethsm.client.apis.paths.users_user_id import UsersUserID -from pynitrokey.nethsm.client.apis.paths.users_user_id_passphrase import UsersUserIDPassphrase -from pynitrokey.nethsm.client.apis.paths.users_user_id_tags import UsersUserIDTags -from pynitrokey.nethsm.client.apis.paths.users_user_id_tags_tag import UsersUserIDTagsTag - -PathToApi = typing.TypedDict( - 'PathToApi', - { - "/config/backup-passphrase": typing.Type[ConfigBackupPassphrase], - "/config/logging": typing.Type[ConfigLogging], - "/config/network": typing.Type[ConfigNetwork], - "/config/time": typing.Type[ConfigTime], - "/config/tls/cert.pem": typing.Type[ConfigTlsCertPem], - "/config/tls/csr.pem": typing.Type[ConfigTlsCsrPem], - "/config/tls/generate": typing.Type[ConfigTlsGenerate], - "/config/tls/public.pem": typing.Type[ConfigTlsPublicPem], - "/config/unattended-boot": typing.Type[ConfigUnattendedBoot], - "/config/unlock-passphrase": typing.Type[ConfigUnlockPassphrase], - "/health/alive": typing.Type[HealthAlive], - "/health/ready": typing.Type[HealthReady], - "/health/state": typing.Type[HealthState], - "/info": typing.Type[Info], - "/keys": typing.Type[Keys], - "/keys/generate": typing.Type[KeysGenerate], - "/keys/{KeyID}": typing.Type[KeysKeyID], - "/keys/{KeyID}/cert": typing.Type[KeysKeyIDCert], - "/keys/{KeyID}/csr.pem": typing.Type[KeysKeyIDCsrPem], - "/keys/{KeyID}/decrypt": typing.Type[KeysKeyIDDecrypt], - "/keys/{KeyID}/encrypt": typing.Type[KeysKeyIDEncrypt], - "/keys/{KeyID}/public.pem": typing.Type[KeysKeyIDPublicPem], - "/keys/{KeyID}/restrictions/tags/{Tag}": typing.Type[KeysKeyIDRestrictionsTagsTag], - "/keys/{KeyID}/sign": typing.Type[KeysKeyIDSign], - "/lock": typing.Type[Lock], - "/metrics": typing.Type[Metrics], - "/provision": typing.Type[Provision], - "/random": typing.Type[Random], - "/system/backup": typing.Type[SystemBackup], - "/system/cancel-update": typing.Type[SystemCancelUpdate], - "/system/commit-update": typing.Type[SystemCommitUpdate], - "/system/factory-reset": typing.Type[SystemFactoryReset], - "/system/info": typing.Type[SystemInfo], - "/system/reboot": typing.Type[SystemReboot], - "/system/restore": typing.Type[SystemRestore], - "/system/shutdown": typing.Type[SystemShutdown], - "/system/update": typing.Type[SystemUpdate], - "/unlock": typing.Type[Unlock], - "/users": typing.Type[Users], - "/users/{UserID}": typing.Type[UsersUserID], - "/users/{UserID}/passphrase": typing.Type[UsersUserIDPassphrase], - "/users/{UserID}/tags": typing.Type[UsersUserIDTags], - "/users/{UserID}/tags/{Tag}": typing.Type[UsersUserIDTagsTag], - } -) - -path_to_api = PathToApi( - { - "/config/backup-passphrase": ConfigBackupPassphrase, - "/config/logging": ConfigLogging, - "/config/network": ConfigNetwork, - "/config/time": ConfigTime, - "/config/tls/cert.pem": ConfigTlsCertPem, - "/config/tls/csr.pem": ConfigTlsCsrPem, - "/config/tls/generate": ConfigTlsGenerate, - "/config/tls/public.pem": ConfigTlsPublicPem, - "/config/unattended-boot": ConfigUnattendedBoot, - "/config/unlock-passphrase": ConfigUnlockPassphrase, - "/health/alive": HealthAlive, - "/health/ready": HealthReady, - "/health/state": HealthState, - "/info": Info, - "/keys": Keys, - "/keys/generate": KeysGenerate, - "/keys/{KeyID}": KeysKeyID, - "/keys/{KeyID}/cert": KeysKeyIDCert, - "/keys/{KeyID}/csr.pem": KeysKeyIDCsrPem, - "/keys/{KeyID}/decrypt": KeysKeyIDDecrypt, - "/keys/{KeyID}/encrypt": KeysKeyIDEncrypt, - "/keys/{KeyID}/public.pem": KeysKeyIDPublicPem, - "/keys/{KeyID}/restrictions/tags/{Tag}": KeysKeyIDRestrictionsTagsTag, - "/keys/{KeyID}/sign": KeysKeyIDSign, - "/lock": Lock, - "/metrics": Metrics, - "/provision": Provision, - "/random": Random, - "/system/backup": SystemBackup, - "/system/cancel-update": SystemCancelUpdate, - "/system/commit-update": SystemCommitUpdate, - "/system/factory-reset": SystemFactoryReset, - "/system/info": SystemInfo, - "/system/reboot": SystemReboot, - "/system/restore": SystemRestore, - "/system/shutdown": SystemShutdown, - "/system/update": SystemUpdate, - "/unlock": Unlock, - "/users": Users, - "/users/{UserID}": UsersUserID, - "/users/{UserID}/passphrase": UsersUserIDPassphrase, - "/users/{UserID}/tags": UsersUserIDTags, - "/users/{UserID}/tags/{Tag}": UsersUserIDTagsTag, - } -) diff --git a/pynitrokey/nethsm/client/apis/paths/__init__.py b/pynitrokey/nethsm/client/apis/paths/__init__.py deleted file mode 100644 index d320af26..00000000 --- a/pynitrokey/nethsm/client/apis/paths/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.path_to_api import path_to_api \ No newline at end of file diff --git a/pynitrokey/nethsm/client/apis/paths/config_backup_passphrase.py b/pynitrokey/nethsm/client/apis/paths/config_backup_passphrase.py deleted file mode 100644 index c5b78229..00000000 --- a/pynitrokey/nethsm/client/apis/paths/config_backup_passphrase.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.config_backup_passphrase.put.operation import ApiForPut - - -class ConfigBackupPassphrase( - ApiForPut, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/config_logging.py b/pynitrokey/nethsm/client/apis/paths/config_logging.py deleted file mode 100644 index 380d8ed7..00000000 --- a/pynitrokey/nethsm/client/apis/paths/config_logging.py +++ /dev/null @@ -1,15 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.config_logging.get.operation import ApiForGet -from pynitrokey.nethsm.client.paths.config_logging.put.operation import ApiForPut - - -class ConfigLogging( - ApiForGet, - ApiForPut, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/config_network.py b/pynitrokey/nethsm/client/apis/paths/config_network.py deleted file mode 100644 index d5010bbb..00000000 --- a/pynitrokey/nethsm/client/apis/paths/config_network.py +++ /dev/null @@ -1,15 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.config_network.get.operation import ApiForGet -from pynitrokey.nethsm.client.paths.config_network.put.operation import ApiForPut - - -class ConfigNetwork( - ApiForGet, - ApiForPut, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/config_time.py b/pynitrokey/nethsm/client/apis/paths/config_time.py deleted file mode 100644 index 723c693e..00000000 --- a/pynitrokey/nethsm/client/apis/paths/config_time.py +++ /dev/null @@ -1,15 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.config_time.get.operation import ApiForGet -from pynitrokey.nethsm.client.paths.config_time.put.operation import ApiForPut - - -class ConfigTime( - ApiForGet, - ApiForPut, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/config_tls_cert_pem.py b/pynitrokey/nethsm/client/apis/paths/config_tls_cert_pem.py deleted file mode 100644 index 05ab4ec1..00000000 --- a/pynitrokey/nethsm/client/apis/paths/config_tls_cert_pem.py +++ /dev/null @@ -1,15 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.config_tls_cert_pem.get.operation import ApiForGet -from pynitrokey.nethsm.client.paths.config_tls_cert_pem.put.operation import ApiForPut - - -class ConfigTlsCertPem( - ApiForGet, - ApiForPut, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/config_tls_csr_pem.py b/pynitrokey/nethsm/client/apis/paths/config_tls_csr_pem.py deleted file mode 100644 index 0b05ffc5..00000000 --- a/pynitrokey/nethsm/client/apis/paths/config_tls_csr_pem.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.config_tls_csr_pem.post.operation import ApiForPost - - -class ConfigTlsCsrPem( - ApiForPost, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/config_tls_generate.py b/pynitrokey/nethsm/client/apis/paths/config_tls_generate.py deleted file mode 100644 index 01f7c23c..00000000 --- a/pynitrokey/nethsm/client/apis/paths/config_tls_generate.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.config_tls_generate.post.operation import ApiForPost - - -class ConfigTlsGenerate( - ApiForPost, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/config_tls_public_pem.py b/pynitrokey/nethsm/client/apis/paths/config_tls_public_pem.py deleted file mode 100644 index 6ac66b00..00000000 --- a/pynitrokey/nethsm/client/apis/paths/config_tls_public_pem.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.config_tls_public_pem.get.operation import ApiForGet - - -class ConfigTlsPublicPem( - ApiForGet, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/config_unattended_boot.py b/pynitrokey/nethsm/client/apis/paths/config_unattended_boot.py deleted file mode 100644 index c564b353..00000000 --- a/pynitrokey/nethsm/client/apis/paths/config_unattended_boot.py +++ /dev/null @@ -1,15 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.config_unattended_boot.get.operation import ApiForGet -from pynitrokey.nethsm.client.paths.config_unattended_boot.put.operation import ApiForPut - - -class ConfigUnattendedBoot( - ApiForGet, - ApiForPut, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/config_unlock_passphrase.py b/pynitrokey/nethsm/client/apis/paths/config_unlock_passphrase.py deleted file mode 100644 index 39a58689..00000000 --- a/pynitrokey/nethsm/client/apis/paths/config_unlock_passphrase.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.config_unlock_passphrase.put.operation import ApiForPut - - -class ConfigUnlockPassphrase( - ApiForPut, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/health_alive.py b/pynitrokey/nethsm/client/apis/paths/health_alive.py deleted file mode 100644 index 2f7b9c52..00000000 --- a/pynitrokey/nethsm/client/apis/paths/health_alive.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.health_alive.get.operation import ApiForGet - - -class HealthAlive( - ApiForGet, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/health_ready.py b/pynitrokey/nethsm/client/apis/paths/health_ready.py deleted file mode 100644 index f657e970..00000000 --- a/pynitrokey/nethsm/client/apis/paths/health_ready.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.health_ready.get.operation import ApiForGet - - -class HealthReady( - ApiForGet, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/health_state.py b/pynitrokey/nethsm/client/apis/paths/health_state.py deleted file mode 100644 index 1aaef88a..00000000 --- a/pynitrokey/nethsm/client/apis/paths/health_state.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.health_state.get.operation import ApiForGet - - -class HealthState( - ApiForGet, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/info.py b/pynitrokey/nethsm/client/apis/paths/info.py deleted file mode 100644 index 1e08c694..00000000 --- a/pynitrokey/nethsm/client/apis/paths/info.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.info.get.operation import ApiForGet - - -class Info( - ApiForGet, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/keys.py b/pynitrokey/nethsm/client/apis/paths/keys.py deleted file mode 100644 index 4dfc8474..00000000 --- a/pynitrokey/nethsm/client/apis/paths/keys.py +++ /dev/null @@ -1,15 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.keys.get.operation import ApiForGet -from pynitrokey.nethsm.client.paths.keys.post.operation import ApiForPost - - -class Keys( - ApiForGet, - ApiForPost, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/keys_generate.py b/pynitrokey/nethsm/client/apis/paths/keys_generate.py deleted file mode 100644 index ed75583b..00000000 --- a/pynitrokey/nethsm/client/apis/paths/keys_generate.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.keys_generate.post.operation import ApiForPost - - -class KeysGenerate( - ApiForPost, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/keys_key_id.py b/pynitrokey/nethsm/client/apis/paths/keys_key_id.py deleted file mode 100644 index d6618efb..00000000 --- a/pynitrokey/nethsm/client/apis/paths/keys_key_id.py +++ /dev/null @@ -1,17 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.keys_key_id.delete.operation import ApiForDelete -from pynitrokey.nethsm.client.paths.keys_key_id.get.operation import ApiForGet -from pynitrokey.nethsm.client.paths.keys_key_id.put.operation import ApiForPut - - -class KeysKeyID( - ApiForDelete, - ApiForGet, - ApiForPut, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/keys_key_id_cert.py b/pynitrokey/nethsm/client/apis/paths/keys_key_id_cert.py deleted file mode 100644 index 605da2a9..00000000 --- a/pynitrokey/nethsm/client/apis/paths/keys_key_id_cert.py +++ /dev/null @@ -1,17 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.keys_key_id_cert.delete.operation import ApiForDelete -from pynitrokey.nethsm.client.paths.keys_key_id_cert.get.operation import ApiForGet -from pynitrokey.nethsm.client.paths.keys_key_id_cert.put.operation import ApiForPut - - -class KeysKeyIDCert( - ApiForDelete, - ApiForGet, - ApiForPut, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/keys_key_id_csr_pem.py b/pynitrokey/nethsm/client/apis/paths/keys_key_id_csr_pem.py deleted file mode 100644 index 0f0d5dfb..00000000 --- a/pynitrokey/nethsm/client/apis/paths/keys_key_id_csr_pem.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.keys_key_id_csr_pem.post.operation import ApiForPost - - -class KeysKeyIDCsrPem( - ApiForPost, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/keys_key_id_decrypt.py b/pynitrokey/nethsm/client/apis/paths/keys_key_id_decrypt.py deleted file mode 100644 index 45ec1cfa..00000000 --- a/pynitrokey/nethsm/client/apis/paths/keys_key_id_decrypt.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.keys_key_id_decrypt.post.operation import ApiForPost - - -class KeysKeyIDDecrypt( - ApiForPost, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/keys_key_id_encrypt.py b/pynitrokey/nethsm/client/apis/paths/keys_key_id_encrypt.py deleted file mode 100644 index c0cef419..00000000 --- a/pynitrokey/nethsm/client/apis/paths/keys_key_id_encrypt.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.keys_key_id_encrypt.post.operation import ApiForPost - - -class KeysKeyIDEncrypt( - ApiForPost, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/keys_key_id_public_pem.py b/pynitrokey/nethsm/client/apis/paths/keys_key_id_public_pem.py deleted file mode 100644 index cd9488ee..00000000 --- a/pynitrokey/nethsm/client/apis/paths/keys_key_id_public_pem.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.keys_key_id_public_pem.get.operation import ApiForGet - - -class KeysKeyIDPublicPem( - ApiForGet, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/keys_key_id_restrictions_tags_tag.py b/pynitrokey/nethsm/client/apis/paths/keys_key_id_restrictions_tags_tag.py deleted file mode 100644 index c29c440f..00000000 --- a/pynitrokey/nethsm/client/apis/paths/keys_key_id_restrictions_tags_tag.py +++ /dev/null @@ -1,15 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.keys_key_id_restrictions_tags_tag.delete.operation import ApiForDelete -from pynitrokey.nethsm.client.paths.keys_key_id_restrictions_tags_tag.put.operation import ApiForPut - - -class KeysKeyIDRestrictionsTagsTag( - ApiForDelete, - ApiForPut, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/keys_key_id_sign.py b/pynitrokey/nethsm/client/apis/paths/keys_key_id_sign.py deleted file mode 100644 index e4b8cef9..00000000 --- a/pynitrokey/nethsm/client/apis/paths/keys_key_id_sign.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.keys_key_id_sign.post.operation import ApiForPost - - -class KeysKeyIDSign( - ApiForPost, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/lock.py b/pynitrokey/nethsm/client/apis/paths/lock.py deleted file mode 100644 index a6d542f3..00000000 --- a/pynitrokey/nethsm/client/apis/paths/lock.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.lock.post.operation import ApiForPost - - -class Lock( - ApiForPost, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/metrics.py b/pynitrokey/nethsm/client/apis/paths/metrics.py deleted file mode 100644 index 7897c423..00000000 --- a/pynitrokey/nethsm/client/apis/paths/metrics.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.metrics.get.operation import ApiForGet - - -class Metrics( - ApiForGet, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/provision.py b/pynitrokey/nethsm/client/apis/paths/provision.py deleted file mode 100644 index 1ea09b29..00000000 --- a/pynitrokey/nethsm/client/apis/paths/provision.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.provision.post.operation import ApiForPost - - -class Provision( - ApiForPost, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/random.py b/pynitrokey/nethsm/client/apis/paths/random.py deleted file mode 100644 index 68ef2e24..00000000 --- a/pynitrokey/nethsm/client/apis/paths/random.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.random.post.operation import ApiForPost - - -class Random( - ApiForPost, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/system_backup.py b/pynitrokey/nethsm/client/apis/paths/system_backup.py deleted file mode 100644 index 007f170d..00000000 --- a/pynitrokey/nethsm/client/apis/paths/system_backup.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.system_backup.post.operation import ApiForPost - - -class SystemBackup( - ApiForPost, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/system_cancel_update.py b/pynitrokey/nethsm/client/apis/paths/system_cancel_update.py deleted file mode 100644 index aeec7aaa..00000000 --- a/pynitrokey/nethsm/client/apis/paths/system_cancel_update.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.system_cancel_update.post.operation import ApiForPost - - -class SystemCancelUpdate( - ApiForPost, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/system_commit_update.py b/pynitrokey/nethsm/client/apis/paths/system_commit_update.py deleted file mode 100644 index e1b8905f..00000000 --- a/pynitrokey/nethsm/client/apis/paths/system_commit_update.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.system_commit_update.post.operation import ApiForPost - - -class SystemCommitUpdate( - ApiForPost, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/system_factory_reset.py b/pynitrokey/nethsm/client/apis/paths/system_factory_reset.py deleted file mode 100644 index 2fec559c..00000000 --- a/pynitrokey/nethsm/client/apis/paths/system_factory_reset.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.system_factory_reset.post.operation import ApiForPost - - -class SystemFactoryReset( - ApiForPost, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/system_info.py b/pynitrokey/nethsm/client/apis/paths/system_info.py deleted file mode 100644 index e7f595b5..00000000 --- a/pynitrokey/nethsm/client/apis/paths/system_info.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.system_info.get.operation import ApiForGet - - -class SystemInfo( - ApiForGet, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/system_reboot.py b/pynitrokey/nethsm/client/apis/paths/system_reboot.py deleted file mode 100644 index 8cac6031..00000000 --- a/pynitrokey/nethsm/client/apis/paths/system_reboot.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.system_reboot.post.operation import ApiForPost - - -class SystemReboot( - ApiForPost, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/system_restore.py b/pynitrokey/nethsm/client/apis/paths/system_restore.py deleted file mode 100644 index 8e514069..00000000 --- a/pynitrokey/nethsm/client/apis/paths/system_restore.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.system_restore.post.operation import ApiForPost - - -class SystemRestore( - ApiForPost, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/system_shutdown.py b/pynitrokey/nethsm/client/apis/paths/system_shutdown.py deleted file mode 100644 index 202a7f84..00000000 --- a/pynitrokey/nethsm/client/apis/paths/system_shutdown.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.system_shutdown.post.operation import ApiForPost - - -class SystemShutdown( - ApiForPost, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/system_update.py b/pynitrokey/nethsm/client/apis/paths/system_update.py deleted file mode 100644 index 773f0a8d..00000000 --- a/pynitrokey/nethsm/client/apis/paths/system_update.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.system_update.post.operation import ApiForPost - - -class SystemUpdate( - ApiForPost, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/unlock.py b/pynitrokey/nethsm/client/apis/paths/unlock.py deleted file mode 100644 index 8caed8cd..00000000 --- a/pynitrokey/nethsm/client/apis/paths/unlock.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.unlock.post.operation import ApiForPost - - -class Unlock( - ApiForPost, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/users.py b/pynitrokey/nethsm/client/apis/paths/users.py deleted file mode 100644 index af575546..00000000 --- a/pynitrokey/nethsm/client/apis/paths/users.py +++ /dev/null @@ -1,15 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.users.get.operation import ApiForGet -from pynitrokey.nethsm.client.paths.users.post.operation import ApiForPost - - -class Users( - ApiForGet, - ApiForPost, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/users_user_id.py b/pynitrokey/nethsm/client/apis/paths/users_user_id.py deleted file mode 100644 index 66afcb78..00000000 --- a/pynitrokey/nethsm/client/apis/paths/users_user_id.py +++ /dev/null @@ -1,17 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.users_user_id.delete.operation import ApiForDelete -from pynitrokey.nethsm.client.paths.users_user_id.get.operation import ApiForGet -from pynitrokey.nethsm.client.paths.users_user_id.put.operation import ApiForPut - - -class UsersUserID( - ApiForDelete, - ApiForGet, - ApiForPut, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/users_user_id_passphrase.py b/pynitrokey/nethsm/client/apis/paths/users_user_id_passphrase.py deleted file mode 100644 index a582774d..00000000 --- a/pynitrokey/nethsm/client/apis/paths/users_user_id_passphrase.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.users_user_id_passphrase.post.operation import ApiForPost - - -class UsersUserIDPassphrase( - ApiForPost, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/users_user_id_tags.py b/pynitrokey/nethsm/client/apis/paths/users_user_id_tags.py deleted file mode 100644 index d0b8843b..00000000 --- a/pynitrokey/nethsm/client/apis/paths/users_user_id_tags.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.users_user_id_tags.get.operation import ApiForGet - - -class UsersUserIDTags( - ApiForGet, -): - pass diff --git a/pynitrokey/nethsm/client/apis/paths/users_user_id_tags_tag.py b/pynitrokey/nethsm/client/apis/paths/users_user_id_tags_tag.py deleted file mode 100644 index 0540b1de..00000000 --- a/pynitrokey/nethsm/client/apis/paths/users_user_id_tags_tag.py +++ /dev/null @@ -1,15 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.users_user_id_tags_tag.delete.operation import ApiForDelete -from pynitrokey.nethsm.client.paths.users_user_id_tags_tag.put.operation import ApiForPut - - -class UsersUserIDTagsTag( - ApiForDelete, - ApiForPut, -): - pass diff --git a/pynitrokey/nethsm/client/apis/tag_to_api.py b/pynitrokey/nethsm/client/apis/tag_to_api.py deleted file mode 100644 index 6016f291..00000000 --- a/pynitrokey/nethsm/client/apis/tag_to_api.py +++ /dev/null @@ -1,17 +0,0 @@ -import typing -import typing_extensions - -from pynitrokey.nethsm.client.apis.tags.default_api import DefaultApi - -TagToApi = typing.TypedDict( - 'TagToApi', - { - "default": typing.Type[DefaultApi], - } -) - -tag_to_api = TagToApi( - { - "default": DefaultApi, - } -) diff --git a/pynitrokey/nethsm/client/apis/tags/__init__.py b/pynitrokey/nethsm/client/apis/tags/__init__.py deleted file mode 100644 index 88df0dd3..00000000 --- a/pynitrokey/nethsm/client/apis/tags/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.tag_to_api import tag_to_api \ No newline at end of file diff --git a/pynitrokey/nethsm/client/apis/tags/default_api.py b/pynitrokey/nethsm/client/apis/tags/default_api.py deleted file mode 100644 index 9fd291f1..00000000 --- a/pynitrokey/nethsm/client/apis/tags/default_api.py +++ /dev/null @@ -1,132 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.paths.keys_key_id_csr_pem.post.operation import KeysKeyIDCsrPemPost -from pynitrokey.nethsm.client.paths.system_factory_reset.post.operation import SystemFactoryResetPost -from pynitrokey.nethsm.client.paths.system_commit_update.post.operation import SystemCommitUpdatePost -from pynitrokey.nethsm.client.paths.system_update.post.operation import SystemUpdatePost -from pynitrokey.nethsm.client.paths.system_info.get.operation import SystemInfoGet -from pynitrokey.nethsm.client.paths.config_tls_csr_pem.post.operation import ConfigTlsCsrPemPost -from pynitrokey.nethsm.client.paths.config_tls_generate.post.operation import ConfigTlsGeneratePost -from pynitrokey.nethsm.client.paths.keys_key_id_decrypt.post.operation import KeysKeyIDDecryptPost -from pynitrokey.nethsm.client.paths.users_user_id_tags.get.operation import UsersUserIDTagsGet -from pynitrokey.nethsm.client.paths.config_tls_cert_pem.get.operation import ConfigTlsCertPemGet -from pynitrokey.nethsm.client.paths.config_tls_cert_pem.put.operation import ConfigTlsCertPemPut -from pynitrokey.nethsm.client.paths.system_backup.post.operation import SystemBackupPost -from pynitrokey.nethsm.client.paths.provision.post.operation import ProvisionPost -from pynitrokey.nethsm.client.paths.keys_key_id_sign.post.operation import KeysKeyIDSignPost -from pynitrokey.nethsm.client.paths.health_state.get.operation import HealthStateGet -from pynitrokey.nethsm.client.paths.keys_key_id_cert.delete.operation import KeysKeyIDCertDelete -from pynitrokey.nethsm.client.paths.keys_key_id_cert.get.operation import KeysKeyIDCertGet -from pynitrokey.nethsm.client.paths.keys_key_id_cert.put.operation import KeysKeyIDCertPut -from pynitrokey.nethsm.client.paths.keys_key_id_encrypt.post.operation import KeysKeyIDEncryptPost -from pynitrokey.nethsm.client.paths.system_cancel_update.post.operation import SystemCancelUpdatePost -from pynitrokey.nethsm.client.paths.keys_key_id_public_pem.get.operation import KeysKeyIDPublicPemGet -from pynitrokey.nethsm.client.paths.config_unlock_passphrase.put.operation import ConfigUnlockPassphrasePut -from pynitrokey.nethsm.client.paths.system_reboot.post.operation import SystemRebootPost -from pynitrokey.nethsm.client.paths.keys_key_id_restrictions_tags_tag.delete.operation import KeysKeyIDRestrictionsTagsTagDelete -from pynitrokey.nethsm.client.paths.keys_key_id_restrictions_tags_tag.put.operation import KeysKeyIDRestrictionsTagsTagPut -from pynitrokey.nethsm.client.paths.unlock.post.operation import UnlockPost -from pynitrokey.nethsm.client.paths.config_logging.get.operation import ConfigLoggingGet -from pynitrokey.nethsm.client.paths.config_logging.put.operation import ConfigLoggingPut -from pynitrokey.nethsm.client.paths.lock.post.operation import LockPost -from pynitrokey.nethsm.client.paths.config_unattended_boot.get.operation import ConfigUnattendedBootGet -from pynitrokey.nethsm.client.paths.config_unattended_boot.put.operation import ConfigUnattendedBootPut -from pynitrokey.nethsm.client.paths.keys_generate.post.operation import KeysGeneratePost -from pynitrokey.nethsm.client.paths.config_tls_public_pem.get.operation import ConfigTlsPublicPemGet -from pynitrokey.nethsm.client.paths.info.get.operation import InfoGet -from pynitrokey.nethsm.client.paths.config_backup_passphrase.put.operation import ConfigBackupPassphrasePut -from pynitrokey.nethsm.client.paths.health_ready.get.operation import HealthReadyGet -from pynitrokey.nethsm.client.paths.config_time.get.operation import ConfigTimeGet -from pynitrokey.nethsm.client.paths.config_time.put.operation import ConfigTimePut -from pynitrokey.nethsm.client.paths.system_shutdown.post.operation import SystemShutdownPost -from pynitrokey.nethsm.client.paths.config_network.get.operation import ConfigNetworkGet -from pynitrokey.nethsm.client.paths.config_network.put.operation import ConfigNetworkPut -from pynitrokey.nethsm.client.paths.keys_key_id.delete.operation import KeysKeyIDDelete -from pynitrokey.nethsm.client.paths.keys_key_id.get.operation import KeysKeyIDGet -from pynitrokey.nethsm.client.paths.keys_key_id.put.operation import KeysKeyIDPut -from pynitrokey.nethsm.client.paths.health_alive.get.operation import HealthAliveGet -from pynitrokey.nethsm.client.paths.metrics.get.operation import MetricsGet -from pynitrokey.nethsm.client.paths.users_user_id_passphrase.post.operation import UsersUserIDPassphrasePost -from pynitrokey.nethsm.client.paths.users_user_id.delete.operation import UsersUserIDDelete -from pynitrokey.nethsm.client.paths.users_user_id.get.operation import UsersUserIDGet -from pynitrokey.nethsm.client.paths.users_user_id.put.operation import UsersUserIDPut -from pynitrokey.nethsm.client.paths.system_restore.post.operation import SystemRestorePost -from pynitrokey.nethsm.client.paths.users_user_id_tags_tag.delete.operation import UsersUserIDTagsTagDelete -from pynitrokey.nethsm.client.paths.users_user_id_tags_tag.put.operation import UsersUserIDTagsTagPut -from pynitrokey.nethsm.client.paths.keys.get.operation import KeysGet -from pynitrokey.nethsm.client.paths.keys.post.operation import KeysPost -from pynitrokey.nethsm.client.paths.random.post.operation import RandomPost -from pynitrokey.nethsm.client.paths.users.get.operation import UsersGet -from pynitrokey.nethsm.client.paths.users.post.operation import UsersPost - - -class DefaultApi( - KeysKeyIDCsrPemPost, - SystemFactoryResetPost, - SystemCommitUpdatePost, - SystemUpdatePost, - SystemInfoGet, - ConfigTlsCsrPemPost, - ConfigTlsGeneratePost, - KeysKeyIDDecryptPost, - UsersUserIDTagsGet, - ConfigTlsCertPemGet, - ConfigTlsCertPemPut, - SystemBackupPost, - ProvisionPost, - KeysKeyIDSignPost, - HealthStateGet, - KeysKeyIDCertDelete, - KeysKeyIDCertGet, - KeysKeyIDCertPut, - KeysKeyIDEncryptPost, - SystemCancelUpdatePost, - KeysKeyIDPublicPemGet, - ConfigUnlockPassphrasePut, - SystemRebootPost, - KeysKeyIDRestrictionsTagsTagDelete, - KeysKeyIDRestrictionsTagsTagPut, - UnlockPost, - ConfigLoggingGet, - ConfigLoggingPut, - LockPost, - ConfigUnattendedBootGet, - ConfigUnattendedBootPut, - KeysGeneratePost, - ConfigTlsPublicPemGet, - InfoGet, - ConfigBackupPassphrasePut, - HealthReadyGet, - ConfigTimeGet, - ConfigTimePut, - SystemShutdownPost, - ConfigNetworkGet, - ConfigNetworkPut, - KeysKeyIDDelete, - KeysKeyIDGet, - KeysKeyIDPut, - HealthAliveGet, - MetricsGet, - UsersUserIDPassphrasePost, - UsersUserIDDelete, - UsersUserIDGet, - UsersUserIDPut, - SystemRestorePost, - UsersUserIDTagsTagDelete, - UsersUserIDTagsTagPut, - KeysGet, - KeysPost, - RandomPost, - UsersGet, - UsersPost, -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - pass diff --git a/pynitrokey/nethsm/client/components/__init__.py b/pynitrokey/nethsm/client/components/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/components/request_bodies/__init__.py b/pynitrokey/nethsm/client/components/request_bodies/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/components/responses/__init__.py b/pynitrokey/nethsm/client/components/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/components/schema/__init__.py b/pynitrokey/nethsm/client/components/schema/__init__.py deleted file mode 100644 index f33acd4d..00000000 --- a/pynitrokey/nethsm/client/components/schema/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# we can not import model classes here because that would create a circular -# reference which would not work in python2 -# do not import all models into this module because that uses a lot of memory and stack frames -# if you need the ability to import all models from one package, import them with -# from pynitrokey.nethsm.client.components.schemas import ModelA, ModelB diff --git a/pynitrokey/nethsm/client/components/schema/backup_passphrase_config.py b/pynitrokey/nethsm/client/components/schema/backup_passphrase_config.py deleted file mode 100644 index 169767df..00000000 --- a/pynitrokey/nethsm/client/components/schema/backup_passphrase_config.py +++ /dev/null @@ -1,103 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -from pynitrokey.nethsm.client.components.schema import passphrase -Properties = typing.TypedDict( - 'Properties', - { - "passphrase": typing.Type[passphrase.Passphrase], - } -) - - -class BackupPassphraseConfigDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - __required_keys__: typing.FrozenSet[str] = frozenset({ - "passphrase", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - passphrase: str, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - **kwargs: schemas.INPUT_TYPES_ALL, - ): - arg_: typing.Dict[str, typing.Any] = { - "passphrase": passphrase, - } - arg_.update(kwargs) - used_arg_ = typing.cast(BackupPassphraseConfigDictInput, arg_) - return BackupPassphraseConfig.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - BackupPassphraseConfigDictInput, - BackupPassphraseConfigDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> BackupPassphraseConfigDict: - return BackupPassphraseConfig.validate(arg, configuration=configuration) - - @property - def passphrase(self) -> str: - return typing.cast( - str, - self.__getitem__("passphrase") - ) - - def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]: - schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__) - return self.get(name, schemas.unset) -BackupPassphraseConfigDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL] - - -@dataclasses.dataclass(frozen=True) -class BackupPassphraseConfig( - schemas.Schema[BackupPassphraseConfigDict, tuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "passphrase", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: BackupPassphraseConfigDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - BackupPassphraseConfigDictInput, - BackupPassphraseConfigDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> BackupPassphraseConfigDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/components/schema/base64.py b/pynitrokey/nethsm/client/components/schema/base64.py deleted file mode 100644 index 1389b2ae..00000000 --- a/pynitrokey/nethsm/client/components/schema/base64.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - - -@dataclasses.dataclass(frozen=True) -class Base64( - schemas.StrSchema -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({ - str, - }) - pattern: schemas.PatternInfo = schemas.PatternInfo( - pattern=r'^[a-zA-Z0-9+/]+={0,3}$' # noqa: E501 - ) diff --git a/pynitrokey/nethsm/client/components/schema/decrypt_data.py b/pynitrokey/nethsm/client/components/schema/decrypt_data.py deleted file mode 100644 index d0a866be..00000000 --- a/pynitrokey/nethsm/client/components/schema/decrypt_data.py +++ /dev/null @@ -1,103 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -from pynitrokey.nethsm.client.components.schema import base64 -Properties = typing.TypedDict( - 'Properties', - { - "decrypted": typing.Type[base64.Base64], - } -) - - -class DecryptDataDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - __required_keys__: typing.FrozenSet[str] = frozenset({ - "decrypted", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - decrypted: str, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - **kwargs: schemas.INPUT_TYPES_ALL, - ): - arg_: typing.Dict[str, typing.Any] = { - "decrypted": decrypted, - } - arg_.update(kwargs) - used_arg_ = typing.cast(DecryptDataDictInput, arg_) - return DecryptData.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - DecryptDataDictInput, - DecryptDataDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> DecryptDataDict: - return DecryptData.validate(arg, configuration=configuration) - - @property - def decrypted(self) -> str: - return typing.cast( - str, - self.__getitem__("decrypted") - ) - - def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]: - schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__) - return self.get(name, schemas.unset) -DecryptDataDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL] - - -@dataclasses.dataclass(frozen=True) -class DecryptData( - schemas.Schema[DecryptDataDict, tuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "decrypted", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: DecryptDataDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - DecryptDataDictInput, - DecryptDataDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> DecryptDataDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/components/schema/decrypt_mode.py b/pynitrokey/nethsm/client/components/schema/decrypt_mode.py deleted file mode 100644 index 25dec7dd..00000000 --- a/pynitrokey/nethsm/client/components/schema/decrypt_mode.py +++ /dev/null @@ -1,183 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - - -class DecryptModeEnums: - - @schemas.classproperty - def RAW(cls) -> typing.Literal["RAW"]: - return DecryptMode.validate("RAW") - - @schemas.classproperty - def PKCS1(cls) -> typing.Literal["PKCS1"]: - return DecryptMode.validate("PKCS1") - - @schemas.classproperty - def OAEP_MD5(cls) -> typing.Literal["OAEP_MD5"]: - return DecryptMode.validate("OAEP_MD5") - - @schemas.classproperty - def OAEP_SHA1(cls) -> typing.Literal["OAEP_SHA1"]: - return DecryptMode.validate("OAEP_SHA1") - - @schemas.classproperty - def OAEP_SHA224(cls) -> typing.Literal["OAEP_SHA224"]: - return DecryptMode.validate("OAEP_SHA224") - - @schemas.classproperty - def OAEP_SHA256(cls) -> typing.Literal["OAEP_SHA256"]: - return DecryptMode.validate("OAEP_SHA256") - - @schemas.classproperty - def OAEP_SHA384(cls) -> typing.Literal["OAEP_SHA384"]: - return DecryptMode.validate("OAEP_SHA384") - - @schemas.classproperty - def OAEP_SHA512(cls) -> typing.Literal["OAEP_SHA512"]: - return DecryptMode.validate("OAEP_SHA512") - - @schemas.classproperty - def AES_CBC(cls) -> typing.Literal["AES_CBC"]: - return DecryptMode.validate("AES_CBC") - - -@dataclasses.dataclass(frozen=True) -class DecryptMode( - schemas.Schema -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({ - str, - }) - enum_value_to_name: typing.Mapping[typing.Union[int, float, str, schemas.Bool, None], str] = dataclasses.field( - default_factory=lambda: { - "RAW": "RAW", - "PKCS1": "PKCS1", - "OAEP_MD5": "OAEP_MD5", - "OAEP_SHA1": "OAEP_SHA1", - "OAEP_SHA224": "OAEP_SHA224", - "OAEP_SHA256": "OAEP_SHA256", - "OAEP_SHA384": "OAEP_SHA384", - "OAEP_SHA512": "OAEP_SHA512", - "AES_CBC": "AES_CBC", - } - ) - enums = DecryptModeEnums - - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["RAW"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["RAW"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["PKCS1"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["PKCS1"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["OAEP_MD5"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["OAEP_MD5"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["OAEP_SHA1"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["OAEP_SHA1"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["OAEP_SHA224"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["OAEP_SHA224"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["OAEP_SHA256"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["OAEP_SHA256"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["OAEP_SHA384"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["OAEP_SHA384"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["OAEP_SHA512"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["OAEP_SHA512"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["AES_CBC"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["AES_CBC"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: str, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["RAW","PKCS1","OAEP_MD5","OAEP_SHA1","OAEP_SHA224","OAEP_SHA256","OAEP_SHA384","OAEP_SHA512","AES_CBC",]: ... - @classmethod - def validate( - cls, - arg, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal[ - "RAW", - "PKCS1", - "OAEP_MD5", - "OAEP_SHA1", - "OAEP_SHA224", - "OAEP_SHA256", - "OAEP_SHA384", - "OAEP_SHA512", - "AES_CBC", - ]: - validated_arg = super().validate_base( - arg, - configuration=configuration, - ) - return typing.cast(typing.Literal[ - "RAW", - "PKCS1", - "OAEP_MD5", - "OAEP_SHA1", - "OAEP_SHA224", - "OAEP_SHA256", - "OAEP_SHA384", - "OAEP_SHA512", - "AES_CBC", - ], - validated_arg - ) diff --git a/pynitrokey/nethsm/client/components/schema/decrypt_request_data.py b/pynitrokey/nethsm/client/components/schema/decrypt_request_data.py deleted file mode 100644 index c55f8c1a..00000000 --- a/pynitrokey/nethsm/client/components/schema/decrypt_request_data.py +++ /dev/null @@ -1,148 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -from pynitrokey.nethsm.client.components.schema import base64 -from pynitrokey.nethsm.client.components.schema import decrypt_mode -Properties = typing.TypedDict( - 'Properties', - { - "mode": typing.Type[decrypt_mode.DecryptMode], - "encrypted": typing.Type[base64.Base64], - "iv": typing.Type[base64.Base64], - } -) - - -class DecryptRequestDataDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - __required_keys__: typing.FrozenSet[str] = frozenset({ - "encrypted", - "mode", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - "iv", - }) - - def __new__( - cls, - *, - encrypted: str, - mode: typing.Literal[ - "RAW", - "PKCS1", - "OAEP_MD5", - "OAEP_SHA1", - "OAEP_SHA224", - "OAEP_SHA256", - "OAEP_SHA384", - "OAEP_SHA512", - "AES_CBC" - ], - iv: typing.Union[ - str, - schemas.Unset - ] = schemas.unset, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - **kwargs: schemas.INPUT_TYPES_ALL, - ): - arg_: typing.Dict[str, typing.Any] = { - "encrypted": encrypted, - "mode": mode, - } - for key, val in ( - ("iv", iv), - ): - if isinstance(val, schemas.Unset): - continue - arg_[key] = val - arg_.update(kwargs) - used_arg_ = typing.cast(DecryptRequestDataDictInput, arg_) - return DecryptRequestData.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - DecryptRequestDataDictInput, - DecryptRequestDataDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> DecryptRequestDataDict: - return DecryptRequestData.validate(arg, configuration=configuration) - - @property - def encrypted(self) -> str: - return typing.cast( - str, - self.__getitem__("encrypted") - ) - - @property - def mode(self) -> typing.Literal["RAW", "PKCS1", "OAEP_MD5", "OAEP_SHA1", "OAEP_SHA224", "OAEP_SHA256", "OAEP_SHA384", "OAEP_SHA512", "AES_CBC"]: - return typing.cast( - typing.Literal["RAW", "PKCS1", "OAEP_MD5", "OAEP_SHA1", "OAEP_SHA224", "OAEP_SHA256", "OAEP_SHA384", "OAEP_SHA512", "AES_CBC"], - self.__getitem__("mode") - ) - - @property - def iv(self) -> typing.Union[str, schemas.Unset]: - val = self.get("iv", schemas.unset) - if isinstance(val, schemas.Unset): - return val - return typing.cast( - str, - val - ) - - def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]: - schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__) - return self.get(name, schemas.unset) -DecryptRequestDataDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL] - - -@dataclasses.dataclass(frozen=True) -class DecryptRequestData( - schemas.Schema[DecryptRequestDataDict, tuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "encrypted", - "mode", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: DecryptRequestDataDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - DecryptRequestDataDictInput, - DecryptRequestDataDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> DecryptRequestDataDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/components/schema/distinguished_name.py b/pynitrokey/nethsm/client/components/schema/distinguished_name.py deleted file mode 100644 index 6a8ce334..00000000 --- a/pynitrokey/nethsm/client/components/schema/distinguished_name.py +++ /dev/null @@ -1,216 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -CountryName: typing_extensions.TypeAlias = schemas.StrSchema -StateOrProvinceName: typing_extensions.TypeAlias = schemas.StrSchema -LocalityName: typing_extensions.TypeAlias = schemas.StrSchema -OrganizationName: typing_extensions.TypeAlias = schemas.StrSchema -OrganizationalUnitName: typing_extensions.TypeAlias = schemas.StrSchema -CommonName: typing_extensions.TypeAlias = schemas.StrSchema -EmailAddress: typing_extensions.TypeAlias = schemas.StrSchema -Properties = typing.TypedDict( - 'Properties', - { - "countryName": typing.Type[CountryName], - "stateOrProvinceName": typing.Type[StateOrProvinceName], - "localityName": typing.Type[LocalityName], - "organizationName": typing.Type[OrganizationName], - "organizationalUnitName": typing.Type[OrganizationalUnitName], - "commonName": typing.Type[CommonName], - "emailAddress": typing.Type[EmailAddress], - } -) - - -class DistinguishedNameDict(schemas.immutabledict[str, str]): - - __required_keys__: typing.FrozenSet[str] = frozenset({ - "commonName", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - "countryName", - "stateOrProvinceName", - "localityName", - "organizationName", - "organizationalUnitName", - "emailAddress", - }) - - def __new__( - cls, - *, - commonName: str, - countryName: typing.Union[ - str, - schemas.Unset - ] = schemas.unset, - stateOrProvinceName: typing.Union[ - str, - schemas.Unset - ] = schemas.unset, - localityName: typing.Union[ - str, - schemas.Unset - ] = schemas.unset, - organizationName: typing.Union[ - str, - schemas.Unset - ] = schemas.unset, - organizationalUnitName: typing.Union[ - str, - schemas.Unset - ] = schemas.unset, - emailAddress: typing.Union[ - str, - schemas.Unset - ] = schemas.unset, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - **kwargs: schemas.INPUT_TYPES_ALL, - ): - arg_: typing.Dict[str, typing.Any] = { - "commonName": commonName, - } - for key, val in ( - ("countryName", countryName), - ("stateOrProvinceName", stateOrProvinceName), - ("localityName", localityName), - ("organizationName", organizationName), - ("organizationalUnitName", organizationalUnitName), - ("emailAddress", emailAddress), - ): - if isinstance(val, schemas.Unset): - continue - arg_[key] = val - arg_.update(kwargs) - used_arg_ = typing.cast(DistinguishedNameDictInput, arg_) - return DistinguishedName.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - DistinguishedNameDictInput, - DistinguishedNameDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> DistinguishedNameDict: - return DistinguishedName.validate(arg, configuration=configuration) - - @property - def commonName(self) -> str: - return typing.cast( - str, - self.__getitem__("commonName") - ) - - @property - def countryName(self) -> typing.Union[str, schemas.Unset]: - val = self.get("countryName", schemas.unset) - if isinstance(val, schemas.Unset): - return val - return typing.cast( - str, - val - ) - - @property - def stateOrProvinceName(self) -> typing.Union[str, schemas.Unset]: - val = self.get("stateOrProvinceName", schemas.unset) - if isinstance(val, schemas.Unset): - return val - return typing.cast( - str, - val - ) - - @property - def localityName(self) -> typing.Union[str, schemas.Unset]: - val = self.get("localityName", schemas.unset) - if isinstance(val, schemas.Unset): - return val - return typing.cast( - str, - val - ) - - @property - def organizationName(self) -> typing.Union[str, schemas.Unset]: - val = self.get("organizationName", schemas.unset) - if isinstance(val, schemas.Unset): - return val - return typing.cast( - str, - val - ) - - @property - def organizationalUnitName(self) -> typing.Union[str, schemas.Unset]: - val = self.get("organizationalUnitName", schemas.unset) - if isinstance(val, schemas.Unset): - return val - return typing.cast( - str, - val - ) - - @property - def emailAddress(self) -> typing.Union[str, schemas.Unset]: - val = self.get("emailAddress", schemas.unset) - if isinstance(val, schemas.Unset): - return val - return typing.cast( - str, - val - ) - - def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]: - schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__) - return self.get(name, schemas.unset) -DistinguishedNameDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL] - - -@dataclasses.dataclass(frozen=True) -class DistinguishedName( - schemas.Schema[DistinguishedNameDict, tuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "commonName", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: DistinguishedNameDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - DistinguishedNameDictInput, - DistinguishedNameDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> DistinguishedNameDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/components/schema/encrypt_data.py b/pynitrokey/nethsm/client/components/schema/encrypt_data.py deleted file mode 100644 index 92bd65a1..00000000 --- a/pynitrokey/nethsm/client/components/schema/encrypt_data.py +++ /dev/null @@ -1,116 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -from pynitrokey.nethsm.client.components.schema import base64 -Properties = typing.TypedDict( - 'Properties', - { - "encrypted": typing.Type[base64.Base64], - "iv": typing.Type[base64.Base64], - } -) - - -class EncryptDataDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - - __required_keys__: typing.FrozenSet[str] = frozenset({ - "encrypted", - "iv", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - encrypted: str, - iv: str, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - **kwargs: schemas.INPUT_TYPES_ALL, - ): - arg_: typing.Dict[str, typing.Any] = { - "encrypted": encrypted, - "iv": iv, - } - arg_.update(kwargs) - used_arg_ = typing.cast(EncryptDataDictInput, arg_) - return EncryptData.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - EncryptDataDictInput, - EncryptDataDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> EncryptDataDict: - return EncryptData.validate(arg, configuration=configuration) - - @property - def encrypted(self) -> str: - return typing.cast( - str, - self.__getitem__("encrypted") - ) - - @property - def iv(self) -> str: - return typing.cast( - str, - self.__getitem__("iv") - ) - - def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]: - schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__) - return self.get(name, schemas.unset) -EncryptDataDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL] - - -@dataclasses.dataclass(frozen=True) -class EncryptData( - schemas.Schema[EncryptDataDict, tuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "encrypted", - "iv", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: EncryptDataDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - EncryptDataDictInput, - EncryptDataDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> EncryptDataDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/components/schema/encrypt_mode.py b/pynitrokey/nethsm/client/components/schema/encrypt_mode.py deleted file mode 100644 index af4a5a0c..00000000 --- a/pynitrokey/nethsm/client/components/schema/encrypt_mode.py +++ /dev/null @@ -1,71 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - - -class EncryptModeEnums: - - @schemas.classproperty - def AES_CBC(cls) -> typing.Literal["AES_CBC"]: - return EncryptMode.validate("AES_CBC") - - -@dataclasses.dataclass(frozen=True) -class EncryptMode( - schemas.Schema -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({ - str, - }) - enum_value_to_name: typing.Mapping[typing.Union[int, float, str, schemas.Bool, None], str] = dataclasses.field( - default_factory=lambda: { - "AES_CBC": "AES_CBC", - } - ) - enums = EncryptModeEnums - - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["AES_CBC"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["AES_CBC"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: str, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["AES_CBC",]: ... - @classmethod - def validate( - cls, - arg, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal[ - "AES_CBC", - ]: - validated_arg = super().validate_base( - arg, - configuration=configuration, - ) - return typing.cast(typing.Literal[ - "AES_CBC", - ], - validated_arg - ) diff --git a/pynitrokey/nethsm/client/components/schema/encrypt_request_data.py b/pynitrokey/nethsm/client/components/schema/encrypt_request_data.py deleted file mode 100644 index ba48176d..00000000 --- a/pynitrokey/nethsm/client/components/schema/encrypt_request_data.py +++ /dev/null @@ -1,140 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -from pynitrokey.nethsm.client.components.schema import base64 -from pynitrokey.nethsm.client.components.schema import encrypt_mode -Properties = typing.TypedDict( - 'Properties', - { - "mode": typing.Type[encrypt_mode.EncryptMode], - "message": typing.Type[base64.Base64], - "iv": typing.Type[base64.Base64], - } -) - - -class EncryptRequestDataDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - __required_keys__: typing.FrozenSet[str] = frozenset({ - "message", - "mode", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - "iv", - }) - - def __new__( - cls, - *, - message: str, - mode: typing.Literal[ - "AES_CBC" - ], - iv: typing.Union[ - str, - schemas.Unset - ] = schemas.unset, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - **kwargs: schemas.INPUT_TYPES_ALL, - ): - arg_: typing.Dict[str, typing.Any] = { - "message": message, - "mode": mode, - } - for key, val in ( - ("iv", iv), - ): - if isinstance(val, schemas.Unset): - continue - arg_[key] = val - arg_.update(kwargs) - used_arg_ = typing.cast(EncryptRequestDataDictInput, arg_) - return EncryptRequestData.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - EncryptRequestDataDictInput, - EncryptRequestDataDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> EncryptRequestDataDict: - return EncryptRequestData.validate(arg, configuration=configuration) - - @property - def message(self) -> str: - return typing.cast( - str, - self.__getitem__("message") - ) - - @property - def mode(self) -> typing.Literal["AES_CBC"]: - return typing.cast( - typing.Literal["AES_CBC"], - self.__getitem__("mode") - ) - - @property - def iv(self) -> typing.Union[str, schemas.Unset]: - val = self.get("iv", schemas.unset) - if isinstance(val, schemas.Unset): - return val - return typing.cast( - str, - val - ) - - def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]: - schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__) - return self.get(name, schemas.unset) -EncryptRequestDataDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL] - - -@dataclasses.dataclass(frozen=True) -class EncryptRequestData( - schemas.Schema[EncryptRequestDataDict, tuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "message", - "mode", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: EncryptRequestDataDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - EncryptRequestDataDictInput, - EncryptRequestDataDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> EncryptRequestDataDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/components/schema/health_state_data.py b/pynitrokey/nethsm/client/components/schema/health_state_data.py deleted file mode 100644 index fb1dec44..00000000 --- a/pynitrokey/nethsm/client/components/schema/health_state_data.py +++ /dev/null @@ -1,107 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -from pynitrokey.nethsm.client.components.schema import system_state -Properties = typing.TypedDict( - 'Properties', - { - "state": typing.Type[system_state.SystemState], - } -) - - -class HealthStateDataDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - __required_keys__: typing.FrozenSet[str] = frozenset({ - "state", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - state: typing.Literal[ - "Unprovisioned", - "Locked", - "Operational" - ], - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - **kwargs: schemas.INPUT_TYPES_ALL, - ): - arg_: typing.Dict[str, typing.Any] = { - "state": state, - } - arg_.update(kwargs) - used_arg_ = typing.cast(HealthStateDataDictInput, arg_) - return HealthStateData.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - HealthStateDataDictInput, - HealthStateDataDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> HealthStateDataDict: - return HealthStateData.validate(arg, configuration=configuration) - - @property - def state(self) -> typing.Literal["Unprovisioned", "Locked", "Operational"]: - return typing.cast( - typing.Literal["Unprovisioned", "Locked", "Operational"], - self.__getitem__("state") - ) - - def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]: - schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__) - return self.get(name, schemas.unset) -HealthStateDataDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL] - - -@dataclasses.dataclass(frozen=True) -class HealthStateData( - schemas.Schema[HealthStateDataDict, tuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "state", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: HealthStateDataDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - HealthStateDataDictInput, - HealthStateDataDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> HealthStateDataDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/components/schema/id.py b/pynitrokey/nethsm/client/components/schema/id.py deleted file mode 100644 index 34e982b3..00000000 --- a/pynitrokey/nethsm/client/components/schema/id.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - - -@dataclasses.dataclass(frozen=True) -class ID( - schemas.StrSchema -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({ - str, - }) - max_length: int = 128 - min_length: int = 1 - pattern: schemas.PatternInfo = schemas.PatternInfo( - pattern=r'^[a-zA-Z0-9]+$' # noqa: E501 - ) diff --git a/pynitrokey/nethsm/client/components/schema/info_data.py b/pynitrokey/nethsm/client/components/schema/info_data.py deleted file mode 100644 index a8f14419..00000000 --- a/pynitrokey/nethsm/client/components/schema/info_data.py +++ /dev/null @@ -1,116 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -Vendor: typing_extensions.TypeAlias = schemas.StrSchema -Product: typing_extensions.TypeAlias = schemas.StrSchema -Properties = typing.TypedDict( - 'Properties', - { - "vendor": typing.Type[Vendor], - "product": typing.Type[Product], - } -) - - -class InfoDataDict(schemas.immutabledict[str, str]): - - __required_keys__: typing.FrozenSet[str] = frozenset({ - "product", - "vendor", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - product: str, - vendor: str, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - **kwargs: schemas.INPUT_TYPES_ALL, - ): - arg_: typing.Dict[str, typing.Any] = { - "product": product, - "vendor": vendor, - } - arg_.update(kwargs) - used_arg_ = typing.cast(InfoDataDictInput, arg_) - return InfoData.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - InfoDataDictInput, - InfoDataDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> InfoDataDict: - return InfoData.validate(arg, configuration=configuration) - - @property - def product(self) -> str: - return typing.cast( - str, - self.__getitem__("product") - ) - - @property - def vendor(self) -> str: - return typing.cast( - str, - self.__getitem__("vendor") - ) - - def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]: - schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__) - return self.get(name, schemas.unset) -InfoDataDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL] - - -@dataclasses.dataclass(frozen=True) -class InfoData( - schemas.Schema[InfoDataDict, tuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "product", - "vendor", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: InfoDataDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - InfoDataDictInput, - InfoDataDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> InfoDataDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/components/schema/key_generate_request_data.py b/pynitrokey/nethsm/client/components/schema/key_generate_request_data.py deleted file mode 100644 index cf384ccc..00000000 --- a/pynitrokey/nethsm/client/components/schema/key_generate_request_data.py +++ /dev/null @@ -1,199 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - - -@dataclasses.dataclass(frozen=True) -class Length( - schemas.IntSchema -): - types: typing.FrozenSet[typing.Type] = frozenset({ - int, - }) - format: str = 'int' - inclusive_maximum: typing.Union[int, float] = 8192 - inclusive_minimum: typing.Union[int, float] = 128 - -from pynitrokey.nethsm.client.components.schema import id -from pynitrokey.nethsm.client.components.schema import key_mechanisms -from pynitrokey.nethsm.client.components.schema import key_restrictions -from pynitrokey.nethsm.client.components.schema import key_type -Properties = typing.TypedDict( - 'Properties', - { - "mechanisms": typing.Type[key_mechanisms.KeyMechanisms], - "type": typing.Type[key_type.KeyType], - "length": typing.Type[Length], - "id": typing.Type[id.ID], - "restrictions": typing.Type[key_restrictions.KeyRestrictions], - } -) - - -class KeyGenerateRequestDataDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - - __required_keys__: typing.FrozenSet[str] = frozenset({ - "mechanisms", - "type", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - "length", - "id", - "restrictions", - }) - - def __new__( - cls, - *, - mechanisms: typing.Union[ - key_mechanisms.KeyMechanismsTupleInput, - key_mechanisms.KeyMechanismsTuple - ], - type: typing.Literal[ - "RSA", - "Curve25519", - "EC_P224", - "EC_P256", - "EC_P384", - "EC_P521", - "Generic" - ], - length: typing.Union[ - int, - schemas.Unset - ] = schemas.unset, - id: typing.Union[ - str, - schemas.Unset - ] = schemas.unset, - restrictions: typing.Union[ - key_restrictions.KeyRestrictionsDictInput, - key_restrictions.KeyRestrictionsDict, - schemas.Unset - ] = schemas.unset, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - **kwargs: schemas.INPUT_TYPES_ALL, - ): - arg_: typing.Dict[str, typing.Any] = { - "mechanisms": mechanisms, - "type": type, - } - for key, val in ( - ("length", length), - ("id", id), - ("restrictions", restrictions), - ): - if isinstance(val, schemas.Unset): - continue - arg_[key] = val - arg_.update(kwargs) - used_arg_ = typing.cast(KeyGenerateRequestDataDictInput, arg_) - return KeyGenerateRequestData.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - KeyGenerateRequestDataDictInput, - KeyGenerateRequestDataDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> KeyGenerateRequestDataDict: - return KeyGenerateRequestData.validate(arg, configuration=configuration) - - @property - def mechanisms(self) -> key_mechanisms.KeyMechanismsTuple: - return typing.cast( - key_mechanisms.KeyMechanismsTuple, - self.__getitem__("mechanisms") - ) - - @property - def type(self) -> typing.Literal["RSA", "Curve25519", "EC_P224", "EC_P256", "EC_P384", "EC_P521", "Generic"]: - return typing.cast( - typing.Literal["RSA", "Curve25519", "EC_P224", "EC_P256", "EC_P384", "EC_P521", "Generic"], - self.__getitem__("type") - ) - - @property - def length(self) -> typing.Union[int, schemas.Unset]: - val = self.get("length", schemas.unset) - if isinstance(val, schemas.Unset): - return val - return typing.cast( - int, - val - ) - - @property - def id(self) -> typing.Union[str, schemas.Unset]: - val = self.get("id", schemas.unset) - if isinstance(val, schemas.Unset): - return val - return typing.cast( - str, - val - ) - - @property - def restrictions(self) -> typing.Union[key_restrictions.KeyRestrictionsDict, schemas.Unset]: - val = self.get("restrictions", schemas.unset) - if isinstance(val, schemas.Unset): - return val - return typing.cast( - key_restrictions.KeyRestrictionsDict, - val - ) - - def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]: - schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__) - return self.get(name, schemas.unset) -KeyGenerateRequestDataDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL] - - -@dataclasses.dataclass(frozen=True) -class KeyGenerateRequestData( - schemas.Schema[KeyGenerateRequestDataDict, tuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "mechanisms", - "type", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: KeyGenerateRequestDataDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - KeyGenerateRequestDataDictInput, - KeyGenerateRequestDataDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> KeyGenerateRequestDataDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/components/schema/key_item.py b/pynitrokey/nethsm/client/components/schema/key_item.py deleted file mode 100644 index 110bf3ed..00000000 --- a/pynitrokey/nethsm/client/components/schema/key_item.py +++ /dev/null @@ -1,103 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -from pynitrokey.nethsm.client.components.schema import id -Properties = typing.TypedDict( - 'Properties', - { - "key": typing.Type[id.ID], - } -) - - -class KeyItemDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - __required_keys__: typing.FrozenSet[str] = frozenset({ - "key", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - key: str, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - **kwargs: schemas.INPUT_TYPES_ALL, - ): - arg_: typing.Dict[str, typing.Any] = { - "key": key, - } - arg_.update(kwargs) - used_arg_ = typing.cast(KeyItemDictInput, arg_) - return KeyItem.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - KeyItemDictInput, - KeyItemDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> KeyItemDict: - return KeyItem.validate(arg, configuration=configuration) - - @property - def key(self) -> str: - return typing.cast( - str, - self.__getitem__("key") - ) - - def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]: - schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__) - return self.get(name, schemas.unset) -KeyItemDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL] - - -@dataclasses.dataclass(frozen=True) -class KeyItem( - schemas.Schema[KeyItemDict, tuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "key", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: KeyItemDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - KeyItemDictInput, - KeyItemDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> KeyItemDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/components/schema/key_list.py b/pynitrokey/nethsm/client/components/schema/key_list.py deleted file mode 100644 index af59d0d0..00000000 --- a/pynitrokey/nethsm/client/components/schema/key_list.py +++ /dev/null @@ -1,75 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -from pynitrokey.nethsm.client.components.schema import key_item - - -class KeyListTuple( - typing.Tuple[ - key_item.KeyItemDict, - ... - ] -): - - def __new__(cls, arg: typing.Union[KeyListTupleInput, KeyListTuple], configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None): - return KeyList.validate(arg, configuration=configuration) -KeyListTupleInput = typing.Union[ - typing.List[ - typing.Union[ - key_item.KeyItemDictInput, - key_item.KeyItemDict, - ], - ], - typing.Tuple[ - typing.Union[ - key_item.KeyItemDictInput, - key_item.KeyItemDict, - ], - ... - ] -] - - -@dataclasses.dataclass(frozen=True) -class KeyList( - schemas.Schema[schemas.immutabledict, KeyListTuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({tuple}) - items: typing.Type[key_item.KeyItem] = dataclasses.field(default_factory=lambda: key_item.KeyItem) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - tuple: KeyListTuple - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - KeyListTupleInput, - KeyListTuple, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> KeyListTuple: - return super().validate_base( - arg, - configuration=configuration, - ) diff --git a/pynitrokey/nethsm/client/components/schema/key_mechanism.py b/pynitrokey/nethsm/client/components/schema/key_mechanism.py deleted file mode 100644 index cdad023d..00000000 --- a/pynitrokey/nethsm/client/components/schema/key_mechanism.py +++ /dev/null @@ -1,323 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - - -class KeyMechanismEnums: - - @schemas.classproperty - def RSA_DECRYPTION_RAW(cls) -> typing.Literal["RSA_Decryption_RAW"]: - return KeyMechanism.validate("RSA_Decryption_RAW") - - @schemas.classproperty - def RSA_DECRYPTION_PKCS1(cls) -> typing.Literal["RSA_Decryption_PKCS1"]: - return KeyMechanism.validate("RSA_Decryption_PKCS1") - - @schemas.classproperty - def RSA_DECRYPTION_OAEP_MD5(cls) -> typing.Literal["RSA_Decryption_OAEP_MD5"]: - return KeyMechanism.validate("RSA_Decryption_OAEP_MD5") - - @schemas.classproperty - def RSA_DECRYPTION_OAEP_SHA1(cls) -> typing.Literal["RSA_Decryption_OAEP_SHA1"]: - return KeyMechanism.validate("RSA_Decryption_OAEP_SHA1") - - @schemas.classproperty - def RSA_DECRYPTION_OAEP_SHA224(cls) -> typing.Literal["RSA_Decryption_OAEP_SHA224"]: - return KeyMechanism.validate("RSA_Decryption_OAEP_SHA224") - - @schemas.classproperty - def RSA_DECRYPTION_OAEP_SHA256(cls) -> typing.Literal["RSA_Decryption_OAEP_SHA256"]: - return KeyMechanism.validate("RSA_Decryption_OAEP_SHA256") - - @schemas.classproperty - def RSA_DECRYPTION_OAEP_SHA384(cls) -> typing.Literal["RSA_Decryption_OAEP_SHA384"]: - return KeyMechanism.validate("RSA_Decryption_OAEP_SHA384") - - @schemas.classproperty - def RSA_DECRYPTION_OAEP_SHA512(cls) -> typing.Literal["RSA_Decryption_OAEP_SHA512"]: - return KeyMechanism.validate("RSA_Decryption_OAEP_SHA512") - - @schemas.classproperty - def RSA_SIGNATURE_PKCS1(cls) -> typing.Literal["RSA_Signature_PKCS1"]: - return KeyMechanism.validate("RSA_Signature_PKCS1") - - @schemas.classproperty - def RSA_SIGNATURE_PSS_MD5(cls) -> typing.Literal["RSA_Signature_PSS_MD5"]: - return KeyMechanism.validate("RSA_Signature_PSS_MD5") - - @schemas.classproperty - def RSA_SIGNATURE_PSS_SHA1(cls) -> typing.Literal["RSA_Signature_PSS_SHA1"]: - return KeyMechanism.validate("RSA_Signature_PSS_SHA1") - - @schemas.classproperty - def RSA_SIGNATURE_PSS_SHA224(cls) -> typing.Literal["RSA_Signature_PSS_SHA224"]: - return KeyMechanism.validate("RSA_Signature_PSS_SHA224") - - @schemas.classproperty - def RSA_SIGNATURE_PSS_SHA256(cls) -> typing.Literal["RSA_Signature_PSS_SHA256"]: - return KeyMechanism.validate("RSA_Signature_PSS_SHA256") - - @schemas.classproperty - def RSA_SIGNATURE_PSS_SHA384(cls) -> typing.Literal["RSA_Signature_PSS_SHA384"]: - return KeyMechanism.validate("RSA_Signature_PSS_SHA384") - - @schemas.classproperty - def RSA_SIGNATURE_PSS_SHA512(cls) -> typing.Literal["RSA_Signature_PSS_SHA512"]: - return KeyMechanism.validate("RSA_Signature_PSS_SHA512") - - @schemas.classproperty - def ED_DSA_SIGNATURE(cls) -> typing.Literal["EdDSA_Signature"]: - return KeyMechanism.validate("EdDSA_Signature") - - @schemas.classproperty - def ECDSA_SIGNATURE(cls) -> typing.Literal["ECDSA_Signature"]: - return KeyMechanism.validate("ECDSA_Signature") - - @schemas.classproperty - def AES_ENCRYPTION_CBC(cls) -> typing.Literal["AES_Encryption_CBC"]: - return KeyMechanism.validate("AES_Encryption_CBC") - - @schemas.classproperty - def AES_DECRYPTION_CBC(cls) -> typing.Literal["AES_Decryption_CBC"]: - return KeyMechanism.validate("AES_Decryption_CBC") - - -@dataclasses.dataclass(frozen=True) -class KeyMechanism( - schemas.Schema -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({ - str, - }) - enum_value_to_name: typing.Mapping[typing.Union[int, float, str, schemas.Bool, None], str] = dataclasses.field( - default_factory=lambda: { - "RSA_Decryption_RAW": "RSA_DECRYPTION_RAW", - "RSA_Decryption_PKCS1": "RSA_DECRYPTION_PKCS1", - "RSA_Decryption_OAEP_MD5": "RSA_DECRYPTION_OAEP_MD5", - "RSA_Decryption_OAEP_SHA1": "RSA_DECRYPTION_OAEP_SHA1", - "RSA_Decryption_OAEP_SHA224": "RSA_DECRYPTION_OAEP_SHA224", - "RSA_Decryption_OAEP_SHA256": "RSA_DECRYPTION_OAEP_SHA256", - "RSA_Decryption_OAEP_SHA384": "RSA_DECRYPTION_OAEP_SHA384", - "RSA_Decryption_OAEP_SHA512": "RSA_DECRYPTION_OAEP_SHA512", - "RSA_Signature_PKCS1": "RSA_SIGNATURE_PKCS1", - "RSA_Signature_PSS_MD5": "RSA_SIGNATURE_PSS_MD5", - "RSA_Signature_PSS_SHA1": "RSA_SIGNATURE_PSS_SHA1", - "RSA_Signature_PSS_SHA224": "RSA_SIGNATURE_PSS_SHA224", - "RSA_Signature_PSS_SHA256": "RSA_SIGNATURE_PSS_SHA256", - "RSA_Signature_PSS_SHA384": "RSA_SIGNATURE_PSS_SHA384", - "RSA_Signature_PSS_SHA512": "RSA_SIGNATURE_PSS_SHA512", - "EdDSA_Signature": "ED_DSA_SIGNATURE", - "ECDSA_Signature": "ECDSA_SIGNATURE", - "AES_Encryption_CBC": "AES_ENCRYPTION_CBC", - "AES_Decryption_CBC": "AES_DECRYPTION_CBC", - } - ) - enums = KeyMechanismEnums - - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["RSA_Decryption_RAW"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["RSA_Decryption_RAW"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["RSA_Decryption_PKCS1"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["RSA_Decryption_PKCS1"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["RSA_Decryption_OAEP_MD5"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["RSA_Decryption_OAEP_MD5"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["RSA_Decryption_OAEP_SHA1"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["RSA_Decryption_OAEP_SHA1"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["RSA_Decryption_OAEP_SHA224"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["RSA_Decryption_OAEP_SHA224"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["RSA_Decryption_OAEP_SHA256"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["RSA_Decryption_OAEP_SHA256"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["RSA_Decryption_OAEP_SHA384"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["RSA_Decryption_OAEP_SHA384"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["RSA_Decryption_OAEP_SHA512"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["RSA_Decryption_OAEP_SHA512"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["RSA_Signature_PKCS1"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["RSA_Signature_PKCS1"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["RSA_Signature_PSS_MD5"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["RSA_Signature_PSS_MD5"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["RSA_Signature_PSS_SHA1"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["RSA_Signature_PSS_SHA1"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["RSA_Signature_PSS_SHA224"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["RSA_Signature_PSS_SHA224"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["RSA_Signature_PSS_SHA256"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["RSA_Signature_PSS_SHA256"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["RSA_Signature_PSS_SHA384"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["RSA_Signature_PSS_SHA384"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["RSA_Signature_PSS_SHA512"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["RSA_Signature_PSS_SHA512"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["EdDSA_Signature"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["EdDSA_Signature"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["ECDSA_Signature"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["ECDSA_Signature"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["AES_Encryption_CBC"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["AES_Encryption_CBC"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["AES_Decryption_CBC"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["AES_Decryption_CBC"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: str, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["RSA_Decryption_RAW","RSA_Decryption_PKCS1","RSA_Decryption_OAEP_MD5","RSA_Decryption_OAEP_SHA1","RSA_Decryption_OAEP_SHA224","RSA_Decryption_OAEP_SHA256","RSA_Decryption_OAEP_SHA384","RSA_Decryption_OAEP_SHA512","RSA_Signature_PKCS1","RSA_Signature_PSS_MD5","RSA_Signature_PSS_SHA1","RSA_Signature_PSS_SHA224","RSA_Signature_PSS_SHA256","RSA_Signature_PSS_SHA384","RSA_Signature_PSS_SHA512","EdDSA_Signature","ECDSA_Signature","AES_Encryption_CBC","AES_Decryption_CBC",]: ... - @classmethod - def validate( - cls, - arg, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal[ - "RSA_Decryption_RAW", - "RSA_Decryption_PKCS1", - "RSA_Decryption_OAEP_MD5", - "RSA_Decryption_OAEP_SHA1", - "RSA_Decryption_OAEP_SHA224", - "RSA_Decryption_OAEP_SHA256", - "RSA_Decryption_OAEP_SHA384", - "RSA_Decryption_OAEP_SHA512", - "RSA_Signature_PKCS1", - "RSA_Signature_PSS_MD5", - "RSA_Signature_PSS_SHA1", - "RSA_Signature_PSS_SHA224", - "RSA_Signature_PSS_SHA256", - "RSA_Signature_PSS_SHA384", - "RSA_Signature_PSS_SHA512", - "EdDSA_Signature", - "ECDSA_Signature", - "AES_Encryption_CBC", - "AES_Decryption_CBC", - ]: - validated_arg = super().validate_base( - arg, - configuration=configuration, - ) - return typing.cast(typing.Literal[ - "RSA_Decryption_RAW", - "RSA_Decryption_PKCS1", - "RSA_Decryption_OAEP_MD5", - "RSA_Decryption_OAEP_SHA1", - "RSA_Decryption_OAEP_SHA224", - "RSA_Decryption_OAEP_SHA256", - "RSA_Decryption_OAEP_SHA384", - "RSA_Decryption_OAEP_SHA512", - "RSA_Signature_PKCS1", - "RSA_Signature_PSS_MD5", - "RSA_Signature_PSS_SHA1", - "RSA_Signature_PSS_SHA224", - "RSA_Signature_PSS_SHA256", - "RSA_Signature_PSS_SHA384", - "RSA_Signature_PSS_SHA512", - "EdDSA_Signature", - "ECDSA_Signature", - "AES_Encryption_CBC", - "AES_Decryption_CBC", - ], - validated_arg - ) diff --git a/pynitrokey/nethsm/client/components/schema/key_mechanisms.py b/pynitrokey/nethsm/client/components/schema/key_mechanisms.py deleted file mode 100644 index 6df03560..00000000 --- a/pynitrokey/nethsm/client/components/schema/key_mechanisms.py +++ /dev/null @@ -1,109 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -from pynitrokey.nethsm.client.components.schema import key_mechanism - - -class KeyMechanismsTuple( - typing.Tuple[ - typing.Literal["RSA_Decryption_RAW", "RSA_Decryption_PKCS1", "RSA_Decryption_OAEP_MD5", "RSA_Decryption_OAEP_SHA1", "RSA_Decryption_OAEP_SHA224", "RSA_Decryption_OAEP_SHA256", "RSA_Decryption_OAEP_SHA384", "RSA_Decryption_OAEP_SHA512", "RSA_Signature_PKCS1", "RSA_Signature_PSS_MD5", "RSA_Signature_PSS_SHA1", "RSA_Signature_PSS_SHA224", "RSA_Signature_PSS_SHA256", "RSA_Signature_PSS_SHA384", "RSA_Signature_PSS_SHA512", "EdDSA_Signature", "ECDSA_Signature", "AES_Encryption_CBC", "AES_Decryption_CBC"], - ... - ] -): - - def __new__(cls, arg: typing.Union[KeyMechanismsTupleInput, KeyMechanismsTuple], configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None): - return KeyMechanisms.validate(arg, configuration=configuration) -KeyMechanismsTupleInput = typing.Union[ - typing.List[ - typing.Literal[ - "RSA_Decryption_RAW", - "RSA_Decryption_PKCS1", - "RSA_Decryption_OAEP_MD5", - "RSA_Decryption_OAEP_SHA1", - "RSA_Decryption_OAEP_SHA224", - "RSA_Decryption_OAEP_SHA256", - "RSA_Decryption_OAEP_SHA384", - "RSA_Decryption_OAEP_SHA512", - "RSA_Signature_PKCS1", - "RSA_Signature_PSS_MD5", - "RSA_Signature_PSS_SHA1", - "RSA_Signature_PSS_SHA224", - "RSA_Signature_PSS_SHA256", - "RSA_Signature_PSS_SHA384", - "RSA_Signature_PSS_SHA512", - "EdDSA_Signature", - "ECDSA_Signature", - "AES_Encryption_CBC", - "AES_Decryption_CBC" - ], - ], - typing.Tuple[ - typing.Literal[ - "RSA_Decryption_RAW", - "RSA_Decryption_PKCS1", - "RSA_Decryption_OAEP_MD5", - "RSA_Decryption_OAEP_SHA1", - "RSA_Decryption_OAEP_SHA224", - "RSA_Decryption_OAEP_SHA256", - "RSA_Decryption_OAEP_SHA384", - "RSA_Decryption_OAEP_SHA512", - "RSA_Signature_PKCS1", - "RSA_Signature_PSS_MD5", - "RSA_Signature_PSS_SHA1", - "RSA_Signature_PSS_SHA224", - "RSA_Signature_PSS_SHA256", - "RSA_Signature_PSS_SHA384", - "RSA_Signature_PSS_SHA512", - "EdDSA_Signature", - "ECDSA_Signature", - "AES_Encryption_CBC", - "AES_Decryption_CBC" - ], - ... - ] -] - - -@dataclasses.dataclass(frozen=True) -class KeyMechanisms( - schemas.Schema[schemas.immutabledict, KeyMechanismsTuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({tuple}) - items: typing.Type[key_mechanism.KeyMechanism] = dataclasses.field(default_factory=lambda: key_mechanism.KeyMechanism) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - tuple: KeyMechanismsTuple - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - KeyMechanismsTupleInput, - KeyMechanismsTuple, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> KeyMechanismsTuple: - return super().validate_base( - arg, - configuration=configuration, - ) diff --git a/pynitrokey/nethsm/client/components/schema/key_private_data.py b/pynitrokey/nethsm/client/components/schema/key_private_data.py deleted file mode 100644 index d0dbf592..00000000 --- a/pynitrokey/nethsm/client/components/schema/key_private_data.py +++ /dev/null @@ -1,162 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -from pynitrokey.nethsm.client.components.schema import base64 -Properties = typing.TypedDict( - 'Properties', - { - "primeP": typing.Type[base64.Base64], - "primeQ": typing.Type[base64.Base64], - "publicExponent": typing.Type[base64.Base64], - "data": typing.Type[base64.Base64], - } -) - - -class KeyPrivateDataDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - - __required_keys__: typing.FrozenSet[str] = frozenset({ - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - "primeP", - "primeQ", - "publicExponent", - "data", - }) - - def __new__( - cls, - *, - primeP: typing.Union[ - str, - schemas.Unset - ] = schemas.unset, - primeQ: typing.Union[ - str, - schemas.Unset - ] = schemas.unset, - publicExponent: typing.Union[ - str, - schemas.Unset - ] = schemas.unset, - data: typing.Union[ - str, - schemas.Unset - ] = schemas.unset, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - **kwargs: schemas.INPUT_TYPES_ALL, - ): - arg_: typing.Dict[str, typing.Any] = {} - for key, val in ( - ("primeP", primeP), - ("primeQ", primeQ), - ("publicExponent", publicExponent), - ("data", data), - ): - if isinstance(val, schemas.Unset): - continue - arg_[key] = val - arg_.update(kwargs) - used_arg_ = typing.cast(KeyPrivateDataDictInput, arg_) - return KeyPrivateData.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - KeyPrivateDataDictInput, - KeyPrivateDataDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> KeyPrivateDataDict: - return KeyPrivateData.validate(arg, configuration=configuration) - - @property - def primeP(self) -> typing.Union[str, schemas.Unset]: - val = self.get("primeP", schemas.unset) - if isinstance(val, schemas.Unset): - return val - return typing.cast( - str, - val - ) - - @property - def primeQ(self) -> typing.Union[str, schemas.Unset]: - val = self.get("primeQ", schemas.unset) - if isinstance(val, schemas.Unset): - return val - return typing.cast( - str, - val - ) - - @property - def publicExponent(self) -> typing.Union[str, schemas.Unset]: - val = self.get("publicExponent", schemas.unset) - if isinstance(val, schemas.Unset): - return val - return typing.cast( - str, - val - ) - - @property - def data(self) -> typing.Union[str, schemas.Unset]: - val = self.get("data", schemas.unset) - if isinstance(val, schemas.Unset): - return val - return typing.cast( - str, - val - ) - - def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]: - schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__) - return self.get(name, schemas.unset) -KeyPrivateDataDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL] - - -@dataclasses.dataclass(frozen=True) -class KeyPrivateData( - schemas.Schema[KeyPrivateDataDict, tuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: KeyPrivateDataDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - KeyPrivateDataDictInput, - KeyPrivateDataDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> KeyPrivateDataDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/components/schema/key_public_data.py b/pynitrokey/nethsm/client/components/schema/key_public_data.py deleted file mode 100644 index 384e815e..00000000 --- a/pynitrokey/nethsm/client/components/schema/key_public_data.py +++ /dev/null @@ -1,149 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -from pynitrokey.nethsm.client.components.schema import base64 -Properties = typing.TypedDict( - 'Properties', - { - "modulus": typing.Type[base64.Base64], - "publicExponent": typing.Type[base64.Base64], - "data": typing.Type[base64.Base64], - } -) - - -class KeyPublicDataDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - __required_keys__: typing.FrozenSet[str] = frozenset({ - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - "modulus", - "publicExponent", - "data", - }) - - def __new__( - cls, - *, - modulus: typing.Union[ - str, - schemas.Unset - ] = schemas.unset, - publicExponent: typing.Union[ - str, - schemas.Unset - ] = schemas.unset, - data: typing.Union[ - str, - schemas.Unset - ] = schemas.unset, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - **kwargs: schemas.INPUT_TYPES_ALL, - ): - arg_: typing.Dict[str, typing.Any] = {} - for key, val in ( - ("modulus", modulus), - ("publicExponent", publicExponent), - ("data", data), - ): - if isinstance(val, schemas.Unset): - continue - arg_[key] = val - arg_.update(kwargs) - used_arg_ = typing.cast(KeyPublicDataDictInput, arg_) - return KeyPublicData.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - KeyPublicDataDictInput, - KeyPublicDataDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> KeyPublicDataDict: - return KeyPublicData.validate(arg, configuration=configuration) - - @property - def modulus(self) -> typing.Union[str, schemas.Unset]: - val = self.get("modulus", schemas.unset) - if isinstance(val, schemas.Unset): - return val - return typing.cast( - str, - val - ) - - @property - def publicExponent(self) -> typing.Union[str, schemas.Unset]: - val = self.get("publicExponent", schemas.unset) - if isinstance(val, schemas.Unset): - return val - return typing.cast( - str, - val - ) - - @property - def data(self) -> typing.Union[str, schemas.Unset]: - val = self.get("data", schemas.unset) - if isinstance(val, schemas.Unset): - return val - return typing.cast( - str, - val - ) - - def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]: - schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__) - return self.get(name, schemas.unset) -KeyPublicDataDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL] - - -@dataclasses.dataclass(frozen=True) -class KeyPublicData( - schemas.Schema[KeyPublicDataDict, tuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - - The public key data is either a *modulus* and a *publicExponent* or -a *data* field. The *data* field is used for EC keys. -This field is null for Generic keys. - - """ - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: KeyPublicDataDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - KeyPublicDataDictInput, - KeyPublicDataDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> KeyPublicDataDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/components/schema/key_restrictions.py b/pynitrokey/nethsm/client/components/schema/key_restrictions.py deleted file mode 100644 index e94f3e6b..00000000 --- a/pynitrokey/nethsm/client/components/schema/key_restrictions.py +++ /dev/null @@ -1,111 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -from pynitrokey.nethsm.client.components.schema import tag_list -Properties = typing.TypedDict( - 'Properties', - { - "tags": typing.Type[tag_list.TagList], - } -) - - -class KeyRestrictionsDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - __required_keys__: typing.FrozenSet[str] = frozenset({ - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - "tags", - }) - - def __new__( - cls, - *, - tags: typing.Union[ - tag_list.TagListTupleInput, - tag_list.TagListTuple, - schemas.Unset - ] = schemas.unset, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - **kwargs: schemas.INPUT_TYPES_ALL, - ): - arg_: typing.Dict[str, typing.Any] = {} - for key, val in ( - ("tags", tags), - ): - if isinstance(val, schemas.Unset): - continue - arg_[key] = val - arg_.update(kwargs) - used_arg_ = typing.cast(KeyRestrictionsDictInput, arg_) - return KeyRestrictions.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - KeyRestrictionsDictInput, - KeyRestrictionsDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> KeyRestrictionsDict: - return KeyRestrictions.validate(arg, configuration=configuration) - - @property - def tags(self) -> typing.Union[tag_list.TagListTuple, schemas.Unset]: - val = self.get("tags", schemas.unset) - if isinstance(val, schemas.Unset): - return val - return typing.cast( - tag_list.TagListTuple, - val - ) - - def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]: - schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__) - return self.get(name, schemas.unset) -KeyRestrictionsDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL] - - -@dataclasses.dataclass(frozen=True) -class KeyRestrictions( - schemas.Schema[KeyRestrictionsDict, tuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: KeyRestrictionsDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - KeyRestrictionsDictInput, - KeyRestrictionsDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> KeyRestrictionsDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/components/schema/key_type.py b/pynitrokey/nethsm/client/components/schema/key_type.py deleted file mode 100644 index 071e5c3a..00000000 --- a/pynitrokey/nethsm/client/components/schema/key_type.py +++ /dev/null @@ -1,155 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - - -class KeyTypeEnums: - - @schemas.classproperty - def RSA(cls) -> typing.Literal["RSA"]: - return KeyType.validate("RSA") - - @schemas.classproperty - def CURVE25519(cls) -> typing.Literal["Curve25519"]: - return KeyType.validate("Curve25519") - - @schemas.classproperty - def EC_P224(cls) -> typing.Literal["EC_P224"]: - return KeyType.validate("EC_P224") - - @schemas.classproperty - def EC_P256(cls) -> typing.Literal["EC_P256"]: - return KeyType.validate("EC_P256") - - @schemas.classproperty - def EC_P384(cls) -> typing.Literal["EC_P384"]: - return KeyType.validate("EC_P384") - - @schemas.classproperty - def EC_P521(cls) -> typing.Literal["EC_P521"]: - return KeyType.validate("EC_P521") - - @schemas.classproperty - def GENERIC(cls) -> typing.Literal["Generic"]: - return KeyType.validate("Generic") - - -@dataclasses.dataclass(frozen=True) -class KeyType( - schemas.Schema -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({ - str, - }) - enum_value_to_name: typing.Mapping[typing.Union[int, float, str, schemas.Bool, None], str] = dataclasses.field( - default_factory=lambda: { - "RSA": "RSA", - "Curve25519": "CURVE25519", - "EC_P224": "EC_P224", - "EC_P256": "EC_P256", - "EC_P384": "EC_P384", - "EC_P521": "EC_P521", - "Generic": "GENERIC", - } - ) - enums = KeyTypeEnums - - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["RSA"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["RSA"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["Curve25519"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["Curve25519"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["EC_P224"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["EC_P224"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["EC_P256"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["EC_P256"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["EC_P384"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["EC_P384"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["EC_P521"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["EC_P521"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["Generic"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["Generic"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: str, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["RSA","Curve25519","EC_P224","EC_P256","EC_P384","EC_P521","Generic",]: ... - @classmethod - def validate( - cls, - arg, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal[ - "RSA", - "Curve25519", - "EC_P224", - "EC_P256", - "EC_P384", - "EC_P521", - "Generic", - ]: - validated_arg = super().validate_base( - arg, - configuration=configuration, - ) - return typing.cast(typing.Literal[ - "RSA", - "Curve25519", - "EC_P224", - "EC_P256", - "EC_P384", - "EC_P521", - "Generic", - ], - validated_arg - ) diff --git a/pynitrokey/nethsm/client/components/schema/log_level.py b/pynitrokey/nethsm/client/components/schema/log_level.py deleted file mode 100644 index 13fb4018..00000000 --- a/pynitrokey/nethsm/client/components/schema/log_level.py +++ /dev/null @@ -1,113 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - - -class LogLevelEnums: - - @schemas.classproperty - def DEBUG(cls) -> typing.Literal["debug"]: - return LogLevel.validate("debug") - - @schemas.classproperty - def INFO(cls) -> typing.Literal["info"]: - return LogLevel.validate("info") - - @schemas.classproperty - def WARNING(cls) -> typing.Literal["warning"]: - return LogLevel.validate("warning") - - @schemas.classproperty - def ERROR(cls) -> typing.Literal["error"]: - return LogLevel.validate("error") - - -@dataclasses.dataclass(frozen=True) -class LogLevel( - schemas.Schema -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({ - str, - }) - enum_value_to_name: typing.Mapping[typing.Union[int, float, str, schemas.Bool, None], str] = dataclasses.field( - default_factory=lambda: { - "debug": "DEBUG", - "info": "INFO", - "warning": "WARNING", - "error": "ERROR", - } - ) - enums = LogLevelEnums - - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["debug"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["debug"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["info"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["info"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["warning"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["warning"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["error"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["error"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: str, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["debug","info","warning","error",]: ... - @classmethod - def validate( - cls, - arg, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal[ - "debug", - "info", - "warning", - "error", - ]: - validated_arg = super().validate_base( - arg, - configuration=configuration, - ) - return typing.cast(typing.Literal[ - "debug", - "info", - "warning", - "error", - ], - validated_arg - ) diff --git a/pynitrokey/nethsm/client/components/schema/logging_config.py b/pynitrokey/nethsm/client/components/schema/logging_config.py deleted file mode 100644 index a289b133..00000000 --- a/pynitrokey/nethsm/client/components/schema/logging_config.py +++ /dev/null @@ -1,134 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -IpAddress: typing_extensions.TypeAlias = schemas.StrSchema -Port: typing_extensions.TypeAlias = schemas.IntSchema - -from pynitrokey.nethsm.client.components.schema import log_level -Properties = typing.TypedDict( - 'Properties', - { - "ipAddress": typing.Type[IpAddress], - "port": typing.Type[Port], - "logLevel": typing.Type[log_level.LogLevel], - } -) - - -class LoggingConfigDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - __required_keys__: typing.FrozenSet[str] = frozenset({ - "ipAddress", - "logLevel", - "port", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - ipAddress: str, - logLevel: typing.Literal[ - "debug", - "info", - "warning", - "error" - ], - port: int, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - **kwargs: schemas.INPUT_TYPES_ALL, - ): - arg_: typing.Dict[str, typing.Any] = { - "ipAddress": ipAddress, - "logLevel": logLevel, - "port": port, - } - arg_.update(kwargs) - used_arg_ = typing.cast(LoggingConfigDictInput, arg_) - return LoggingConfig.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - LoggingConfigDictInput, - LoggingConfigDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> LoggingConfigDict: - return LoggingConfig.validate(arg, configuration=configuration) - - @property - def ipAddress(self) -> str: - return typing.cast( - str, - self.__getitem__("ipAddress") - ) - - @property - def logLevel(self) -> typing.Literal["debug", "info", "warning", "error"]: - return typing.cast( - typing.Literal["debug", "info", "warning", "error"], - self.__getitem__("logLevel") - ) - - @property - def port(self) -> int: - return typing.cast( - int, - self.__getitem__("port") - ) - - def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]: - schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__) - return self.get(name, schemas.unset) -LoggingConfigDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL] - - -@dataclasses.dataclass(frozen=True) -class LoggingConfig( - schemas.Schema[LoggingConfigDict, tuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "ipAddress", - "logLevel", - "port", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: LoggingConfigDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - LoggingConfigDictInput, - LoggingConfigDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> LoggingConfigDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/components/schema/metrics_data.py b/pynitrokey/nethsm/client/components/schema/metrics_data.py deleted file mode 100644 index 9f7081ce..00000000 --- a/pynitrokey/nethsm/client/components/schema/metrics_data.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -MetricsData: typing_extensions.TypeAlias = schemas.DictSchema diff --git a/pynitrokey/nethsm/client/components/schema/network_config.py b/pynitrokey/nethsm/client/components/schema/network_config.py deleted file mode 100644 index a1bf4c2a..00000000 --- a/pynitrokey/nethsm/client/components/schema/network_config.py +++ /dev/null @@ -1,129 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -IpAddress: typing_extensions.TypeAlias = schemas.StrSchema -Netmask: typing_extensions.TypeAlias = schemas.StrSchema -Gateway: typing_extensions.TypeAlias = schemas.StrSchema -Properties = typing.TypedDict( - 'Properties', - { - "ipAddress": typing.Type[IpAddress], - "netmask": typing.Type[Netmask], - "gateway": typing.Type[Gateway], - } -) - - -class NetworkConfigDict(schemas.immutabledict[str, str]): - - __required_keys__: typing.FrozenSet[str] = frozenset({ - "gateway", - "ipAddress", - "netmask", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - gateway: str, - ipAddress: str, - netmask: str, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - **kwargs: schemas.INPUT_TYPES_ALL, - ): - arg_: typing.Dict[str, typing.Any] = { - "gateway": gateway, - "ipAddress": ipAddress, - "netmask": netmask, - } - arg_.update(kwargs) - used_arg_ = typing.cast(NetworkConfigDictInput, arg_) - return NetworkConfig.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - NetworkConfigDictInput, - NetworkConfigDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> NetworkConfigDict: - return NetworkConfig.validate(arg, configuration=configuration) - - @property - def gateway(self) -> str: - return typing.cast( - str, - self.__getitem__("gateway") - ) - - @property - def ipAddress(self) -> str: - return typing.cast( - str, - self.__getitem__("ipAddress") - ) - - @property - def netmask(self) -> str: - return typing.cast( - str, - self.__getitem__("netmask") - ) - - def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]: - schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__) - return self.get(name, schemas.unset) -NetworkConfigDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL] - - -@dataclasses.dataclass(frozen=True) -class NetworkConfig( - schemas.Schema[NetworkConfigDict, tuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "gateway", - "ipAddress", - "netmask", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: NetworkConfigDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - NetworkConfigDictInput, - NetworkConfigDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> NetworkConfigDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/components/schema/passphrase.py b/pynitrokey/nethsm/client/components/schema/passphrase.py deleted file mode 100644 index 8964a06b..00000000 --- a/pynitrokey/nethsm/client/components/schema/passphrase.py +++ /dev/null @@ -1,27 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - - -@dataclasses.dataclass(frozen=True) -class Passphrase( - schemas.StrSchema -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({ - str, - }) - min_length: int = 1 diff --git a/pynitrokey/nethsm/client/components/schema/pem_cert.py b/pynitrokey/nethsm/client/components/schema/pem_cert.py deleted file mode 100644 index 6c8bd22e..00000000 --- a/pynitrokey/nethsm/client/components/schema/pem_cert.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -PemCert: typing_extensions.TypeAlias = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/components/schema/pem_csr.py b/pynitrokey/nethsm/client/components/schema/pem_csr.py deleted file mode 100644 index 4f5f3f5a..00000000 --- a/pynitrokey/nethsm/client/components/schema/pem_csr.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -PemCSR: typing_extensions.TypeAlias = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/components/schema/pem_private_key.py b/pynitrokey/nethsm/client/components/schema/pem_private_key.py deleted file mode 100644 index 84ac2613..00000000 --- a/pynitrokey/nethsm/client/components/schema/pem_private_key.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -PemPrivateKey: typing_extensions.TypeAlias = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/components/schema/pem_public_key.py b/pynitrokey/nethsm/client/components/schema/pem_public_key.py deleted file mode 100644 index a64343bc..00000000 --- a/pynitrokey/nethsm/client/components/schema/pem_public_key.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -PemPublicKey: typing_extensions.TypeAlias = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/components/schema/pgp_private_key.py b/pynitrokey/nethsm/client/components/schema/pgp_private_key.py deleted file mode 100644 index 93bf5826..00000000 --- a/pynitrokey/nethsm/client/components/schema/pgp_private_key.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -PGPPrivateKey: typing_extensions.TypeAlias = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/components/schema/private_key.py b/pynitrokey/nethsm/client/components/schema/private_key.py deleted file mode 100644 index 0ec3601d..00000000 --- a/pynitrokey/nethsm/client/components/schema/private_key.py +++ /dev/null @@ -1,168 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -from pynitrokey.nethsm.client.components.schema import key_mechanisms -from pynitrokey.nethsm.client.components.schema import key_private_data -from pynitrokey.nethsm.client.components.schema import key_restrictions -from pynitrokey.nethsm.client.components.schema import key_type -Properties = typing.TypedDict( - 'Properties', - { - "mechanisms": typing.Type[key_mechanisms.KeyMechanisms], - "type": typing.Type[key_type.KeyType], - "key": typing.Type[key_private_data.KeyPrivateData], - "restrictions": typing.Type[key_restrictions.KeyRestrictions], - } -) - - -class PrivateKeyDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - - __required_keys__: typing.FrozenSet[str] = frozenset({ - "key", - "mechanisms", - "type", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - "restrictions", - }) - - def __new__( - cls, - *, - key: typing.Union[ - key_private_data.KeyPrivateDataDictInput, - key_private_data.KeyPrivateDataDict, - ], - mechanisms: typing.Union[ - key_mechanisms.KeyMechanismsTupleInput, - key_mechanisms.KeyMechanismsTuple - ], - type: typing.Literal[ - "RSA", - "Curve25519", - "EC_P224", - "EC_P256", - "EC_P384", - "EC_P521", - "Generic" - ], - restrictions: typing.Union[ - key_restrictions.KeyRestrictionsDictInput, - key_restrictions.KeyRestrictionsDict, - schemas.Unset - ] = schemas.unset, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - **kwargs: schemas.INPUT_TYPES_ALL, - ): - arg_: typing.Dict[str, typing.Any] = { - "key": key, - "mechanisms": mechanisms, - "type": type, - } - for key, val in ( - ("restrictions", restrictions), - ): - if isinstance(val, schemas.Unset): - continue - arg_[key] = val - arg_.update(kwargs) - used_arg_ = typing.cast(PrivateKeyDictInput, arg_) - return PrivateKey.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - PrivateKeyDictInput, - PrivateKeyDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PrivateKeyDict: - return PrivateKey.validate(arg, configuration=configuration) - - @property - def key(self) -> key_private_data.KeyPrivateDataDict: - return typing.cast( - key_private_data.KeyPrivateDataDict, - self.__getitem__("key") - ) - - @property - def mechanisms(self) -> key_mechanisms.KeyMechanismsTuple: - return typing.cast( - key_mechanisms.KeyMechanismsTuple, - self.__getitem__("mechanisms") - ) - - @property - def type(self) -> typing.Literal["RSA", "Curve25519", "EC_P224", "EC_P256", "EC_P384", "EC_P521", "Generic"]: - return typing.cast( - typing.Literal["RSA", "Curve25519", "EC_P224", "EC_P256", "EC_P384", "EC_P521", "Generic"], - self.__getitem__("type") - ) - - @property - def restrictions(self) -> typing.Union[key_restrictions.KeyRestrictionsDict, schemas.Unset]: - val = self.get("restrictions", schemas.unset) - if isinstance(val, schemas.Unset): - return val - return typing.cast( - key_restrictions.KeyRestrictionsDict, - val - ) - - def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]: - schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__) - return self.get(name, schemas.unset) -PrivateKeyDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL] - - -@dataclasses.dataclass(frozen=True) -class PrivateKey( - schemas.Schema[PrivateKeyDict, tuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "key", - "mechanisms", - "type", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: PrivateKeyDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - PrivateKeyDictInput, - PrivateKeyDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PrivateKeyDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/components/schema/provision_request_data.py b/pynitrokey/nethsm/client/components/schema/provision_request_data.py deleted file mode 100644 index b23f8ee9..00000000 --- a/pynitrokey/nethsm/client/components/schema/provision_request_data.py +++ /dev/null @@ -1,132 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -SystemTime: typing_extensions.TypeAlias = schemas.DateTimeSchema - -from pynitrokey.nethsm.client.components.schema import passphrase -Properties = typing.TypedDict( - 'Properties', - { - "unlockPassphrase": typing.Type[passphrase.Passphrase], - "adminPassphrase": typing.Type[passphrase.Passphrase], - "systemTime": typing.Type[SystemTime], - } -) - - -class ProvisionRequestDataDict(schemas.immutabledict[str, str]): - - __required_keys__: typing.FrozenSet[str] = frozenset({ - "adminPassphrase", - "systemTime", - "unlockPassphrase", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - adminPassphrase: str, - systemTime: typing.Union[ - str, - datetime.datetime - ], - unlockPassphrase: str, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - **kwargs: schemas.INPUT_TYPES_ALL, - ): - arg_: typing.Dict[str, typing.Any] = { - "adminPassphrase": adminPassphrase, - "systemTime": systemTime, - "unlockPassphrase": unlockPassphrase, - } - arg_.update(kwargs) - used_arg_ = typing.cast(ProvisionRequestDataDictInput, arg_) - return ProvisionRequestData.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - ProvisionRequestDataDictInput, - ProvisionRequestDataDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> ProvisionRequestDataDict: - return ProvisionRequestData.validate(arg, configuration=configuration) - - @property - def adminPassphrase(self) -> str: - return typing.cast( - str, - self.__getitem__("adminPassphrase") - ) - - @property - def systemTime(self) -> str: - return typing.cast( - str, - self.__getitem__("systemTime") - ) - - @property - def unlockPassphrase(self) -> str: - return typing.cast( - str, - self.__getitem__("unlockPassphrase") - ) - - def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]: - schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__) - return self.get(name, schemas.unset) -ProvisionRequestDataDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL] - - -@dataclasses.dataclass(frozen=True) -class ProvisionRequestData( - schemas.Schema[ProvisionRequestDataDict, tuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "adminPassphrase", - "systemTime", - "unlockPassphrase", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: ProvisionRequestDataDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - ProvisionRequestDataDictInput, - ProvisionRequestDataDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> ProvisionRequestDataDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/components/schema/public_key.py b/pynitrokey/nethsm/client/components/schema/public_key.py deleted file mode 100644 index d108cbec..00000000 --- a/pynitrokey/nethsm/client/components/schema/public_key.py +++ /dev/null @@ -1,181 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -Operations: typing_extensions.TypeAlias = schemas.IntSchema - -from pynitrokey.nethsm.client.components.schema import key_mechanisms -from pynitrokey.nethsm.client.components.schema import key_public_data -from pynitrokey.nethsm.client.components.schema import key_restrictions -from pynitrokey.nethsm.client.components.schema import key_type -Properties = typing.TypedDict( - 'Properties', - { - "mechanisms": typing.Type[key_mechanisms.KeyMechanisms], - "type": typing.Type[key_type.KeyType], - "restrictions": typing.Type[key_restrictions.KeyRestrictions], - "key": typing.Type[key_public_data.KeyPublicData], - "operations": typing.Type[Operations], - } -) - - -class PublicKeyDict(schemas.immutabledict[str, int]): - - __required_keys__: typing.FrozenSet[str] = frozenset({ - "mechanisms", - "operations", - "restrictions", - "type", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - "key", - }) - - def __new__( - cls, - *, - mechanisms: typing.Union[ - key_mechanisms.KeyMechanismsTupleInput, - key_mechanisms.KeyMechanismsTuple - ], - operations: int, - restrictions: typing.Union[ - key_restrictions.KeyRestrictionsDictInput, - key_restrictions.KeyRestrictionsDict, - ], - type: typing.Literal[ - "RSA", - "Curve25519", - "EC_P224", - "EC_P256", - "EC_P384", - "EC_P521", - "Generic" - ], - key: typing.Union[ - key_public_data.KeyPublicDataDictInput, - key_public_data.KeyPublicDataDict, - schemas.Unset - ] = schemas.unset, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - **kwargs: schemas.INPUT_TYPES_ALL, - ): - arg_: typing.Dict[str, typing.Any] = { - "mechanisms": mechanisms, - "operations": operations, - "restrictions": restrictions, - "type": type, - } - for key, val in ( - ("key", key), - ): - if isinstance(val, schemas.Unset): - continue - arg_[key] = val - arg_.update(kwargs) - used_arg_ = typing.cast(PublicKeyDictInput, arg_) - return PublicKey.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - PublicKeyDictInput, - PublicKeyDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PublicKeyDict: - return PublicKey.validate(arg, configuration=configuration) - - @property - def mechanisms(self) -> key_mechanisms.KeyMechanismsTuple: - return typing.cast( - key_mechanisms.KeyMechanismsTuple, - self.__getitem__("mechanisms") - ) - - @property - def operations(self) -> int: - return typing.cast( - int, - self.__getitem__("operations") - ) - - @property - def restrictions(self) -> key_restrictions.KeyRestrictionsDict: - return typing.cast( - key_restrictions.KeyRestrictionsDict, - self.__getitem__("restrictions") - ) - - @property - def type(self) -> typing.Literal["RSA", "Curve25519", "EC_P224", "EC_P256", "EC_P384", "EC_P521", "Generic"]: - return typing.cast( - typing.Literal["RSA", "Curve25519", "EC_P224", "EC_P256", "EC_P384", "EC_P521", "Generic"], - self.__getitem__("type") - ) - - @property - def key(self) -> typing.Union[key_public_data.KeyPublicDataDict, schemas.Unset]: - val = self.get("key", schemas.unset) - if isinstance(val, schemas.Unset): - return val - return typing.cast( - key_public_data.KeyPublicDataDict, - val - ) - - def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]: - schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__) - return self.get(name, schemas.unset) -PublicKeyDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL] - - -@dataclasses.dataclass(frozen=True) -class PublicKey( - schemas.Schema[PublicKeyDict, tuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "mechanisms", - "operations", - "restrictions", - "type", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: PublicKeyDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - PublicKeyDictInput, - PublicKeyDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PublicKeyDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/components/schema/random_data.py b/pynitrokey/nethsm/client/components/schema/random_data.py deleted file mode 100644 index 0d292c06..00000000 --- a/pynitrokey/nethsm/client/components/schema/random_data.py +++ /dev/null @@ -1,103 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -from pynitrokey.nethsm.client.components.schema import base64 -Properties = typing.TypedDict( - 'Properties', - { - "random": typing.Type[base64.Base64], - } -) - - -class RandomDataDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - __required_keys__: typing.FrozenSet[str] = frozenset({ - "random", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - random: str, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - **kwargs: schemas.INPUT_TYPES_ALL, - ): - arg_: typing.Dict[str, typing.Any] = { - "random": random, - } - arg_.update(kwargs) - used_arg_ = typing.cast(RandomDataDictInput, arg_) - return RandomData.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - RandomDataDictInput, - RandomDataDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> RandomDataDict: - return RandomData.validate(arg, configuration=configuration) - - @property - def random(self) -> str: - return typing.cast( - str, - self.__getitem__("random") - ) - - def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]: - schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__) - return self.get(name, schemas.unset) -RandomDataDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL] - - -@dataclasses.dataclass(frozen=True) -class RandomData( - schemas.Schema[RandomDataDict, tuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "random", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: RandomDataDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - RandomDataDictInput, - RandomDataDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> RandomDataDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/components/schema/random_request_data.py b/pynitrokey/nethsm/client/components/schema/random_request_data.py deleted file mode 100644 index 4a629295..00000000 --- a/pynitrokey/nethsm/client/components/schema/random_request_data.py +++ /dev/null @@ -1,114 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - - -@dataclasses.dataclass(frozen=True) -class Length( - schemas.IntSchema -): - types: typing.FrozenSet[typing.Type] = frozenset({ - int, - }) - format: str = 'int' - inclusive_maximum: typing.Union[int, float] = 1024 - inclusive_minimum: typing.Union[int, float] = 1 -Properties = typing.TypedDict( - 'Properties', - { - "length": typing.Type[Length], - } -) - - -class RandomRequestDataDict(schemas.immutabledict[str, int]): - - __required_keys__: typing.FrozenSet[str] = frozenset({ - "length", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - length: int, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - **kwargs: schemas.INPUT_TYPES_ALL, - ): - arg_: typing.Dict[str, typing.Any] = { - "length": length, - } - arg_.update(kwargs) - used_arg_ = typing.cast(RandomRequestDataDictInput, arg_) - return RandomRequestData.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - RandomRequestDataDictInput, - RandomRequestDataDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> RandomRequestDataDict: - return RandomRequestData.validate(arg, configuration=configuration) - - @property - def length(self) -> int: - return typing.cast( - int, - self.__getitem__("length") - ) - - def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]: - schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__) - return self.get(name, schemas.unset) -RandomRequestDataDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL] - - -@dataclasses.dataclass(frozen=True) -class RandomRequestData( - schemas.Schema[RandomRequestDataDict, tuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "length", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: RandomRequestDataDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - RandomRequestDataDictInput, - RandomRequestDataDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> RandomRequestDataDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/components/schema/sign_data.py b/pynitrokey/nethsm/client/components/schema/sign_data.py deleted file mode 100644 index cad7ac68..00000000 --- a/pynitrokey/nethsm/client/components/schema/sign_data.py +++ /dev/null @@ -1,103 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -from pynitrokey.nethsm.client.components.schema import base64 -Properties = typing.TypedDict( - 'Properties', - { - "signature": typing.Type[base64.Base64], - } -) - - -class SignDataDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - __required_keys__: typing.FrozenSet[str] = frozenset({ - "signature", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - signature: str, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - **kwargs: schemas.INPUT_TYPES_ALL, - ): - arg_: typing.Dict[str, typing.Any] = { - "signature": signature, - } - arg_.update(kwargs) - used_arg_ = typing.cast(SignDataDictInput, arg_) - return SignData.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - SignDataDictInput, - SignDataDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> SignDataDict: - return SignData.validate(arg, configuration=configuration) - - @property - def signature(self) -> str: - return typing.cast( - str, - self.__getitem__("signature") - ) - - def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]: - schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__) - return self.get(name, schemas.unset) -SignDataDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL] - - -@dataclasses.dataclass(frozen=True) -class SignData( - schemas.Schema[SignDataDict, tuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "signature", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: SignDataDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - SignDataDictInput, - SignDataDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> SignDataDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/components/schema/sign_mode.py b/pynitrokey/nethsm/client/components/schema/sign_mode.py deleted file mode 100644 index cd27e7ba..00000000 --- a/pynitrokey/nethsm/client/components/schema/sign_mode.py +++ /dev/null @@ -1,183 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - - -class SignModeEnums: - - @schemas.classproperty - def PKCS1(cls) -> typing.Literal["PKCS1"]: - return SignMode.validate("PKCS1") - - @schemas.classproperty - def PSS_MD5(cls) -> typing.Literal["PSS_MD5"]: - return SignMode.validate("PSS_MD5") - - @schemas.classproperty - def PSS_SHA1(cls) -> typing.Literal["PSS_SHA1"]: - return SignMode.validate("PSS_SHA1") - - @schemas.classproperty - def PSS_SHA224(cls) -> typing.Literal["PSS_SHA224"]: - return SignMode.validate("PSS_SHA224") - - @schemas.classproperty - def PSS_SHA256(cls) -> typing.Literal["PSS_SHA256"]: - return SignMode.validate("PSS_SHA256") - - @schemas.classproperty - def PSS_SHA384(cls) -> typing.Literal["PSS_SHA384"]: - return SignMode.validate("PSS_SHA384") - - @schemas.classproperty - def PSS_SHA512(cls) -> typing.Literal["PSS_SHA512"]: - return SignMode.validate("PSS_SHA512") - - @schemas.classproperty - def ED_DSA(cls) -> typing.Literal["EdDSA"]: - return SignMode.validate("EdDSA") - - @schemas.classproperty - def ECDSA(cls) -> typing.Literal["ECDSA"]: - return SignMode.validate("ECDSA") - - -@dataclasses.dataclass(frozen=True) -class SignMode( - schemas.Schema -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({ - str, - }) - enum_value_to_name: typing.Mapping[typing.Union[int, float, str, schemas.Bool, None], str] = dataclasses.field( - default_factory=lambda: { - "PKCS1": "PKCS1", - "PSS_MD5": "PSS_MD5", - "PSS_SHA1": "PSS_SHA1", - "PSS_SHA224": "PSS_SHA224", - "PSS_SHA256": "PSS_SHA256", - "PSS_SHA384": "PSS_SHA384", - "PSS_SHA512": "PSS_SHA512", - "EdDSA": "ED_DSA", - "ECDSA": "ECDSA", - } - ) - enums = SignModeEnums - - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["PKCS1"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["PKCS1"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["PSS_MD5"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["PSS_MD5"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["PSS_SHA1"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["PSS_SHA1"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["PSS_SHA224"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["PSS_SHA224"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["PSS_SHA256"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["PSS_SHA256"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["PSS_SHA384"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["PSS_SHA384"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["PSS_SHA512"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["PSS_SHA512"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["EdDSA"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["EdDSA"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["ECDSA"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["ECDSA"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: str, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["PKCS1","PSS_MD5","PSS_SHA1","PSS_SHA224","PSS_SHA256","PSS_SHA384","PSS_SHA512","EdDSA","ECDSA",]: ... - @classmethod - def validate( - cls, - arg, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal[ - "PKCS1", - "PSS_MD5", - "PSS_SHA1", - "PSS_SHA224", - "PSS_SHA256", - "PSS_SHA384", - "PSS_SHA512", - "EdDSA", - "ECDSA", - ]: - validated_arg = super().validate_base( - arg, - configuration=configuration, - ) - return typing.cast(typing.Literal[ - "PKCS1", - "PSS_MD5", - "PSS_SHA1", - "PSS_SHA224", - "PSS_SHA256", - "PSS_SHA384", - "PSS_SHA512", - "EdDSA", - "ECDSA", - ], - validated_arg - ) diff --git a/pynitrokey/nethsm/client/components/schema/sign_request_data.py b/pynitrokey/nethsm/client/components/schema/sign_request_data.py deleted file mode 100644 index 317174b5..00000000 --- a/pynitrokey/nethsm/client/components/schema/sign_request_data.py +++ /dev/null @@ -1,127 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -from pynitrokey.nethsm.client.components.schema import base64 -from pynitrokey.nethsm.client.components.schema import sign_mode -Properties = typing.TypedDict( - 'Properties', - { - "mode": typing.Type[sign_mode.SignMode], - "message": typing.Type[base64.Base64], - } -) - - -class SignRequestDataDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - - __required_keys__: typing.FrozenSet[str] = frozenset({ - "message", - "mode", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - message: str, - mode: typing.Literal[ - "PKCS1", - "PSS_MD5", - "PSS_SHA1", - "PSS_SHA224", - "PSS_SHA256", - "PSS_SHA384", - "PSS_SHA512", - "EdDSA", - "ECDSA" - ], - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - **kwargs: schemas.INPUT_TYPES_ALL, - ): - arg_: typing.Dict[str, typing.Any] = { - "message": message, - "mode": mode, - } - arg_.update(kwargs) - used_arg_ = typing.cast(SignRequestDataDictInput, arg_) - return SignRequestData.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - SignRequestDataDictInput, - SignRequestDataDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> SignRequestDataDict: - return SignRequestData.validate(arg, configuration=configuration) - - @property - def message(self) -> str: - return typing.cast( - str, - self.__getitem__("message") - ) - - @property - def mode(self) -> typing.Literal["PKCS1", "PSS_MD5", "PSS_SHA1", "PSS_SHA224", "PSS_SHA256", "PSS_SHA384", "PSS_SHA512", "EdDSA", "ECDSA"]: - return typing.cast( - typing.Literal["PKCS1", "PSS_MD5", "PSS_SHA1", "PSS_SHA224", "PSS_SHA256", "PSS_SHA384", "PSS_SHA512", "EdDSA", "ECDSA"], - self.__getitem__("mode") - ) - - def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]: - schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__) - return self.get(name, schemas.unset) -SignRequestDataDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL] - - -@dataclasses.dataclass(frozen=True) -class SignRequestData( - schemas.Schema[SignRequestDataDict, tuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "message", - "mode", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: SignRequestDataDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - SignRequestDataDictInput, - SignRequestDataDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> SignRequestDataDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/components/schema/switch.py b/pynitrokey/nethsm/client/components/schema/switch.py deleted file mode 100644 index 28b391a7..00000000 --- a/pynitrokey/nethsm/client/components/schema/switch.py +++ /dev/null @@ -1,85 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - - -class SwitchEnums: - - @schemas.classproperty - def ON(cls) -> typing.Literal["on"]: - return Switch.validate("on") - - @schemas.classproperty - def OFF(cls) -> typing.Literal["off"]: - return Switch.validate("off") - - -@dataclasses.dataclass(frozen=True) -class Switch( - schemas.Schema -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({ - str, - }) - enum_value_to_name: typing.Mapping[typing.Union[int, float, str, schemas.Bool, None], str] = dataclasses.field( - default_factory=lambda: { - "on": "ON", - "off": "OFF", - } - ) - enums = SwitchEnums - - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["on"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["on"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["off"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["off"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: str, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["on","off",]: ... - @classmethod - def validate( - cls, - arg, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal[ - "on", - "off", - ]: - validated_arg = super().validate_base( - arg, - configuration=configuration, - ) - return typing.cast(typing.Literal[ - "on", - "off", - ], - validated_arg - ) diff --git a/pynitrokey/nethsm/client/components/schema/system_info.py b/pynitrokey/nethsm/client/components/schema/system_info.py deleted file mode 100644 index e47056cd..00000000 --- a/pynitrokey/nethsm/client/components/schema/system_info.py +++ /dev/null @@ -1,187 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -SoftwareVersion: typing_extensions.TypeAlias = schemas.StrSchema -SoftwareBuild: typing_extensions.TypeAlias = schemas.StrSchema -FirmwareVersion: typing_extensions.TypeAlias = schemas.StrSchema -HardwareVersion: typing_extensions.TypeAlias = schemas.StrSchema -DeviceId: typing_extensions.TypeAlias = schemas.StrSchema -AkPub: typing_extensions.TypeAlias = schemas.DictSchema -Pcr: typing_extensions.TypeAlias = schemas.DictSchema -Properties = typing.TypedDict( - 'Properties', - { - "softwareVersion": typing.Type[SoftwareVersion], - "softwareBuild": typing.Type[SoftwareBuild], - "firmwareVersion": typing.Type[FirmwareVersion], - "hardwareVersion": typing.Type[HardwareVersion], - "deviceId": typing.Type[DeviceId], - "akPub": typing.Type[AkPub], - "pcr": typing.Type[Pcr], - } -) - - -class SystemInfoDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - - __required_keys__: typing.FrozenSet[str] = frozenset({ - "akPub", - "deviceId", - "firmwareVersion", - "hardwareVersion", - "pcr", - "softwareBuild", - "softwareVersion", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - akPub: typing.Union[ - typing.Mapping[str, schemas.INPUT_TYPES_ALL], - schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES], - ], - deviceId: str, - firmwareVersion: str, - hardwareVersion: str, - pcr: typing.Union[ - typing.Mapping[str, schemas.INPUT_TYPES_ALL], - schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES], - ], - softwareBuild: str, - softwareVersion: str, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - **kwargs: schemas.INPUT_TYPES_ALL, - ): - arg_: typing.Dict[str, typing.Any] = { - "akPub": akPub, - "deviceId": deviceId, - "firmwareVersion": firmwareVersion, - "hardwareVersion": hardwareVersion, - "pcr": pcr, - "softwareBuild": softwareBuild, - "softwareVersion": softwareVersion, - } - arg_.update(kwargs) - used_arg_ = typing.cast(SystemInfoDictInput, arg_) - return SystemInfo.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - SystemInfoDictInput, - SystemInfoDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> SystemInfoDict: - return SystemInfo.validate(arg, configuration=configuration) - - @property - def akPub(self) -> schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]: - return typing.cast( - schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES], - self.__getitem__("akPub") - ) - - @property - def deviceId(self) -> str: - return typing.cast( - str, - self.__getitem__("deviceId") - ) - - @property - def firmwareVersion(self) -> str: - return typing.cast( - str, - self.__getitem__("firmwareVersion") - ) - - @property - def hardwareVersion(self) -> str: - return typing.cast( - str, - self.__getitem__("hardwareVersion") - ) - - @property - def pcr(self) -> schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]: - return typing.cast( - schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES], - self.__getitem__("pcr") - ) - - @property - def softwareBuild(self) -> str: - return typing.cast( - str, - self.__getitem__("softwareBuild") - ) - - @property - def softwareVersion(self) -> str: - return typing.cast( - str, - self.__getitem__("softwareVersion") - ) - - def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]: - schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__) - return self.get(name, schemas.unset) -SystemInfoDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL] - - -@dataclasses.dataclass(frozen=True) -class SystemInfo( - schemas.Schema[SystemInfoDict, tuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "akPub", - "deviceId", - "firmwareVersion", - "hardwareVersion", - "pcr", - "softwareBuild", - "softwareVersion", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: SystemInfoDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - SystemInfoDictInput, - SystemInfoDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> SystemInfoDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/components/schema/system_state.py b/pynitrokey/nethsm/client/components/schema/system_state.py deleted file mode 100644 index b8961737..00000000 --- a/pynitrokey/nethsm/client/components/schema/system_state.py +++ /dev/null @@ -1,99 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - - -class SystemStateEnums: - - @schemas.classproperty - def UNPROVISIONED(cls) -> typing.Literal["Unprovisioned"]: - return SystemState.validate("Unprovisioned") - - @schemas.classproperty - def LOCKED(cls) -> typing.Literal["Locked"]: - return SystemState.validate("Locked") - - @schemas.classproperty - def OPERATIONAL(cls) -> typing.Literal["Operational"]: - return SystemState.validate("Operational") - - -@dataclasses.dataclass(frozen=True) -class SystemState( - schemas.Schema -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({ - str, - }) - enum_value_to_name: typing.Mapping[typing.Union[int, float, str, schemas.Bool, None], str] = dataclasses.field( - default_factory=lambda: { - "Unprovisioned": "UNPROVISIONED", - "Locked": "LOCKED", - "Operational": "OPERATIONAL", - } - ) - enums = SystemStateEnums - - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["Unprovisioned"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["Unprovisioned"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["Locked"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["Locked"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["Operational"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["Operational"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: str, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["Unprovisioned","Locked","Operational",]: ... - @classmethod - def validate( - cls, - arg, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal[ - "Unprovisioned", - "Locked", - "Operational", - ]: - validated_arg = super().validate_base( - arg, - configuration=configuration, - ) - return typing.cast(typing.Literal[ - "Unprovisioned", - "Locked", - "Operational", - ], - validated_arg - ) diff --git a/pynitrokey/nethsm/client/components/schema/system_update_data.py b/pynitrokey/nethsm/client/components/schema/system_update_data.py deleted file mode 100644 index bab89cbb..00000000 --- a/pynitrokey/nethsm/client/components/schema/system_update_data.py +++ /dev/null @@ -1,103 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -ReleaseNotes: typing_extensions.TypeAlias = schemas.StrSchema -Properties = typing.TypedDict( - 'Properties', - { - "releaseNotes": typing.Type[ReleaseNotes], - } -) - - -class SystemUpdateDataDict(schemas.immutabledict[str, str]): - - __required_keys__: typing.FrozenSet[str] = frozenset({ - "releaseNotes", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - releaseNotes: str, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - **kwargs: schemas.INPUT_TYPES_ALL, - ): - arg_: typing.Dict[str, typing.Any] = { - "releaseNotes": releaseNotes, - } - arg_.update(kwargs) - used_arg_ = typing.cast(SystemUpdateDataDictInput, arg_) - return SystemUpdateData.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - SystemUpdateDataDictInput, - SystemUpdateDataDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> SystemUpdateDataDict: - return SystemUpdateData.validate(arg, configuration=configuration) - - @property - def releaseNotes(self) -> str: - return typing.cast( - str, - self.__getitem__("releaseNotes") - ) - - def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]: - schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__) - return self.get(name, schemas.unset) -SystemUpdateDataDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL] - - -@dataclasses.dataclass(frozen=True) -class SystemUpdateData( - schemas.Schema[SystemUpdateDataDict, tuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "releaseNotes", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: SystemUpdateDataDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - SystemUpdateDataDictInput, - SystemUpdateDataDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> SystemUpdateDataDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/components/schema/tag_list.py b/pynitrokey/nethsm/client/components/schema/tag_list.py deleted file mode 100644 index 10702ef2..00000000 --- a/pynitrokey/nethsm/client/components/schema/tag_list.py +++ /dev/null @@ -1,69 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -from pynitrokey.nethsm.client.components.schema import id - - -class TagListTuple( - typing.Tuple[ - str, - ... - ] -): - - def __new__(cls, arg: typing.Union[TagListTupleInput, TagListTuple], configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None): - return TagList.validate(arg, configuration=configuration) -TagListTupleInput = typing.Union[ - typing.List[ - str, - ], - typing.Tuple[ - str, - ... - ] -] - - -@dataclasses.dataclass(frozen=True) -class TagList( - schemas.Schema[schemas.immutabledict, TagListTuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({tuple}) - items: typing.Type[id.ID] = dataclasses.field(default_factory=lambda: id.ID) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - tuple: TagListTuple - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - TagListTupleInput, - TagListTuple, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> TagListTuple: - return super().validate_base( - arg, - configuration=configuration, - ) diff --git a/pynitrokey/nethsm/client/components/schema/time_config.py b/pynitrokey/nethsm/client/components/schema/time_config.py deleted file mode 100644 index 03c6dd48..00000000 --- a/pynitrokey/nethsm/client/components/schema/time_config.py +++ /dev/null @@ -1,106 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -Time: typing_extensions.TypeAlias = schemas.DateTimeSchema -Properties = typing.TypedDict( - 'Properties', - { - "time": typing.Type[Time], - } -) - - -class TimeConfigDict(schemas.immutabledict[str, str]): - - __required_keys__: typing.FrozenSet[str] = frozenset({ - "time", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - time: typing.Union[ - str, - datetime.datetime - ], - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - **kwargs: schemas.INPUT_TYPES_ALL, - ): - arg_: typing.Dict[str, typing.Any] = { - "time": time, - } - arg_.update(kwargs) - used_arg_ = typing.cast(TimeConfigDictInput, arg_) - return TimeConfig.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - TimeConfigDictInput, - TimeConfigDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> TimeConfigDict: - return TimeConfig.validate(arg, configuration=configuration) - - @property - def time(self) -> str: - return typing.cast( - str, - self.__getitem__("time") - ) - - def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]: - schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__) - return self.get(name, schemas.unset) -TimeConfigDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL] - - -@dataclasses.dataclass(frozen=True) -class TimeConfig( - schemas.Schema[TimeConfigDict, tuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "time", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: TimeConfigDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - TimeConfigDictInput, - TimeConfigDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> TimeConfigDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/components/schema/tls_key_generate_request_data.py b/pynitrokey/nethsm/client/components/schema/tls_key_generate_request_data.py deleted file mode 100644 index 339a3877..00000000 --- a/pynitrokey/nethsm/client/components/schema/tls_key_generate_request_data.py +++ /dev/null @@ -1,145 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - - -@dataclasses.dataclass(frozen=True) -class Length( - schemas.IntSchema -): - types: typing.FrozenSet[typing.Type] = frozenset({ - int, - }) - format: str = 'int' - inclusive_maximum: typing.Union[int, float] = 8192 - inclusive_minimum: typing.Union[int, float] = 128 - -from pynitrokey.nethsm.client.components.schema import tls_key_type -Properties = typing.TypedDict( - 'Properties', - { - "type": typing.Type[tls_key_type.TlsKeyType], - "length": typing.Type[Length], - } -) - - -class TlsKeyGenerateRequestDataDict(schemas.immutabledict[str, int]): - - __required_keys__: typing.FrozenSet[str] = frozenset({ - "type", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - "length", - }) - - def __new__( - cls, - *, - type: typing.Literal[ - "RSA", - "Curve25519", - "EC_P224", - "EC_P256", - "EC_P384", - "EC_P521" - ], - length: typing.Union[ - int, - schemas.Unset - ] = schemas.unset, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - **kwargs: schemas.INPUT_TYPES_ALL, - ): - arg_: typing.Dict[str, typing.Any] = { - "type": type, - } - for key, val in ( - ("length", length), - ): - if isinstance(val, schemas.Unset): - continue - arg_[key] = val - arg_.update(kwargs) - used_arg_ = typing.cast(TlsKeyGenerateRequestDataDictInput, arg_) - return TlsKeyGenerateRequestData.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - TlsKeyGenerateRequestDataDictInput, - TlsKeyGenerateRequestDataDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> TlsKeyGenerateRequestDataDict: - return TlsKeyGenerateRequestData.validate(arg, configuration=configuration) - - @property - def type(self) -> typing.Literal["RSA", "Curve25519", "EC_P224", "EC_P256", "EC_P384", "EC_P521"]: - return typing.cast( - typing.Literal["RSA", "Curve25519", "EC_P224", "EC_P256", "EC_P384", "EC_P521"], - self.__getitem__("type") - ) - - @property - def length(self) -> typing.Union[int, schemas.Unset]: - val = self.get("length", schemas.unset) - if isinstance(val, schemas.Unset): - return val - return typing.cast( - int, - val - ) - - def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]: - schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__) - return self.get(name, schemas.unset) -TlsKeyGenerateRequestDataDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL] - - -@dataclasses.dataclass(frozen=True) -class TlsKeyGenerateRequestData( - schemas.Schema[TlsKeyGenerateRequestDataDict, tuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "type", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: TlsKeyGenerateRequestDataDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - TlsKeyGenerateRequestDataDictInput, - TlsKeyGenerateRequestDataDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> TlsKeyGenerateRequestDataDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/components/schema/tls_key_type.py b/pynitrokey/nethsm/client/components/schema/tls_key_type.py deleted file mode 100644 index a3a79937..00000000 --- a/pynitrokey/nethsm/client/components/schema/tls_key_type.py +++ /dev/null @@ -1,141 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - - -class TlsKeyTypeEnums: - - @schemas.classproperty - def RSA(cls) -> typing.Literal["RSA"]: - return TlsKeyType.validate("RSA") - - @schemas.classproperty - def CURVE25519(cls) -> typing.Literal["Curve25519"]: - return TlsKeyType.validate("Curve25519") - - @schemas.classproperty - def EC_P224(cls) -> typing.Literal["EC_P224"]: - return TlsKeyType.validate("EC_P224") - - @schemas.classproperty - def EC_P256(cls) -> typing.Literal["EC_P256"]: - return TlsKeyType.validate("EC_P256") - - @schemas.classproperty - def EC_P384(cls) -> typing.Literal["EC_P384"]: - return TlsKeyType.validate("EC_P384") - - @schemas.classproperty - def EC_P521(cls) -> typing.Literal["EC_P521"]: - return TlsKeyType.validate("EC_P521") - - -@dataclasses.dataclass(frozen=True) -class TlsKeyType( - schemas.Schema -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({ - str, - }) - enum_value_to_name: typing.Mapping[typing.Union[int, float, str, schemas.Bool, None], str] = dataclasses.field( - default_factory=lambda: { - "RSA": "RSA", - "Curve25519": "CURVE25519", - "EC_P224": "EC_P224", - "EC_P256": "EC_P256", - "EC_P384": "EC_P384", - "EC_P521": "EC_P521", - } - ) - enums = TlsKeyTypeEnums - - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["RSA"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["RSA"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["Curve25519"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["Curve25519"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["EC_P224"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["EC_P224"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["EC_P256"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["EC_P256"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["EC_P384"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["EC_P384"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["EC_P521"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["EC_P521"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: str, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["RSA","Curve25519","EC_P224","EC_P256","EC_P384","EC_P521",]: ... - @classmethod - def validate( - cls, - arg, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal[ - "RSA", - "Curve25519", - "EC_P224", - "EC_P256", - "EC_P384", - "EC_P521", - ]: - validated_arg = super().validate_base( - arg, - configuration=configuration, - ) - return typing.cast(typing.Literal[ - "RSA", - "Curve25519", - "EC_P224", - "EC_P256", - "EC_P384", - "EC_P521", - ], - validated_arg - ) diff --git a/pynitrokey/nethsm/client/components/schema/unattended_boot_config.py b/pynitrokey/nethsm/client/components/schema/unattended_boot_config.py deleted file mode 100644 index 96491d93..00000000 --- a/pynitrokey/nethsm/client/components/schema/unattended_boot_config.py +++ /dev/null @@ -1,106 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -from pynitrokey.nethsm.client.components.schema import switch -Properties = typing.TypedDict( - 'Properties', - { - "status": typing.Type[switch.Switch], - } -) - - -class UnattendedBootConfigDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - __required_keys__: typing.FrozenSet[str] = frozenset({ - "status", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - status: typing.Literal[ - "on", - "off" - ], - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - **kwargs: schemas.INPUT_TYPES_ALL, - ): - arg_: typing.Dict[str, typing.Any] = { - "status": status, - } - arg_.update(kwargs) - used_arg_ = typing.cast(UnattendedBootConfigDictInput, arg_) - return UnattendedBootConfig.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - UnattendedBootConfigDictInput, - UnattendedBootConfigDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> UnattendedBootConfigDict: - return UnattendedBootConfig.validate(arg, configuration=configuration) - - @property - def status(self) -> typing.Literal["on", "off"]: - return typing.cast( - typing.Literal["on", "off"], - self.__getitem__("status") - ) - - def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]: - schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__) - return self.get(name, schemas.unset) -UnattendedBootConfigDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL] - - -@dataclasses.dataclass(frozen=True) -class UnattendedBootConfig( - schemas.Schema[UnattendedBootConfigDict, tuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "status", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: UnattendedBootConfigDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - UnattendedBootConfigDictInput, - UnattendedBootConfigDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> UnattendedBootConfigDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/components/schema/unlock_passphrase_config.py b/pynitrokey/nethsm/client/components/schema/unlock_passphrase_config.py deleted file mode 100644 index 81619778..00000000 --- a/pynitrokey/nethsm/client/components/schema/unlock_passphrase_config.py +++ /dev/null @@ -1,103 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -from pynitrokey.nethsm.client.components.schema import passphrase -Properties = typing.TypedDict( - 'Properties', - { - "passphrase": typing.Type[passphrase.Passphrase], - } -) - - -class UnlockPassphraseConfigDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - __required_keys__: typing.FrozenSet[str] = frozenset({ - "passphrase", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - passphrase: str, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - **kwargs: schemas.INPUT_TYPES_ALL, - ): - arg_: typing.Dict[str, typing.Any] = { - "passphrase": passphrase, - } - arg_.update(kwargs) - used_arg_ = typing.cast(UnlockPassphraseConfigDictInput, arg_) - return UnlockPassphraseConfig.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - UnlockPassphraseConfigDictInput, - UnlockPassphraseConfigDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> UnlockPassphraseConfigDict: - return UnlockPassphraseConfig.validate(arg, configuration=configuration) - - @property - def passphrase(self) -> str: - return typing.cast( - str, - self.__getitem__("passphrase") - ) - - def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]: - schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__) - return self.get(name, schemas.unset) -UnlockPassphraseConfigDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL] - - -@dataclasses.dataclass(frozen=True) -class UnlockPassphraseConfig( - schemas.Schema[UnlockPassphraseConfigDict, tuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "passphrase", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: UnlockPassphraseConfigDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - UnlockPassphraseConfigDictInput, - UnlockPassphraseConfigDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> UnlockPassphraseConfigDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/components/schema/unlock_request_data.py b/pynitrokey/nethsm/client/components/schema/unlock_request_data.py deleted file mode 100644 index 4ae30bbb..00000000 --- a/pynitrokey/nethsm/client/components/schema/unlock_request_data.py +++ /dev/null @@ -1,103 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -from pynitrokey.nethsm.client.components.schema import passphrase -Properties = typing.TypedDict( - 'Properties', - { - "passphrase": typing.Type[passphrase.Passphrase], - } -) - - -class UnlockRequestDataDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - __required_keys__: typing.FrozenSet[str] = frozenset({ - "passphrase", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - passphrase: str, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - **kwargs: schemas.INPUT_TYPES_ALL, - ): - arg_: typing.Dict[str, typing.Any] = { - "passphrase": passphrase, - } - arg_.update(kwargs) - used_arg_ = typing.cast(UnlockRequestDataDictInput, arg_) - return UnlockRequestData.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - UnlockRequestDataDictInput, - UnlockRequestDataDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> UnlockRequestDataDict: - return UnlockRequestData.validate(arg, configuration=configuration) - - @property - def passphrase(self) -> str: - return typing.cast( - str, - self.__getitem__("passphrase") - ) - - def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]: - schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__) - return self.get(name, schemas.unset) -UnlockRequestDataDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL] - - -@dataclasses.dataclass(frozen=True) -class UnlockRequestData( - schemas.Schema[UnlockRequestDataDict, tuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "passphrase", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: UnlockRequestDataDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - UnlockRequestDataDictInput, - UnlockRequestDataDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> UnlockRequestDataDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/components/schema/user_data.py b/pynitrokey/nethsm/client/components/schema/user_data.py deleted file mode 100644 index ac5c9bf2..00000000 --- a/pynitrokey/nethsm/client/components/schema/user_data.py +++ /dev/null @@ -1,121 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -RealName: typing_extensions.TypeAlias = schemas.StrSchema - -from pynitrokey.nethsm.client.components.schema import user_role -Properties = typing.TypedDict( - 'Properties', - { - "realName": typing.Type[RealName], - "role": typing.Type[user_role.UserRole], - } -) - - -class UserDataDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - __required_keys__: typing.FrozenSet[str] = frozenset({ - "realName", - "role", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - realName: str, - role: typing.Literal[ - "Administrator", - "Operator", - "Metrics", - "Backup" - ], - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - **kwargs: schemas.INPUT_TYPES_ALL, - ): - arg_: typing.Dict[str, typing.Any] = { - "realName": realName, - "role": role, - } - arg_.update(kwargs) - used_arg_ = typing.cast(UserDataDictInput, arg_) - return UserData.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - UserDataDictInput, - UserDataDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> UserDataDict: - return UserData.validate(arg, configuration=configuration) - - @property - def realName(self) -> str: - return typing.cast( - str, - self.__getitem__("realName") - ) - - @property - def role(self) -> typing.Literal["Administrator", "Operator", "Metrics", "Backup"]: - return typing.cast( - typing.Literal["Administrator", "Operator", "Metrics", "Backup"], - self.__getitem__("role") - ) - - def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]: - schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__) - return self.get(name, schemas.unset) -UserDataDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL] - - -@dataclasses.dataclass(frozen=True) -class UserData( - schemas.Schema[UserDataDict, tuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "realName", - "role", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: UserDataDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - UserDataDictInput, - UserDataDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> UserDataDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/components/schema/user_item.py b/pynitrokey/nethsm/client/components/schema/user_item.py deleted file mode 100644 index 43231c78..00000000 --- a/pynitrokey/nethsm/client/components/schema/user_item.py +++ /dev/null @@ -1,103 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -from pynitrokey.nethsm.client.components.schema import id -Properties = typing.TypedDict( - 'Properties', - { - "user": typing.Type[id.ID], - } -) - - -class UserItemDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - __required_keys__: typing.FrozenSet[str] = frozenset({ - "user", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - user: str, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - **kwargs: schemas.INPUT_TYPES_ALL, - ): - arg_: typing.Dict[str, typing.Any] = { - "user": user, - } - arg_.update(kwargs) - used_arg_ = typing.cast(UserItemDictInput, arg_) - return UserItem.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - UserItemDictInput, - UserItemDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> UserItemDict: - return UserItem.validate(arg, configuration=configuration) - - @property - def user(self) -> str: - return typing.cast( - str, - self.__getitem__("user") - ) - - def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]: - schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__) - return self.get(name, schemas.unset) -UserItemDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL] - - -@dataclasses.dataclass(frozen=True) -class UserItem( - schemas.Schema[UserItemDict, tuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "user", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: UserItemDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - UserItemDictInput, - UserItemDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> UserItemDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/components/schema/user_list.py b/pynitrokey/nethsm/client/components/schema/user_list.py deleted file mode 100644 index e922d674..00000000 --- a/pynitrokey/nethsm/client/components/schema/user_list.py +++ /dev/null @@ -1,75 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -from pynitrokey.nethsm.client.components.schema import user_item - - -class UserListTuple( - typing.Tuple[ - user_item.UserItemDict, - ... - ] -): - - def __new__(cls, arg: typing.Union[UserListTupleInput, UserListTuple], configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None): - return UserList.validate(arg, configuration=configuration) -UserListTupleInput = typing.Union[ - typing.List[ - typing.Union[ - user_item.UserItemDictInput, - user_item.UserItemDict, - ], - ], - typing.Tuple[ - typing.Union[ - user_item.UserItemDictInput, - user_item.UserItemDict, - ], - ... - ] -] - - -@dataclasses.dataclass(frozen=True) -class UserList( - schemas.Schema[schemas.immutabledict, UserListTuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({tuple}) - items: typing.Type[user_item.UserItem] = dataclasses.field(default_factory=lambda: user_item.UserItem) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - tuple: UserListTuple - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - UserListTupleInput, - UserListTuple, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> UserListTuple: - return super().validate_base( - arg, - configuration=configuration, - ) diff --git a/pynitrokey/nethsm/client/components/schema/user_passphrase_post_data.py b/pynitrokey/nethsm/client/components/schema/user_passphrase_post_data.py deleted file mode 100644 index e440da71..00000000 --- a/pynitrokey/nethsm/client/components/schema/user_passphrase_post_data.py +++ /dev/null @@ -1,103 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -from pynitrokey.nethsm.client.components.schema import passphrase -Properties = typing.TypedDict( - 'Properties', - { - "passphrase": typing.Type[passphrase.Passphrase], - } -) - - -class UserPassphrasePostDataDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - __required_keys__: typing.FrozenSet[str] = frozenset({ - "passphrase", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - passphrase: str, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - **kwargs: schemas.INPUT_TYPES_ALL, - ): - arg_: typing.Dict[str, typing.Any] = { - "passphrase": passphrase, - } - arg_.update(kwargs) - used_arg_ = typing.cast(UserPassphrasePostDataDictInput, arg_) - return UserPassphrasePostData.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - UserPassphrasePostDataDictInput, - UserPassphrasePostDataDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> UserPassphrasePostDataDict: - return UserPassphrasePostData.validate(arg, configuration=configuration) - - @property - def passphrase(self) -> str: - return typing.cast( - str, - self.__getitem__("passphrase") - ) - - def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]: - schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__) - return self.get(name, schemas.unset) -UserPassphrasePostDataDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL] - - -@dataclasses.dataclass(frozen=True) -class UserPassphrasePostData( - schemas.Schema[UserPassphrasePostDataDict, tuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "passphrase", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: UserPassphrasePostDataDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - UserPassphrasePostDataDictInput, - UserPassphrasePostDataDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> UserPassphrasePostDataDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/components/schema/user_post_data.py b/pynitrokey/nethsm/client/components/schema/user_post_data.py deleted file mode 100644 index 10510521..00000000 --- a/pynitrokey/nethsm/client/components/schema/user_post_data.py +++ /dev/null @@ -1,135 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -RealName: typing_extensions.TypeAlias = schemas.StrSchema - -from pynitrokey.nethsm.client.components.schema import passphrase -from pynitrokey.nethsm.client.components.schema import user_role -Properties = typing.TypedDict( - 'Properties', - { - "realName": typing.Type[RealName], - "role": typing.Type[user_role.UserRole], - "passphrase": typing.Type[passphrase.Passphrase], - } -) - - -class UserPostDataDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - - __required_keys__: typing.FrozenSet[str] = frozenset({ - "passphrase", - "realName", - "role", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - passphrase: str, - realName: str, - role: typing.Literal[ - "Administrator", - "Operator", - "Metrics", - "Backup" - ], - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - **kwargs: schemas.INPUT_TYPES_ALL, - ): - arg_: typing.Dict[str, typing.Any] = { - "passphrase": passphrase, - "realName": realName, - "role": role, - } - arg_.update(kwargs) - used_arg_ = typing.cast(UserPostDataDictInput, arg_) - return UserPostData.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - UserPostDataDictInput, - UserPostDataDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> UserPostDataDict: - return UserPostData.validate(arg, configuration=configuration) - - @property - def passphrase(self) -> str: - return typing.cast( - str, - self.__getitem__("passphrase") - ) - - @property - def realName(self) -> str: - return typing.cast( - str, - self.__getitem__("realName") - ) - - @property - def role(self) -> typing.Literal["Administrator", "Operator", "Metrics", "Backup"]: - return typing.cast( - typing.Literal["Administrator", "Operator", "Metrics", "Backup"], - self.__getitem__("role") - ) - - def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]: - schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__) - return self.get(name, schemas.unset) -UserPostDataDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL] - - -@dataclasses.dataclass(frozen=True) -class UserPostData( - schemas.Schema[UserPostDataDict, tuple] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "passphrase", - "realName", - "role", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: UserPostDataDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - UserPostDataDictInput, - UserPostDataDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> UserPostDataDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/components/schema/user_role.py b/pynitrokey/nethsm/client/components/schema/user_role.py deleted file mode 100644 index 485da32d..00000000 --- a/pynitrokey/nethsm/client/components/schema/user_role.py +++ /dev/null @@ -1,113 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - - -class UserRoleEnums: - - @schemas.classproperty - def ADMINISTRATOR(cls) -> typing.Literal["Administrator"]: - return UserRole.validate("Administrator") - - @schemas.classproperty - def OPERATOR(cls) -> typing.Literal["Operator"]: - return UserRole.validate("Operator") - - @schemas.classproperty - def METRICS(cls) -> typing.Literal["Metrics"]: - return UserRole.validate("Metrics") - - @schemas.classproperty - def BACKUP(cls) -> typing.Literal["Backup"]: - return UserRole.validate("Backup") - - -@dataclasses.dataclass(frozen=True) -class UserRole( - schemas.Schema -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - """ - types: typing.FrozenSet[typing.Type] = frozenset({ - str, - }) - enum_value_to_name: typing.Mapping[typing.Union[int, float, str, schemas.Bool, None], str] = dataclasses.field( - default_factory=lambda: { - "Administrator": "ADMINISTRATOR", - "Operator": "OPERATOR", - "Metrics": "METRICS", - "Backup": "BACKUP", - } - ) - enums = UserRoleEnums - - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["Administrator"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["Administrator"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["Operator"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["Operator"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["Metrics"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["Metrics"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal["Backup"], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["Backup"]: ... - @typing.overload - @classmethod - def validate( - cls, - arg: str, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal["Administrator","Operator","Metrics","Backup",]: ... - @classmethod - def validate( - cls, - arg, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal[ - "Administrator", - "Operator", - "Metrics", - "Backup", - ]: - validated_arg = super().validate_base( - arg, - configuration=configuration, - ) - return typing.cast(typing.Literal[ - "Administrator", - "Operator", - "Metrics", - "Backup", - ], - validated_arg - ) diff --git a/pynitrokey/nethsm/client/components/schemas/__init__.py b/pynitrokey/nethsm/client/components/schemas/__init__.py deleted file mode 100644 index cb598e62..00000000 --- a/pynitrokey/nethsm/client/components/schemas/__init__.py +++ /dev/null @@ -1,69 +0,0 @@ -# coding: utf-8 - -# flake8: noqa - -# import all models into this package -# if you have many models here with many references from one model to another this may -# raise a RecursionError -# to avoid this, import only the models that you directly need like: -# from from pynitrokey.nethsm.client.components.schema.pet import Pet -# or import this package, but before doing it, use: -# import sys -# sys.setrecursionlimit(n) - -from pynitrokey.nethsm.client.components.schema.backup_passphrase_config import BackupPassphraseConfig -from pynitrokey.nethsm.client.components.schema.base64 import Base64 -from pynitrokey.nethsm.client.components.schema.decrypt_data import DecryptData -from pynitrokey.nethsm.client.components.schema.decrypt_mode import DecryptMode -from pynitrokey.nethsm.client.components.schema.decrypt_request_data import DecryptRequestData -from pynitrokey.nethsm.client.components.schema.distinguished_name import DistinguishedName -from pynitrokey.nethsm.client.components.schema.encrypt_data import EncryptData -from pynitrokey.nethsm.client.components.schema.encrypt_mode import EncryptMode -from pynitrokey.nethsm.client.components.schema.encrypt_request_data import EncryptRequestData -from pynitrokey.nethsm.client.components.schema.health_state_data import HealthStateData -from pynitrokey.nethsm.client.components.schema.id import ID -from pynitrokey.nethsm.client.components.schema.info_data import InfoData -from pynitrokey.nethsm.client.components.schema.key_generate_request_data import KeyGenerateRequestData -from pynitrokey.nethsm.client.components.schema.key_item import KeyItem -from pynitrokey.nethsm.client.components.schema.key_list import KeyList -from pynitrokey.nethsm.client.components.schema.key_mechanism import KeyMechanism -from pynitrokey.nethsm.client.components.schema.key_mechanisms import KeyMechanisms -from pynitrokey.nethsm.client.components.schema.key_private_data import KeyPrivateData -from pynitrokey.nethsm.client.components.schema.key_public_data import KeyPublicData -from pynitrokey.nethsm.client.components.schema.key_restrictions import KeyRestrictions -from pynitrokey.nethsm.client.components.schema.key_type import KeyType -from pynitrokey.nethsm.client.components.schema.log_level import LogLevel -from pynitrokey.nethsm.client.components.schema.logging_config import LoggingConfig -from pynitrokey.nethsm.client.components.schema.metrics_data import MetricsData -from pynitrokey.nethsm.client.components.schema.network_config import NetworkConfig -from pynitrokey.nethsm.client.components.schema.pgp_private_key import PGPPrivateKey -from pynitrokey.nethsm.client.components.schema.passphrase import Passphrase -from pynitrokey.nethsm.client.components.schema.pem_csr import PemCSR -from pynitrokey.nethsm.client.components.schema.pem_cert import PemCert -from pynitrokey.nethsm.client.components.schema.pem_private_key import PemPrivateKey -from pynitrokey.nethsm.client.components.schema.pem_public_key import PemPublicKey -from pynitrokey.nethsm.client.components.schema.private_key import PrivateKey -from pynitrokey.nethsm.client.components.schema.provision_request_data import ProvisionRequestData -from pynitrokey.nethsm.client.components.schema.public_key import PublicKey -from pynitrokey.nethsm.client.components.schema.random_data import RandomData -from pynitrokey.nethsm.client.components.schema.random_request_data import RandomRequestData -from pynitrokey.nethsm.client.components.schema.sign_data import SignData -from pynitrokey.nethsm.client.components.schema.sign_mode import SignMode -from pynitrokey.nethsm.client.components.schema.sign_request_data import SignRequestData -from pynitrokey.nethsm.client.components.schema.switch import Switch -from pynitrokey.nethsm.client.components.schema.system_info import SystemInfo -from pynitrokey.nethsm.client.components.schema.system_state import SystemState -from pynitrokey.nethsm.client.components.schema.system_update_data import SystemUpdateData -from pynitrokey.nethsm.client.components.schema.tag_list import TagList -from pynitrokey.nethsm.client.components.schema.time_config import TimeConfig -from pynitrokey.nethsm.client.components.schema.tls_key_generate_request_data import TlsKeyGenerateRequestData -from pynitrokey.nethsm.client.components.schema.tls_key_type import TlsKeyType -from pynitrokey.nethsm.client.components.schema.unattended_boot_config import UnattendedBootConfig -from pynitrokey.nethsm.client.components.schema.unlock_passphrase_config import UnlockPassphraseConfig -from pynitrokey.nethsm.client.components.schema.unlock_request_data import UnlockRequestData -from pynitrokey.nethsm.client.components.schema.user_data import UserData -from pynitrokey.nethsm.client.components.schema.user_item import UserItem -from pynitrokey.nethsm.client.components.schema.user_list import UserList -from pynitrokey.nethsm.client.components.schema.user_passphrase_post_data import UserPassphrasePostData -from pynitrokey.nethsm.client.components.schema.user_post_data import UserPostData -from pynitrokey.nethsm.client.components.schema.user_role import UserRole diff --git a/pynitrokey/nethsm/client/components/security_schemes/__init__.py b/pynitrokey/nethsm/client/components/security_schemes/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/components/security_schemes/security_scheme_basic.py b/pynitrokey/nethsm/client/components/security_schemes/security_scheme_basic.py deleted file mode 100644 index d55fef01..00000000 --- a/pynitrokey/nethsm/client/components/security_schemes/security_scheme_basic.py +++ /dev/null @@ -1,14 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.security_scheme_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -@dataclasses.dataclass -class Basic(security_schemes.HTTPBasicSecurityScheme): - ''' - NetHSM supports Basic Authentication. - - ''' diff --git a/pynitrokey/nethsm/client/configurations/__init__.py b/pynitrokey/nethsm/client/configurations/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/configurations/api_configuration.py b/pynitrokey/nethsm/client/configurations/api_configuration.py deleted file mode 100644 index c6ce95e3..00000000 --- a/pynitrokey/nethsm/client/configurations/api_configuration.py +++ /dev/null @@ -1,441 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -import copy -from http import client as http_client -import logging -import multiprocessing -import sys -import typing -import typing_extensions - -import urllib3 - -from pynitrokey.nethsm.client import exceptions -from pynitrokey.nethsm.client import security_schemes -from pynitrokey.nethsm.client.components.security_schemes import security_scheme_basic -from pynitrokey.nethsm.client.servers import server_0 - -# security scheme key identifier to security scheme instance -SecuritySchemeInfo = typing.TypedDict( - 'SecuritySchemeInfo', - { - "basic": security_scheme_basic.Basic, - }, - total=False -) - - -class SecurityIndexInfoRequired(typing.TypedDict): - security: int - -SecurityIndexInfoOptional = typing.TypedDict( - 'SecurityIndexInfoOptional', - { - "paths//config/backup-passphrase/put/security": typing.Literal[0], - "paths//config/logging/get/security": typing.Literal[0], - "paths//config/logging/put/security": typing.Literal[0], - "paths//config/network/get/security": typing.Literal[0], - "paths//config/network/put/security": typing.Literal[0], - "paths//config/time/get/security": typing.Literal[0], - "paths//config/time/put/security": typing.Literal[0], - "paths//config/tls/cert.pem/get/security": typing.Literal[0], - "paths//config/tls/cert.pem/put/security": typing.Literal[0], - "paths//config/tls/csr.pem/post/security": typing.Literal[0], - "paths//config/tls/generate/post/security": typing.Literal[0], - "paths//config/tls/public.pem/get/security": typing.Literal[0], - "paths//config/unattended-boot/get/security": typing.Literal[0], - "paths//config/unattended-boot/put/security": typing.Literal[0], - "paths//config/unlock-passphrase/put/security": typing.Literal[0], - "paths//keys/get/security": typing.Literal[0], - "paths//keys/post/security": typing.Literal[0], - "paths//keys/generate/post/security": typing.Literal[0], - "paths//keys/{KeyID}/delete/security": typing.Literal[0], - "paths//keys/{KeyID}/get/security": typing.Literal[0], - "paths//keys/{KeyID}/put/security": typing.Literal[0], - "paths//keys/{KeyID}/cert/delete/security": typing.Literal[0], - "paths//keys/{KeyID}/cert/get/security": typing.Literal[0], - "paths//keys/{KeyID}/cert/put/security": typing.Literal[0], - "paths//keys/{KeyID}/csr.pem/post/security": typing.Literal[0], - "paths//keys/{KeyID}/decrypt/post/security": typing.Literal[0], - "paths//keys/{KeyID}/encrypt/post/security": typing.Literal[0], - "paths//keys/{KeyID}/public.pem/get/security": typing.Literal[0], - "paths//keys/{KeyID}/restrictions/tags/{Tag}/delete/security": typing.Literal[0], - "paths//keys/{KeyID}/restrictions/tags/{Tag}/put/security": typing.Literal[0], - "paths//keys/{KeyID}/sign/post/security": typing.Literal[0], - "paths//lock/post/security": typing.Literal[0], - "paths//metrics/get/security": typing.Literal[0], - "paths//random/post/security": typing.Literal[0], - "paths//system/backup/post/security": typing.Literal[0], - "paths//system/cancel-update/post/security": typing.Literal[0], - "paths//system/commit-update/post/security": typing.Literal[0], - "paths//system/factory-reset/post/security": typing.Literal[0], - "paths//system/info/get/security": typing.Literal[0], - "paths//system/reboot/post/security": typing.Literal[0], - "paths//system/shutdown/post/security": typing.Literal[0], - "paths//system/update/post/security": typing.Literal[0], - "paths//users/get/security": typing.Literal[0], - "paths//users/post/security": typing.Literal[0], - "paths//users/{UserID}/delete/security": typing.Literal[0], - "paths//users/{UserID}/get/security": typing.Literal[0], - "paths//users/{UserID}/put/security": typing.Literal[0], - "paths//users/{UserID}/passphrase/post/security": typing.Literal[0], - "paths//users/{UserID}/tags/get/security": typing.Literal[0], - "paths//users/{UserID}/tags/{Tag}/delete/security": typing.Literal[0], - "paths//users/{UserID}/tags/{Tag}/put/security": typing.Literal[0], - }, - total=False -) - - -class SecurityIndexInfo(SecurityIndexInfoRequired, SecurityIndexInfoOptional): - """ - the default security_index to use at each openapi document json path - the fallback value is stored in the 'security' key - """ - -# the server to use at each openapi document json path -ServerInfo = typing.TypedDict( - 'ServerInfo', - { - 'servers/0': server_0.Server0, - }, - total=False -) - - -class ServerIndexInfoRequired(typing.TypedDict): - servers: typing.Literal[0] - -ServerIndexInfoOptional = typing.TypedDict( - 'ServerIndexInfoOptional', - { - }, - total=False -) - - -class ServerIndexInfo(ServerIndexInfoRequired, ServerIndexInfoOptional): - """ - the default server_index to use at each openapi document json path - the fallback value is stored in the 'servers' key - """ - - -class ApiConfiguration(object): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator - - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - Do not edit the class manually. - - :param security_scheme_info: the security scheme auth info that can be used when calling endpoints - The key is a string that identifies the component security scheme that one is adding auth info for - The value is an instance of the component security scheme class for that security scheme - See the SecuritySchemeInfo TypedDict definition - :param security_index_info: path to security_index information - :param server_info: the servers that can be used to make endpoint calls - :param server_index_info: index to servers configuration - """ - - def __init__( - self, - security_scheme_info: typing.Optional[SecuritySchemeInfo] = None, - security_index_info: typing.Optional[SecurityIndexInfo] = None, - server_info: typing.Optional[ServerInfo] = None, - server_index_info: typing.Optional[ServerIndexInfo] = None, - ): - """Constructor - """ - # Authentication Settings - self.security_scheme_info: SecuritySchemeInfo = security_scheme_info or SecuritySchemeInfo() - self.security_index_info: SecurityIndexInfo = security_index_info or {'security': 0} - # Server Info - self.server_info: ServerInfo = server_info or { - 'servers/0': server_0.Server0(), - } - self.server_index_info: ServerIndexInfo = server_index_info or {'servers': 0} - self.logger = {} - """Logging Settings - """ - self.logger["package_logger"] = logging.getLogger("pynitrokey.nethsm.client") - self.logger["urllib3_logger"] = logging.getLogger("urllib3") - self.logger_format = '%(asctime)s %(levelname)s %(message)s' - """Log format - """ - self.logger_stream_handler = None - """Log stream handler - """ - self.logger_file_handler = None - """Log file handler - """ - self.logger_file = None - """Debug file location - """ - self.debug = False - """Debug switch - """ - - self.verify_ssl = True - """SSL/TLS verification - Set this to false to skip verifying SSL certificate when calling API - from https server. - """ - self.ssl_ca_cert = None - """Set this to customize the certificate file to verify the peer. - """ - self.cert_file = None - """client certificate file - """ - self.key_file = None - """client key file - """ - self.assert_hostname = None - """Set this to True/False to enable/disable SSL hostname verification. - """ - - self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 - """urllib3 connection pool's maximum number of connections saved - per pool. urllib3 uses 1 connection as default value, but this is - not the best value when you are making a lot of possibly parallel - requests to the same host, which is often the case here. - cpu_count * 5 is used as default value to increase performance. - """ - - self.proxy = None - """Proxy URL - """ - self.proxy_headers = None - """Proxy headers - """ - self.safe_chars_for_path_param = '' - """Safe chars for path_param - """ - self.retries = None - """Adding retries to override urllib3 default value 3 - """ - # Enable client side validation - self.client_side_validation = True - - # Options to pass down to the underlying urllib3 socket - self.socket_options = None - - def __deepcopy__(self, memo): - cls = self.__class__ - result = cls.__new__(cls) - memo[id(self)] = result - for k, v in self.__dict__.items(): - if k not in ('logger', 'logger_file_handler'): - setattr(result, k, copy.deepcopy(v, memo)) - # shallow copy of loggers - result.logger = copy.copy(self.logger) - # use setters to configure loggers - result.logger_file = self.logger_file - result.debug = self.debug - return result - - @property - def logger_file(self): - """The logger file. - - If the logger_file is None, then add stream handler and remove file - handler. Otherwise, add file handler and remove stream handler. - - :param value: The logger_file path. - :type: str - """ - return self.__logger_file - - @logger_file.setter - def logger_file(self, value): - """The logger file. - - If the logger_file is None, then add stream handler and remove file - handler. Otherwise, add file handler and remove stream handler. - - :param value: The logger_file path. - :type: str - """ - self.__logger_file = value - if self.__logger_file: - # If set logging file, - # then add file handler and remove stream handler. - self.logger_file_handler = logging.FileHandler(self.__logger_file) - self.logger_file_handler.setFormatter(self.logger_formatter) - for _, logger in self.logger.items(): - logger.addHandler(self.logger_file_handler) - - @property - def debug(self): - """Debug status - - :param value: The debug status, True or False. - :type: bool - """ - return self.__debug - - @debug.setter - def debug(self, value): - """Debug status - - :param value: The debug status, True or False. - :type: bool - """ - self.__debug = value - if self.__debug: - # if debug status is True, turn on debug logging - for _, logger in self.logger.items(): - logger.setLevel(logging.DEBUG) - # turn on http_client debug - http_client.HTTPConnection.debuglevel = 1 - else: - # if debug status is False, turn off debug logging, - # setting log level to default `logging.WARNING` - for _, logger in self.logger.items(): - logger.setLevel(logging.WARNING) - # turn off http_client debug - http_client.HTTPConnection.debuglevel = 0 - - @property - def logger_format(self): - """The logger format. - - The logger_formatter will be updated when sets logger_format. - - :param value: The format string. - :type: str - """ - return self.__logger_format - - @logger_format.setter - def logger_format(self, value): - """The logger format. - - The logger_formatter will be updated when sets logger_format. - - :param value: The format string. - :type: str - """ - self.__logger_format = value - self.logger_formatter = logging.Formatter(self.__logger_format) - - def to_debug_report(self): - """Gets the essential information for debugging. - - :return: The report for debugging. - """ - return "Python SDK Debug Report:\n"\ - "OS: {env}\n"\ - "Python Version: {pyversion}\n"\ - "Version of the API: v1\n"\ - "SDK Package Version: 1.0.0".\ - format(env=sys.platform, pyversion=sys.version) - - def get_server_url( - self, - key_prefix: typing.Literal[ - "servers", - ], - index: typing.Optional[int], - ) -> str: - """Gets host URL based on the index - :param index: array index of the host settings - :return: URL based on host settings - """ - if index: - used_index = index - else: - try: - used_index = self.server_index_info[key_prefix] - except KeyError: - # fallback and use the default index - used_index = self.server_index_info.get("servers", 0) - server_info_key = typing.cast( - typing.Literal[ - "servers/0", - ], - f"{key_prefix}/{used_index}" - ) - try: - server = self.server_info[server_info_key] - except KeyError as ex: - raise ex - return server.url - - def get_security_requirement_object( - self, - key_prefix: typing.Literal[ - "security", - "paths//config/backup-passphrase/put/security", - "paths//config/logging/get/security", - "paths//config/logging/put/security", - "paths//config/network/get/security", - "paths//config/network/put/security", - "paths//config/time/get/security", - "paths//config/time/put/security", - "paths//config/tls/cert.pem/get/security", - "paths//config/tls/cert.pem/put/security", - "paths//config/tls/csr.pem/post/security", - "paths//config/tls/generate/post/security", - "paths//config/tls/public.pem/get/security", - "paths//config/unattended-boot/get/security", - "paths//config/unattended-boot/put/security", - "paths//config/unlock-passphrase/put/security", - "paths//keys/get/security", - "paths//keys/post/security", - "paths//keys/generate/post/security", - "paths//keys/{KeyID}/delete/security", - "paths//keys/{KeyID}/get/security", - "paths//keys/{KeyID}/put/security", - "paths//keys/{KeyID}/cert/delete/security", - "paths//keys/{KeyID}/cert/get/security", - "paths//keys/{KeyID}/cert/put/security", - "paths//keys/{KeyID}/csr.pem/post/security", - "paths//keys/{KeyID}/decrypt/post/security", - "paths//keys/{KeyID}/encrypt/post/security", - "paths//keys/{KeyID}/public.pem/get/security", - "paths//keys/{KeyID}/restrictions/tags/{Tag}/delete/security", - "paths//keys/{KeyID}/restrictions/tags/{Tag}/put/security", - "paths//keys/{KeyID}/sign/post/security", - "paths//lock/post/security", - "paths//metrics/get/security", - "paths//random/post/security", - "paths//system/backup/post/security", - "paths//system/cancel-update/post/security", - "paths//system/commit-update/post/security", - "paths//system/factory-reset/post/security", - "paths//system/info/get/security", - "paths//system/reboot/post/security", - "paths//system/shutdown/post/security", - "paths//system/update/post/security", - "paths//users/get/security", - "paths//users/post/security", - "paths//users/{UserID}/delete/security", - "paths//users/{UserID}/get/security", - "paths//users/{UserID}/put/security", - "paths//users/{UserID}/passphrase/post/security", - "paths//users/{UserID}/tags/get/security", - "paths//users/{UserID}/tags/{Tag}/delete/security", - "paths//users/{UserID}/tags/{Tag}/put/security", - ], - security_requirement_objects: typing.List[security_schemes.SecurityRequirementObject], - index: typing.Optional[int], - ) -> security_schemes.SecurityRequirementObject: - """Gets security_schemes.SecurityRequirementObject based on the index - :param index: array index of the SecurityRequirementObject - :return: the selected security_schemes.SecurityRequirementObject - """ - if index: - used_index = index - else: - try: - used_index = self.security_index_info[key_prefix] - except KeyError: - # fallback and use the default index - used_index = self.security_index_info.get("security", 0) - return security_requirement_objects[used_index] diff --git a/pynitrokey/nethsm/client/configurations/schema_configuration.py b/pynitrokey/nethsm/client/configurations/schema_configuration.py deleted file mode 100644 index 42e8ee6d..00000000 --- a/pynitrokey/nethsm/client/configurations/schema_configuration.py +++ /dev/null @@ -1,105 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -import typing - -from pynitrokey.nethsm.client import exceptions - - -PYTHON_KEYWORD_TO_JSON_SCHEMA_KEYWORD = { - 'additional_properties': 'additionalProperties', - 'all_of': 'allOf', - 'any_of': 'anyOf', - 'const_value_to_name': 'const', - 'contains': 'contains', - 'dependent_required': 'dependentRequired', - 'dependent_schemas': 'dependentSchemas', - 'discriminator': 'discriminator', - # default omitted because it has no validation impact - 'enum_value_to_name': 'enum', - 'exclusive_maximum': 'exclusiveMaximum', - 'exclusive_minimum': 'exclusiveMinimum', - 'format': 'format', - 'inclusive_maximum': 'maximum', - 'inclusive_minimum': 'minimum', - 'items': 'items', - 'max_contains': 'maxContains', - 'max_items': 'maxItems', - 'max_length': 'maxLength', - 'max_properties': 'maxProperties', - 'min_contains': 'minContains', - 'min_items': 'minItems', - 'min_length': 'minLength', - 'min_properties': 'minProperties', - 'multiple_of': 'multipleOf', - 'not_': 'not', - 'one_of': 'oneOf', - 'pattern': 'pattern', - 'pattern_properties': 'patternProperties', - 'prefix_items': 'prefixItems', - 'properties': 'properties', - 'property_names': 'propertyNames', - 'required': 'required', - 'types': 'type', - 'unique_items': 'uniqueItems', - 'unevaluated_items': 'unevaluatedItems', - 'unevaluated_properties': 'unevaluatedProperties' -} - -class SchemaConfiguration: - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator - - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - Do not edit the class manually. - - :param disabled_json_schema_keywords (set): Set of - JSON schema validation keywords to disable JSON schema structural validation - rules. The following keywords may be specified: multipleOf, maximum, - exclusiveMaximum, minimum, exclusiveMinimum, maxLength, minLength, pattern, - maxItems, minItems. - By default, the validation is performed for data generated locally by the client - and data received from the server, independent of any validation performed by - the server side. If the input data does not satisfy the JSON schema validation - rules specified in the OpenAPI document, an exception is raised. - If disabled_json_schema_keywords is set, structural validation is - disabled. This can be useful to troubleshoot data validation problem, such as - when the OpenAPI document validation rules do not match the actual API data - received by the server. - :param server_index: Index to servers configuration. - """ - - def __init__( - self, - disabled_json_schema_keywords = set(), - ): - """Constructor - """ - self.disabled_json_schema_keywords = disabled_json_schema_keywords - - @property - def disabled_json_schema_python_keywords(self) -> typing.Set[str]: - return self.__disabled_json_schema_python_keywords - - @property - def disabled_json_schema_keywords(self) -> typing.Set[str]: - return self.__disabled_json_schema_keywords - - @disabled_json_schema_keywords.setter - def disabled_json_schema_keywords(self, json_keywords: typing.Set[str]): - disabled_json_schema_keywords = set() - disabled_json_schema_python_keywords = set() - for k in json_keywords: - python_keywords = {key for key, val in PYTHON_KEYWORD_TO_JSON_SCHEMA_KEYWORD.items() if val == k} - if not python_keywords: - raise exceptions.ApiValueError( - "Invalid keyword: '{0}''".format(k)) - disabled_json_schema_keywords.add(k) - disabled_json_schema_python_keywords.update(python_keywords) - self.__disabled_json_schema_keywords = disabled_json_schema_keywords - self.__disabled_json_schema_python_keywords = disabled_json_schema_python_keywords \ No newline at end of file diff --git a/pynitrokey/nethsm/client/exceptions.py b/pynitrokey/nethsm/client/exceptions.py deleted file mode 100644 index 7ebb72ca..00000000 --- a/pynitrokey/nethsm/client/exceptions.py +++ /dev/null @@ -1,132 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -import dataclasses -import typing - -from pynitrokey.nethsm.client import api_response - - -class OpenApiException(Exception): - """The base exception class for all OpenAPIExceptions""" - -def render_path(path_to_item): - """Returns a string representation of a path""" - result = "" - for pth in path_to_item: - if isinstance(pth, int): - result += "[{0}]".format(pth) - else: - result += "['{0}']".format(pth) - return result - - -class ApiTypeError(OpenApiException, TypeError): - def __init__(self, msg, path_to_item=None, valid_classes=None, - key_type=None): - """ Raises an exception for TypeErrors - - Args: - msg (str): the exception message - - Keyword Args: - path_to_item (list): a list of keys an indices to get to the - current_item - None if unset - valid_classes (tuple): the primitive classes that current item - should be an instance of - None if unset - key_type (bool): False if our value is a value in a dict - True if it is a key in a dict - False if our item is an item in a list - None if unset - """ - self.path_to_item = path_to_item - self.valid_classes = valid_classes - self.key_type = key_type - full_msg = msg - if path_to_item: - full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) - super(ApiTypeError, self).__init__(full_msg) - - -class ApiValueError(OpenApiException, ValueError): - def __init__(self, msg, path_to_item=None): - """ - Args: - msg (str): the exception message - - Keyword Args: - path_to_item (list) the path to the exception in the - received_data dict. None if unset - """ - - self.path_to_item = path_to_item - full_msg = msg - if path_to_item: - full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) - super(ApiValueError, self).__init__(full_msg) - - -class ApiAttributeError(OpenApiException, AttributeError): - def __init__(self, msg, path_to_item=None): - """ - Raised when an attribute reference or assignment fails. - - Args: - msg (str): the exception message - - Keyword Args: - path_to_item (None/list) the path to the exception in the - received_data dict - """ - self.path_to_item = path_to_item - full_msg = msg - if path_to_item: - full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) - super(ApiAttributeError, self).__init__(full_msg) - - -class ApiKeyError(OpenApiException, KeyError): - def __init__(self, msg, path_to_item=None): - """ - Args: - msg (str): the exception message - - Keyword Args: - path_to_item (None/list) the path to the exception in the - received_data dict - """ - self.path_to_item = path_to_item - full_msg = msg - if path_to_item: - full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) - super(ApiKeyError, self).__init__(full_msg) - -T = typing.TypeVar('T', bound=api_response.ApiResponse) - - -@dataclasses.dataclass -class ApiException(OpenApiException, typing.Generic[T]): - status: int - reason: typing.Optional[str] = None - api_response: typing.Optional[T] = None - - def __str__(self): - """Custom error messages for exception""" - error_message = "({0})\n"\ - "Reason: {1}\n".format(self.status, self.reason) - if self.api_response: - if self.api_response.response.headers: - error_message += "HTTP response headers: {0}\n".format( - self.api_response.response.headers) - if self.api_response.response.data: - error_message += "HTTP response body: {0}\n".format(self.api_response.response.data) - - return error_message diff --git a/pynitrokey/nethsm/client/paths/__init__.py b/pynitrokey/nethsm/client/paths/__init__.py deleted file mode 100644 index 09cb64f2..00000000 --- a/pynitrokey/nethsm/client/paths/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis import path_to_api diff --git a/pynitrokey/nethsm/client/paths/config_backup_passphrase/__init__.py b/pynitrokey/nethsm/client/paths/config_backup_passphrase/__init__.py deleted file mode 100644 index 94b6c416..00000000 --- a/pynitrokey/nethsm/client/paths/config_backup_passphrase/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.config_backup_passphrase import ConfigBackupPassphrase - -path = "/config/backup-passphrase" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/__init__.py b/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/operation.py b/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/operation.py deleted file mode 100644 index 5fd0bcae..00000000 --- a/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/operation.py +++ /dev/null @@ -1,188 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import backup_passphrase_config - -from .. import path -from .responses import ( - response_204, - response_400, - response_401, - response_403, - response_406, - response_412, -) -from . import request_body -from .security import security_requirement_object_0 - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '204': typing.Type[response_204.ResponseFor204], - '400': typing.Type[response_400.ResponseFor400], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '204': response_204.ResponseFor204, - '400': response_400.ResponseFor400, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '204', -}) -_error_status_codes = frozenset({ - '400', - '401', - '403', - '406', - '412', -}) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_backup_passphrase_put( - self, - body: typing.Union[ - backup_passphrase_config.BackupPassphraseConfigDictInput, - backup_passphrase_config.BackupPassphraseConfigDict, - ], - *, - skip_deserialization: typing.Literal[False] = False, - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_204.ApiResponse: ... - - @typing.overload - def _config_backup_passphrase_put( - self, - body: typing.Union[ - backup_passphrase_config.BackupPassphraseConfigDictInput, - backup_passphrase_config.BackupPassphraseConfigDict, - ], - *, - skip_deserialization: typing.Literal[True], - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _config_backup_passphrase_put( - self, - body: typing.Union[ - backup_passphrase_config.BackupPassphraseConfigDictInput, - backup_passphrase_config.BackupPassphraseConfigDict, - ], - *, - skip_deserialization: bool = False, - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path - headers = self._get_headers() - # TODO add cookie handling - - fields, serialized_body = self._get_fields_and_body( - request_body=request_body.RequestBody, - body=body, - content_type=content_type, - headers=headers - ) - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//config/backup-passphrase/put/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='put', - host=host, - headers=headers, - fields=fields, - body=serialized_body, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '204', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '400', - '401', - '403', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class ConfigBackupPassphrasePut(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - config_backup_passphrase_put = BaseApi._config_backup_passphrase_put - - -class ApiForPut(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - put = BaseApi._config_backup_passphrase_put diff --git a/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/request_body/__init__.py b/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/request_body/__init__.py deleted file mode 100644 index ad29c4a8..00000000 --- a/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/request_body/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -class RequestBody(api_client.RequestBody): - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } - required = True diff --git a/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/request_body/content/__init__.py b/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/request_body/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/request_body/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/request_body/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/request_body/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/request_body/content/application_json/schema.py deleted file mode 100644 index 618a9699..00000000 --- a/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/request_body/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import backup_passphrase_config -Schema: typing_extensions.TypeAlias = backup_passphrase_config.BackupPassphraseConfig diff --git a/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/__init__.py b/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/response_204/__init__.py b/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/response_204/__init__.py deleted file mode 100644 index 8e822e77..00000000 --- a/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/response_204/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor204(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/response_400/__init__.py b/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/response_400/__init__.py deleted file mode 100644 index 0458793b..00000000 --- a/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/response_400/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor400(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/security/__init__.py b/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/config_logging/__init__.py b/pynitrokey/nethsm/client/paths/config_logging/__init__.py deleted file mode 100644 index 0edb58ed..00000000 --- a/pynitrokey/nethsm/client/paths/config_logging/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.config_logging import ConfigLogging - -path = "/config/logging" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/config_logging/get/__init__.py b/pynitrokey/nethsm/client/paths/config_logging/get/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_logging/get/operation.py b/pynitrokey/nethsm/client/paths/config_logging/get/operation.py deleted file mode 100644 index bdc06b65..00000000 --- a/pynitrokey/nethsm/client/paths/config_logging/get/operation.py +++ /dev/null @@ -1,164 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .. import path -from .responses import ( - response_200, - response_401, - response_403, - response_406, - response_412, -) -from .security import security_requirement_object_0 - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '200': typing.Type[response_200.ResponseFor200], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '200': response_200.ResponseFor200, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '200', -}) -_error_status_codes = frozenset({ - '401', - '403', - '406', - '412', -}) - -_all_accept_content_types = ( - "application/json", -) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_logging_get( - self, - *, - skip_deserialization: typing.Literal[False] = False, - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_200.ApiResponse: ... - - @typing.overload - def _config_logging_get( - self, - *, - skip_deserialization: typing.Literal[True], - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _config_logging_get( - self, - *, - skip_deserialization: bool = False, - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path - headers = self._get_headers(accept_content_types=accept_content_types) - # TODO add cookie handling - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//config/logging/get/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='get', - host=host, - headers=headers, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '200', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '401', - '403', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class ConfigLoggingGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - config_logging_get = BaseApi._config_logging_get - - -class ApiForGet(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - get = BaseApi._config_logging_get diff --git a/pynitrokey/nethsm/client/paths/config_logging/get/responses/__init__.py b/pynitrokey/nethsm/client/paths/config_logging/get/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_logging/get/responses/response_200/__init__.py b/pynitrokey/nethsm/client/paths/config_logging/get/responses/response_200/__init__.py deleted file mode 100644 index 65c12b2e..00000000 --- a/pynitrokey/nethsm/client/paths/config_logging/get/responses/response_200/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: application_json_schema.logging_config.LoggingConfigDict - headers: schemas.Unset = schemas.unset - - -class ResponseFor200(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } diff --git a/pynitrokey/nethsm/client/paths/config_logging/get/responses/response_200/content/__init__.py b/pynitrokey/nethsm/client/paths/config_logging/get/responses/response_200/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_logging/get/responses/response_200/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/config_logging/get/responses/response_200/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_logging/get/responses/response_200/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/config_logging/get/responses/response_200/content/application_json/schema.py deleted file mode 100644 index 86e80370..00000000 --- a/pynitrokey/nethsm/client/paths/config_logging/get/responses/response_200/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import logging_config -Schema: typing_extensions.TypeAlias = logging_config.LoggingConfig diff --git a/pynitrokey/nethsm/client/paths/config_logging/get/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/config_logging/get/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/config_logging/get/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_logging/get/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/config_logging/get/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/config_logging/get/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_logging/get/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/config_logging/get/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/config_logging/get/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_logging/get/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/config_logging/get/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/config_logging/get/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_logging/get/security/__init__.py b/pynitrokey/nethsm/client/paths/config_logging/get/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_logging/get/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/config_logging/get/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/config_logging/get/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/config_logging/put/__init__.py b/pynitrokey/nethsm/client/paths/config_logging/put/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_logging/put/operation.py b/pynitrokey/nethsm/client/paths/config_logging/put/operation.py deleted file mode 100644 index 0fcbdb21..00000000 --- a/pynitrokey/nethsm/client/paths/config_logging/put/operation.py +++ /dev/null @@ -1,188 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import logging_config - -from .. import path -from .responses import ( - response_204, - response_400, - response_401, - response_403, - response_406, - response_412, -) -from . import request_body -from .security import security_requirement_object_0 - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '204': typing.Type[response_204.ResponseFor204], - '400': typing.Type[response_400.ResponseFor400], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '204': response_204.ResponseFor204, - '400': response_400.ResponseFor400, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '204', -}) -_error_status_codes = frozenset({ - '400', - '401', - '403', - '406', - '412', -}) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_logging_put( - self, - body: typing.Union[ - logging_config.LoggingConfigDictInput, - logging_config.LoggingConfigDict, - ], - *, - skip_deserialization: typing.Literal[False] = False, - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_204.ApiResponse: ... - - @typing.overload - def _config_logging_put( - self, - body: typing.Union[ - logging_config.LoggingConfigDictInput, - logging_config.LoggingConfigDict, - ], - *, - skip_deserialization: typing.Literal[True], - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _config_logging_put( - self, - body: typing.Union[ - logging_config.LoggingConfigDictInput, - logging_config.LoggingConfigDict, - ], - *, - skip_deserialization: bool = False, - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path - headers = self._get_headers() - # TODO add cookie handling - - fields, serialized_body = self._get_fields_and_body( - request_body=request_body.RequestBody, - body=body, - content_type=content_type, - headers=headers - ) - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//config/logging/put/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='put', - host=host, - headers=headers, - fields=fields, - body=serialized_body, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '204', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '400', - '401', - '403', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class ConfigLoggingPut(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - config_logging_put = BaseApi._config_logging_put - - -class ApiForPut(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - put = BaseApi._config_logging_put diff --git a/pynitrokey/nethsm/client/paths/config_logging/put/request_body/__init__.py b/pynitrokey/nethsm/client/paths/config_logging/put/request_body/__init__.py deleted file mode 100644 index ad29c4a8..00000000 --- a/pynitrokey/nethsm/client/paths/config_logging/put/request_body/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -class RequestBody(api_client.RequestBody): - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } - required = True diff --git a/pynitrokey/nethsm/client/paths/config_logging/put/request_body/content/__init__.py b/pynitrokey/nethsm/client/paths/config_logging/put/request_body/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_logging/put/request_body/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/config_logging/put/request_body/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_logging/put/request_body/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/config_logging/put/request_body/content/application_json/schema.py deleted file mode 100644 index 86e80370..00000000 --- a/pynitrokey/nethsm/client/paths/config_logging/put/request_body/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import logging_config -Schema: typing_extensions.TypeAlias = logging_config.LoggingConfig diff --git a/pynitrokey/nethsm/client/paths/config_logging/put/responses/__init__.py b/pynitrokey/nethsm/client/paths/config_logging/put/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_logging/put/responses/response_204/__init__.py b/pynitrokey/nethsm/client/paths/config_logging/put/responses/response_204/__init__.py deleted file mode 100644 index 8e822e77..00000000 --- a/pynitrokey/nethsm/client/paths/config_logging/put/responses/response_204/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor204(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_logging/put/responses/response_400/__init__.py b/pynitrokey/nethsm/client/paths/config_logging/put/responses/response_400/__init__.py deleted file mode 100644 index 0458793b..00000000 --- a/pynitrokey/nethsm/client/paths/config_logging/put/responses/response_400/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor400(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_logging/put/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/config_logging/put/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/config_logging/put/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_logging/put/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/config_logging/put/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/config_logging/put/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_logging/put/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/config_logging/put/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/config_logging/put/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_logging/put/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/config_logging/put/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/config_logging/put/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_logging/put/security/__init__.py b/pynitrokey/nethsm/client/paths/config_logging/put/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_logging/put/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/config_logging/put/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/config_logging/put/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/config_network/__init__.py b/pynitrokey/nethsm/client/paths/config_network/__init__.py deleted file mode 100644 index d4aff038..00000000 --- a/pynitrokey/nethsm/client/paths/config_network/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.config_network import ConfigNetwork - -path = "/config/network" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/config_network/get/__init__.py b/pynitrokey/nethsm/client/paths/config_network/get/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_network/get/operation.py b/pynitrokey/nethsm/client/paths/config_network/get/operation.py deleted file mode 100644 index fd8ca859..00000000 --- a/pynitrokey/nethsm/client/paths/config_network/get/operation.py +++ /dev/null @@ -1,164 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .. import path -from .responses import ( - response_200, - response_401, - response_403, - response_406, - response_412, -) -from .security import security_requirement_object_0 - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '200': typing.Type[response_200.ResponseFor200], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '200': response_200.ResponseFor200, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '200', -}) -_error_status_codes = frozenset({ - '401', - '403', - '406', - '412', -}) - -_all_accept_content_types = ( - "application/json", -) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_network_get( - self, - *, - skip_deserialization: typing.Literal[False] = False, - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_200.ApiResponse: ... - - @typing.overload - def _config_network_get( - self, - *, - skip_deserialization: typing.Literal[True], - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _config_network_get( - self, - *, - skip_deserialization: bool = False, - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path - headers = self._get_headers(accept_content_types=accept_content_types) - # TODO add cookie handling - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//config/network/get/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='get', - host=host, - headers=headers, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '200', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '401', - '403', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class ConfigNetworkGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - config_network_get = BaseApi._config_network_get - - -class ApiForGet(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - get = BaseApi._config_network_get diff --git a/pynitrokey/nethsm/client/paths/config_network/get/responses/__init__.py b/pynitrokey/nethsm/client/paths/config_network/get/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_network/get/responses/response_200/__init__.py b/pynitrokey/nethsm/client/paths/config_network/get/responses/response_200/__init__.py deleted file mode 100644 index 1f15f988..00000000 --- a/pynitrokey/nethsm/client/paths/config_network/get/responses/response_200/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: application_json_schema.network_config.NetworkConfigDict - headers: schemas.Unset = schemas.unset - - -class ResponseFor200(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } diff --git a/pynitrokey/nethsm/client/paths/config_network/get/responses/response_200/content/__init__.py b/pynitrokey/nethsm/client/paths/config_network/get/responses/response_200/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_network/get/responses/response_200/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/config_network/get/responses/response_200/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_network/get/responses/response_200/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/config_network/get/responses/response_200/content/application_json/schema.py deleted file mode 100644 index 81451e56..00000000 --- a/pynitrokey/nethsm/client/paths/config_network/get/responses/response_200/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import network_config -Schema: typing_extensions.TypeAlias = network_config.NetworkConfig diff --git a/pynitrokey/nethsm/client/paths/config_network/get/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/config_network/get/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/config_network/get/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_network/get/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/config_network/get/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/config_network/get/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_network/get/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/config_network/get/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/config_network/get/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_network/get/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/config_network/get/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/config_network/get/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_network/get/security/__init__.py b/pynitrokey/nethsm/client/paths/config_network/get/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_network/get/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/config_network/get/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/config_network/get/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/config_network/put/__init__.py b/pynitrokey/nethsm/client/paths/config_network/put/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_network/put/operation.py b/pynitrokey/nethsm/client/paths/config_network/put/operation.py deleted file mode 100644 index 72e4c925..00000000 --- a/pynitrokey/nethsm/client/paths/config_network/put/operation.py +++ /dev/null @@ -1,188 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import network_config - -from .. import path -from .responses import ( - response_204, - response_400, - response_401, - response_403, - response_406, - response_412, -) -from . import request_body -from .security import security_requirement_object_0 - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '204': typing.Type[response_204.ResponseFor204], - '400': typing.Type[response_400.ResponseFor400], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '204': response_204.ResponseFor204, - '400': response_400.ResponseFor400, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '204', -}) -_error_status_codes = frozenset({ - '400', - '401', - '403', - '406', - '412', -}) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_network_put( - self, - body: typing.Union[ - network_config.NetworkConfigDictInput, - network_config.NetworkConfigDict, - ], - *, - skip_deserialization: typing.Literal[False] = False, - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_204.ApiResponse: ... - - @typing.overload - def _config_network_put( - self, - body: typing.Union[ - network_config.NetworkConfigDictInput, - network_config.NetworkConfigDict, - ], - *, - skip_deserialization: typing.Literal[True], - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _config_network_put( - self, - body: typing.Union[ - network_config.NetworkConfigDictInput, - network_config.NetworkConfigDict, - ], - *, - skip_deserialization: bool = False, - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path - headers = self._get_headers() - # TODO add cookie handling - - fields, serialized_body = self._get_fields_and_body( - request_body=request_body.RequestBody, - body=body, - content_type=content_type, - headers=headers - ) - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//config/network/put/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='put', - host=host, - headers=headers, - fields=fields, - body=serialized_body, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '204', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '400', - '401', - '403', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class ConfigNetworkPut(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - config_network_put = BaseApi._config_network_put - - -class ApiForPut(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - put = BaseApi._config_network_put diff --git a/pynitrokey/nethsm/client/paths/config_network/put/request_body/__init__.py b/pynitrokey/nethsm/client/paths/config_network/put/request_body/__init__.py deleted file mode 100644 index ad29c4a8..00000000 --- a/pynitrokey/nethsm/client/paths/config_network/put/request_body/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -class RequestBody(api_client.RequestBody): - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } - required = True diff --git a/pynitrokey/nethsm/client/paths/config_network/put/request_body/content/__init__.py b/pynitrokey/nethsm/client/paths/config_network/put/request_body/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_network/put/request_body/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/config_network/put/request_body/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_network/put/request_body/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/config_network/put/request_body/content/application_json/schema.py deleted file mode 100644 index 81451e56..00000000 --- a/pynitrokey/nethsm/client/paths/config_network/put/request_body/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import network_config -Schema: typing_extensions.TypeAlias = network_config.NetworkConfig diff --git a/pynitrokey/nethsm/client/paths/config_network/put/responses/__init__.py b/pynitrokey/nethsm/client/paths/config_network/put/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_network/put/responses/response_204/__init__.py b/pynitrokey/nethsm/client/paths/config_network/put/responses/response_204/__init__.py deleted file mode 100644 index 8e822e77..00000000 --- a/pynitrokey/nethsm/client/paths/config_network/put/responses/response_204/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor204(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_network/put/responses/response_400/__init__.py b/pynitrokey/nethsm/client/paths/config_network/put/responses/response_400/__init__.py deleted file mode 100644 index 0458793b..00000000 --- a/pynitrokey/nethsm/client/paths/config_network/put/responses/response_400/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor400(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_network/put/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/config_network/put/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/config_network/put/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_network/put/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/config_network/put/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/config_network/put/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_network/put/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/config_network/put/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/config_network/put/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_network/put/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/config_network/put/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/config_network/put/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_network/put/security/__init__.py b/pynitrokey/nethsm/client/paths/config_network/put/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_network/put/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/config_network/put/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/config_network/put/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/config_time/__init__.py b/pynitrokey/nethsm/client/paths/config_time/__init__.py deleted file mode 100644 index 94ec6ac1..00000000 --- a/pynitrokey/nethsm/client/paths/config_time/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.config_time import ConfigTime - -path = "/config/time" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/config_time/get/__init__.py b/pynitrokey/nethsm/client/paths/config_time/get/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_time/get/operation.py b/pynitrokey/nethsm/client/paths/config_time/get/operation.py deleted file mode 100644 index 247acdce..00000000 --- a/pynitrokey/nethsm/client/paths/config_time/get/operation.py +++ /dev/null @@ -1,164 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .. import path -from .responses import ( - response_200, - response_401, - response_403, - response_406, - response_412, -) -from .security import security_requirement_object_0 - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '200': typing.Type[response_200.ResponseFor200], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '200': response_200.ResponseFor200, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '200', -}) -_error_status_codes = frozenset({ - '401', - '403', - '406', - '412', -}) - -_all_accept_content_types = ( - "application/json", -) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_time_get( - self, - *, - skip_deserialization: typing.Literal[False] = False, - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_200.ApiResponse: ... - - @typing.overload - def _config_time_get( - self, - *, - skip_deserialization: typing.Literal[True], - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _config_time_get( - self, - *, - skip_deserialization: bool = False, - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path - headers = self._get_headers(accept_content_types=accept_content_types) - # TODO add cookie handling - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//config/time/get/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='get', - host=host, - headers=headers, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '200', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '401', - '403', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class ConfigTimeGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - config_time_get = BaseApi._config_time_get - - -class ApiForGet(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - get = BaseApi._config_time_get diff --git a/pynitrokey/nethsm/client/paths/config_time/get/responses/__init__.py b/pynitrokey/nethsm/client/paths/config_time/get/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_time/get/responses/response_200/__init__.py b/pynitrokey/nethsm/client/paths/config_time/get/responses/response_200/__init__.py deleted file mode 100644 index 4b27f146..00000000 --- a/pynitrokey/nethsm/client/paths/config_time/get/responses/response_200/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: application_json_schema.time_config.TimeConfigDict - headers: schemas.Unset = schemas.unset - - -class ResponseFor200(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } diff --git a/pynitrokey/nethsm/client/paths/config_time/get/responses/response_200/content/__init__.py b/pynitrokey/nethsm/client/paths/config_time/get/responses/response_200/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_time/get/responses/response_200/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/config_time/get/responses/response_200/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_time/get/responses/response_200/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/config_time/get/responses/response_200/content/application_json/schema.py deleted file mode 100644 index 301a2cce..00000000 --- a/pynitrokey/nethsm/client/paths/config_time/get/responses/response_200/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import time_config -Schema: typing_extensions.TypeAlias = time_config.TimeConfig diff --git a/pynitrokey/nethsm/client/paths/config_time/get/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/config_time/get/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/config_time/get/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_time/get/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/config_time/get/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/config_time/get/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_time/get/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/config_time/get/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/config_time/get/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_time/get/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/config_time/get/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/config_time/get/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_time/get/security/__init__.py b/pynitrokey/nethsm/client/paths/config_time/get/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_time/get/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/config_time/get/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/config_time/get/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/config_time/put/__init__.py b/pynitrokey/nethsm/client/paths/config_time/put/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_time/put/operation.py b/pynitrokey/nethsm/client/paths/config_time/put/operation.py deleted file mode 100644 index e223b6fe..00000000 --- a/pynitrokey/nethsm/client/paths/config_time/put/operation.py +++ /dev/null @@ -1,188 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import time_config - -from .. import path -from .responses import ( - response_204, - response_400, - response_401, - response_403, - response_406, - response_412, -) -from . import request_body -from .security import security_requirement_object_0 - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '204': typing.Type[response_204.ResponseFor204], - '400': typing.Type[response_400.ResponseFor400], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '204': response_204.ResponseFor204, - '400': response_400.ResponseFor400, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '204', -}) -_error_status_codes = frozenset({ - '400', - '401', - '403', - '406', - '412', -}) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_time_put( - self, - body: typing.Union[ - time_config.TimeConfigDictInput, - time_config.TimeConfigDict, - ], - *, - skip_deserialization: typing.Literal[False] = False, - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_204.ApiResponse: ... - - @typing.overload - def _config_time_put( - self, - body: typing.Union[ - time_config.TimeConfigDictInput, - time_config.TimeConfigDict, - ], - *, - skip_deserialization: typing.Literal[True], - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _config_time_put( - self, - body: typing.Union[ - time_config.TimeConfigDictInput, - time_config.TimeConfigDict, - ], - *, - skip_deserialization: bool = False, - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path - headers = self._get_headers() - # TODO add cookie handling - - fields, serialized_body = self._get_fields_and_body( - request_body=request_body.RequestBody, - body=body, - content_type=content_type, - headers=headers - ) - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//config/time/put/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='put', - host=host, - headers=headers, - fields=fields, - body=serialized_body, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '204', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '400', - '401', - '403', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class ConfigTimePut(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - config_time_put = BaseApi._config_time_put - - -class ApiForPut(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - put = BaseApi._config_time_put diff --git a/pynitrokey/nethsm/client/paths/config_time/put/request_body/__init__.py b/pynitrokey/nethsm/client/paths/config_time/put/request_body/__init__.py deleted file mode 100644 index ad29c4a8..00000000 --- a/pynitrokey/nethsm/client/paths/config_time/put/request_body/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -class RequestBody(api_client.RequestBody): - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } - required = True diff --git a/pynitrokey/nethsm/client/paths/config_time/put/request_body/content/__init__.py b/pynitrokey/nethsm/client/paths/config_time/put/request_body/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_time/put/request_body/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/config_time/put/request_body/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_time/put/request_body/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/config_time/put/request_body/content/application_json/schema.py deleted file mode 100644 index 301a2cce..00000000 --- a/pynitrokey/nethsm/client/paths/config_time/put/request_body/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import time_config -Schema: typing_extensions.TypeAlias = time_config.TimeConfig diff --git a/pynitrokey/nethsm/client/paths/config_time/put/responses/__init__.py b/pynitrokey/nethsm/client/paths/config_time/put/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_time/put/responses/response_204/__init__.py b/pynitrokey/nethsm/client/paths/config_time/put/responses/response_204/__init__.py deleted file mode 100644 index 8e822e77..00000000 --- a/pynitrokey/nethsm/client/paths/config_time/put/responses/response_204/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor204(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_time/put/responses/response_400/__init__.py b/pynitrokey/nethsm/client/paths/config_time/put/responses/response_400/__init__.py deleted file mode 100644 index 0458793b..00000000 --- a/pynitrokey/nethsm/client/paths/config_time/put/responses/response_400/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor400(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_time/put/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/config_time/put/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/config_time/put/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_time/put/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/config_time/put/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/config_time/put/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_time/put/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/config_time/put/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/config_time/put/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_time/put/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/config_time/put/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/config_time/put/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_time/put/security/__init__.py b/pynitrokey/nethsm/client/paths/config_time/put/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_time/put/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/config_time/put/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/config_time/put/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/__init__.py deleted file mode 100644 index 8e88cb9c..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.config_tls_cert_pem import ConfigTlsCertPem - -path = "/config/tls/cert.pem" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/operation.py b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/operation.py deleted file mode 100644 index dadd3d43..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/operation.py +++ /dev/null @@ -1,169 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .. import path -from .responses import ( - response_200, - response_401, - response_403, - response_406, - response_412, - response_415, -) -from .security import security_requirement_object_0 - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '200': typing.Type[response_200.ResponseFor200], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - '415': typing.Type[response_415.ResponseFor415], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '200': response_200.ResponseFor200, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, - '415': response_415.ResponseFor415, -} -_non_error_status_codes = frozenset({ - '200', -}) -_error_status_codes = frozenset({ - '401', - '403', - '406', - '412', - '415', -}) - -_all_accept_content_types = ( - "application/x-pem-file", -) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_tls_cert_pem_get( - self, - *, - skip_deserialization: typing.Literal[False] = False, - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_200.ApiResponse: ... - - @typing.overload - def _config_tls_cert_pem_get( - self, - *, - skip_deserialization: typing.Literal[True], - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _config_tls_cert_pem_get( - self, - *, - skip_deserialization: bool = False, - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path - headers = self._get_headers(accept_content_types=accept_content_types) - # TODO add cookie handling - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//config/tls/cert.pem/get/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='get', - host=host, - headers=headers, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '200', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '401', - '403', - '406', - '412', - '415', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class ConfigTlsCertPemGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - config_tls_cert_pem_get = BaseApi._config_tls_cert_pem_get - - -class ApiForGet(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - get = BaseApi._config_tls_cert_pem_get diff --git a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_200/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_200/__init__.py deleted file mode 100644 index 9354e71e..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_200/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_x_pem_file import schema as application_x_pem_file_schema - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: str - headers: schemas.Unset = schemas.unset - - -class ResponseFor200(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) - - - class ApplicationXPemFileMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_x_pem_file_schema.Schema - content = { - 'application/x-pem-file': ApplicationXPemFileMediaType, - } diff --git a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_200/content/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_200/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_200/content/application_x_pem_file/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_200/content/application_x_pem_file/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_200/content/application_x_pem_file/schema.py b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_200/content/application_x_pem_file/schema.py deleted file mode 100644 index 1457aaf5..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_200/content/application_x_pem_file/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import pem_cert -Schema: typing_extensions.TypeAlias = pem_cert.PemCert diff --git a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_415/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_415/__init__.py deleted file mode 100644 index 0339058b..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_415/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor415(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/security/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/operation.py b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/operation.py deleted file mode 100644 index f4159986..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/operation.py +++ /dev/null @@ -1,179 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import pem_cert - -from .. import path -from .responses import ( - response_201, - response_400, - response_401, - response_403, - response_406, - response_412, -) -from . import request_body -from .security import security_requirement_object_0 - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '201': typing.Type[response_201.ResponseFor201], - '400': typing.Type[response_400.ResponseFor400], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '201': response_201.ResponseFor201, - '400': response_400.ResponseFor400, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '201', -}) -_error_status_codes = frozenset({ - '400', - '401', - '403', - '406', - '412', -}) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_tls_cert_pem_put( - self, - body: str, - *, - skip_deserialization: typing.Literal[False] = False, - content_type: typing.Literal["application/x-pem-file"] = "application/x-pem-file", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_201.ApiResponse: ... - - @typing.overload - def _config_tls_cert_pem_put( - self, - body: str, - *, - skip_deserialization: typing.Literal[True], - content_type: typing.Literal["application/x-pem-file"] = "application/x-pem-file", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _config_tls_cert_pem_put( - self, - body: str, - *, - skip_deserialization: bool = False, - content_type: typing.Literal["application/x-pem-file"] = "application/x-pem-file", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path - headers = self._get_headers() - # TODO add cookie handling - - fields, serialized_body = self._get_fields_and_body( - request_body=request_body.RequestBody, - body=body, - content_type=content_type, - headers=headers - ) - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//config/tls/cert.pem/put/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='put', - host=host, - headers=headers, - fields=fields, - body=serialized_body, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '201', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '400', - '401', - '403', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class ConfigTlsCertPemPut(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - config_tls_cert_pem_put = BaseApi._config_tls_cert_pem_put - - -class ApiForPut(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - put = BaseApi._config_tls_cert_pem_put diff --git a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/request_body/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/request_body/__init__.py deleted file mode 100644 index 1744b1b6..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/request_body/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_x_pem_file import schema as application_x_pem_file_schema - - -class RequestBody(api_client.RequestBody): - - - class ApplicationXPemFileMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_x_pem_file_schema.Schema - content = { - 'application/x-pem-file': ApplicationXPemFileMediaType, - } - required = True diff --git a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/request_body/content/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/request_body/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/request_body/content/application_x_pem_file/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/request_body/content/application_x_pem_file/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/request_body/content/application_x_pem_file/schema.py b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/request_body/content/application_x_pem_file/schema.py deleted file mode 100644 index 1457aaf5..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/request_body/content/application_x_pem_file/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import pem_cert -Schema: typing_extensions.TypeAlias = pem_cert.PemCert diff --git a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/response_201/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/response_201/__init__.py deleted file mode 100644 index dca4edc5..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/response_201/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor201(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/response_400/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/response_400/__init__.py deleted file mode 100644 index 0458793b..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/response_400/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor400(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/security/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/config_tls_csr_pem/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_csr_pem/__init__.py deleted file mode 100644 index 7cf72761..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_csr_pem/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.config_tls_csr_pem import ConfigTlsCsrPem - -path = "/config/tls/csr.pem" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/operation.py b/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/operation.py deleted file mode 100644 index 8c6285e0..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/operation.py +++ /dev/null @@ -1,190 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import distinguished_name - -from .. import path -from .responses import ( - response_200, - response_401, - response_403, - response_406, - response_412, -) -from . import request_body -from .security import security_requirement_object_0 - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '200': typing.Type[response_200.ResponseFor200], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '200': response_200.ResponseFor200, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '200', -}) -_error_status_codes = frozenset({ - '401', - '403', - '406', - '412', -}) - -_all_accept_content_types = ( - "application/x-pem-file", -) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_tls_csr_pem_post( - self, - body: typing.Union[ - distinguished_name.DistinguishedNameDictInput, - distinguished_name.DistinguishedNameDict, - ], - *, - skip_deserialization: typing.Literal[False] = False, - content_type: typing.Literal["application/json"] = "application/json", - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_200.ApiResponse: ... - - @typing.overload - def _config_tls_csr_pem_post( - self, - body: typing.Union[ - distinguished_name.DistinguishedNameDictInput, - distinguished_name.DistinguishedNameDict, - ], - *, - skip_deserialization: typing.Literal[True], - content_type: typing.Literal["application/json"] = "application/json", - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _config_tls_csr_pem_post( - self, - body: typing.Union[ - distinguished_name.DistinguishedNameDictInput, - distinguished_name.DistinguishedNameDict, - ], - *, - skip_deserialization: bool = False, - content_type: typing.Literal["application/json"] = "application/json", - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path - headers = self._get_headers(accept_content_types=accept_content_types) - # TODO add cookie handling - - fields, serialized_body = self._get_fields_and_body( - request_body=request_body.RequestBody, - body=body, - content_type=content_type, - headers=headers - ) - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//config/tls/csr.pem/post/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='post', - host=host, - headers=headers, - fields=fields, - body=serialized_body, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '200', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '401', - '403', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class ConfigTlsCsrPemPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - config_tls_csr_pem_post = BaseApi._config_tls_csr_pem_post - - -class ApiForPost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - post = BaseApi._config_tls_csr_pem_post diff --git a/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/request_body/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/request_body/__init__.py deleted file mode 100644 index ad29c4a8..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/request_body/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -class RequestBody(api_client.RequestBody): - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } - required = True diff --git a/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/request_body/content/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/request_body/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/request_body/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/request_body/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/request_body/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/request_body/content/application_json/schema.py deleted file mode 100644 index 500078b6..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/request_body/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import distinguished_name -Schema: typing_extensions.TypeAlias = distinguished_name.DistinguishedName diff --git a/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_200/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_200/__init__.py deleted file mode 100644 index 9354e71e..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_200/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_x_pem_file import schema as application_x_pem_file_schema - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: str - headers: schemas.Unset = schemas.unset - - -class ResponseFor200(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) - - - class ApplicationXPemFileMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_x_pem_file_schema.Schema - content = { - 'application/x-pem-file': ApplicationXPemFileMediaType, - } diff --git a/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_200/content/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_200/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_200/content/application_x_pem_file/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_200/content/application_x_pem_file/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_200/content/application_x_pem_file/schema.py b/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_200/content/application_x_pem_file/schema.py deleted file mode 100644 index dadf2ae9..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_200/content/application_x_pem_file/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import pem_csr -Schema: typing_extensions.TypeAlias = pem_csr.PemCSR diff --git a/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/security/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/config_tls_generate/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_generate/__init__.py deleted file mode 100644 index 28210b0f..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_generate/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.config_tls_generate import ConfigTlsGenerate - -path = "/config/tls/generate" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/config_tls_generate/post/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_generate/post/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_tls_generate/post/operation.py b/pynitrokey/nethsm/client/paths/config_tls_generate/post/operation.py deleted file mode 100644 index 99c0232c..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_generate/post/operation.py +++ /dev/null @@ -1,188 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import tls_key_generate_request_data - -from .. import path -from .responses import ( - response_204, - response_400, - response_401, - response_403, - response_406, - response_412, -) -from . import request_body -from .security import security_requirement_object_0 - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '204': typing.Type[response_204.ResponseFor204], - '400': typing.Type[response_400.ResponseFor400], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '204': response_204.ResponseFor204, - '400': response_400.ResponseFor400, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '204', -}) -_error_status_codes = frozenset({ - '400', - '401', - '403', - '406', - '412', -}) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_tls_generate_post( - self, - body: typing.Union[ - tls_key_generate_request_data.TlsKeyGenerateRequestDataDictInput, - tls_key_generate_request_data.TlsKeyGenerateRequestDataDict, - ], - *, - skip_deserialization: typing.Literal[False] = False, - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_204.ApiResponse: ... - - @typing.overload - def _config_tls_generate_post( - self, - body: typing.Union[ - tls_key_generate_request_data.TlsKeyGenerateRequestDataDictInput, - tls_key_generate_request_data.TlsKeyGenerateRequestDataDict, - ], - *, - skip_deserialization: typing.Literal[True], - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _config_tls_generate_post( - self, - body: typing.Union[ - tls_key_generate_request_data.TlsKeyGenerateRequestDataDictInput, - tls_key_generate_request_data.TlsKeyGenerateRequestDataDict, - ], - *, - skip_deserialization: bool = False, - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path - headers = self._get_headers() - # TODO add cookie handling - - fields, serialized_body = self._get_fields_and_body( - request_body=request_body.RequestBody, - body=body, - content_type=content_type, - headers=headers - ) - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//config/tls/generate/post/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='post', - host=host, - headers=headers, - fields=fields, - body=serialized_body, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '204', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '400', - '401', - '403', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class ConfigTlsGeneratePost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - config_tls_generate_post = BaseApi._config_tls_generate_post - - -class ApiForPost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - post = BaseApi._config_tls_generate_post diff --git a/pynitrokey/nethsm/client/paths/config_tls_generate/post/request_body/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_generate/post/request_body/__init__.py deleted file mode 100644 index ad29c4a8..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_generate/post/request_body/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -class RequestBody(api_client.RequestBody): - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } - required = True diff --git a/pynitrokey/nethsm/client/paths/config_tls_generate/post/request_body/content/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_generate/post/request_body/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_tls_generate/post/request_body/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_generate/post/request_body/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_tls_generate/post/request_body/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/config_tls_generate/post/request_body/content/application_json/schema.py deleted file mode 100644 index ee5dfcca..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_generate/post/request_body/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import tls_key_generate_request_data -Schema: typing_extensions.TypeAlias = tls_key_generate_request_data.TlsKeyGenerateRequestData diff --git a/pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/response_204/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/response_204/__init__.py deleted file mode 100644 index 8e822e77..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/response_204/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor204(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/response_400/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/response_400/__init__.py deleted file mode 100644 index 0458793b..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/response_400/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor400(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_tls_generate/post/security/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_generate/post/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_tls_generate/post/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/config_tls_generate/post/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_generate/post/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/config_tls_public_pem/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_public_pem/__init__.py deleted file mode 100644 index ff36a9bf..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_public_pem/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.config_tls_public_pem import ConfigTlsPublicPem - -path = "/config/tls/public.pem" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/operation.py b/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/operation.py deleted file mode 100644 index 1bd86592..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/operation.py +++ /dev/null @@ -1,164 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .. import path -from .responses import ( - response_200, - response_401, - response_403, - response_406, - response_412, -) -from .security import security_requirement_object_0 - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '200': typing.Type[response_200.ResponseFor200], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '200': response_200.ResponseFor200, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '200', -}) -_error_status_codes = frozenset({ - '401', - '403', - '406', - '412', -}) - -_all_accept_content_types = ( - "application/x-pem-file", -) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_tls_public_pem_get( - self, - *, - skip_deserialization: typing.Literal[False] = False, - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_200.ApiResponse: ... - - @typing.overload - def _config_tls_public_pem_get( - self, - *, - skip_deserialization: typing.Literal[True], - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _config_tls_public_pem_get( - self, - *, - skip_deserialization: bool = False, - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path - headers = self._get_headers(accept_content_types=accept_content_types) - # TODO add cookie handling - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//config/tls/public.pem/get/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='get', - host=host, - headers=headers, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '200', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '401', - '403', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class ConfigTlsPublicPemGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - config_tls_public_pem_get = BaseApi._config_tls_public_pem_get - - -class ApiForGet(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - get = BaseApi._config_tls_public_pem_get diff --git a/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_200/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_200/__init__.py deleted file mode 100644 index 9354e71e..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_200/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_x_pem_file import schema as application_x_pem_file_schema - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: str - headers: schemas.Unset = schemas.unset - - -class ResponseFor200(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) - - - class ApplicationXPemFileMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_x_pem_file_schema.Schema - content = { - 'application/x-pem-file': ApplicationXPemFileMediaType, - } diff --git a/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_200/content/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_200/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_200/content/application_x_pem_file/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_200/content/application_x_pem_file/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_200/content/application_x_pem_file/schema.py b/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_200/content/application_x_pem_file/schema.py deleted file mode 100644 index 82e35dcd..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_200/content/application_x_pem_file/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import pem_public_key -Schema: typing_extensions.TypeAlias = pem_public_key.PemPublicKey diff --git a/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/security/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/config_unattended_boot/__init__.py b/pynitrokey/nethsm/client/paths/config_unattended_boot/__init__.py deleted file mode 100644 index ef3a989a..00000000 --- a/pynitrokey/nethsm/client/paths/config_unattended_boot/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.config_unattended_boot import ConfigUnattendedBoot - -path = "/config/unattended-boot" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/config_unattended_boot/get/__init__.py b/pynitrokey/nethsm/client/paths/config_unattended_boot/get/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_unattended_boot/get/operation.py b/pynitrokey/nethsm/client/paths/config_unattended_boot/get/operation.py deleted file mode 100644 index a902fd34..00000000 --- a/pynitrokey/nethsm/client/paths/config_unattended_boot/get/operation.py +++ /dev/null @@ -1,164 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .. import path -from .responses import ( - response_200, - response_401, - response_403, - response_406, - response_412, -) -from .security import security_requirement_object_0 - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '200': typing.Type[response_200.ResponseFor200], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '200': response_200.ResponseFor200, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '200', -}) -_error_status_codes = frozenset({ - '401', - '403', - '406', - '412', -}) - -_all_accept_content_types = ( - "application/json", -) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_unattended_boot_get( - self, - *, - skip_deserialization: typing.Literal[False] = False, - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_200.ApiResponse: ... - - @typing.overload - def _config_unattended_boot_get( - self, - *, - skip_deserialization: typing.Literal[True], - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _config_unattended_boot_get( - self, - *, - skip_deserialization: bool = False, - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path - headers = self._get_headers(accept_content_types=accept_content_types) - # TODO add cookie handling - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//config/unattended-boot/get/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='get', - host=host, - headers=headers, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '200', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '401', - '403', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class ConfigUnattendedBootGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - config_unattended_boot_get = BaseApi._config_unattended_boot_get - - -class ApiForGet(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - get = BaseApi._config_unattended_boot_get diff --git a/pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/__init__.py b/pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_200/__init__.py b/pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_200/__init__.py deleted file mode 100644 index e1abe789..00000000 --- a/pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_200/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: application_json_schema.unattended_boot_config.UnattendedBootConfigDict - headers: schemas.Unset = schemas.unset - - -class ResponseFor200(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } diff --git a/pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_200/content/__init__.py b/pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_200/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_200/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_200/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_200/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_200/content/application_json/schema.py deleted file mode 100644 index db31944e..00000000 --- a/pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_200/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import unattended_boot_config -Schema: typing_extensions.TypeAlias = unattended_boot_config.UnattendedBootConfig diff --git a/pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_unattended_boot/get/security/__init__.py b/pynitrokey/nethsm/client/paths/config_unattended_boot/get/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_unattended_boot/get/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/config_unattended_boot/get/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/config_unattended_boot/get/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/config_unattended_boot/put/__init__.py b/pynitrokey/nethsm/client/paths/config_unattended_boot/put/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_unattended_boot/put/operation.py b/pynitrokey/nethsm/client/paths/config_unattended_boot/put/operation.py deleted file mode 100644 index 9a2c47fe..00000000 --- a/pynitrokey/nethsm/client/paths/config_unattended_boot/put/operation.py +++ /dev/null @@ -1,188 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import unattended_boot_config - -from .. import path -from .responses import ( - response_204, - response_400, - response_401, - response_403, - response_406, - response_412, -) -from . import request_body -from .security import security_requirement_object_0 - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '204': typing.Type[response_204.ResponseFor204], - '400': typing.Type[response_400.ResponseFor400], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '204': response_204.ResponseFor204, - '400': response_400.ResponseFor400, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '204', -}) -_error_status_codes = frozenset({ - '400', - '401', - '403', - '406', - '412', -}) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_unattended_boot_put( - self, - body: typing.Union[ - unattended_boot_config.UnattendedBootConfigDictInput, - unattended_boot_config.UnattendedBootConfigDict, - ], - *, - skip_deserialization: typing.Literal[False] = False, - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_204.ApiResponse: ... - - @typing.overload - def _config_unattended_boot_put( - self, - body: typing.Union[ - unattended_boot_config.UnattendedBootConfigDictInput, - unattended_boot_config.UnattendedBootConfigDict, - ], - *, - skip_deserialization: typing.Literal[True], - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _config_unattended_boot_put( - self, - body: typing.Union[ - unattended_boot_config.UnattendedBootConfigDictInput, - unattended_boot_config.UnattendedBootConfigDict, - ], - *, - skip_deserialization: bool = False, - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path - headers = self._get_headers() - # TODO add cookie handling - - fields, serialized_body = self._get_fields_and_body( - request_body=request_body.RequestBody, - body=body, - content_type=content_type, - headers=headers - ) - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//config/unattended-boot/put/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='put', - host=host, - headers=headers, - fields=fields, - body=serialized_body, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '204', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '400', - '401', - '403', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class ConfigUnattendedBootPut(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - config_unattended_boot_put = BaseApi._config_unattended_boot_put - - -class ApiForPut(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - put = BaseApi._config_unattended_boot_put diff --git a/pynitrokey/nethsm/client/paths/config_unattended_boot/put/request_body/__init__.py b/pynitrokey/nethsm/client/paths/config_unattended_boot/put/request_body/__init__.py deleted file mode 100644 index ad29c4a8..00000000 --- a/pynitrokey/nethsm/client/paths/config_unattended_boot/put/request_body/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -class RequestBody(api_client.RequestBody): - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } - required = True diff --git a/pynitrokey/nethsm/client/paths/config_unattended_boot/put/request_body/content/__init__.py b/pynitrokey/nethsm/client/paths/config_unattended_boot/put/request_body/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_unattended_boot/put/request_body/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/config_unattended_boot/put/request_body/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_unattended_boot/put/request_body/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/config_unattended_boot/put/request_body/content/application_json/schema.py deleted file mode 100644 index db31944e..00000000 --- a/pynitrokey/nethsm/client/paths/config_unattended_boot/put/request_body/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import unattended_boot_config -Schema: typing_extensions.TypeAlias = unattended_boot_config.UnattendedBootConfig diff --git a/pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/__init__.py b/pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/response_204/__init__.py b/pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/response_204/__init__.py deleted file mode 100644 index 8e822e77..00000000 --- a/pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/response_204/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor204(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/response_400/__init__.py b/pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/response_400/__init__.py deleted file mode 100644 index 0458793b..00000000 --- a/pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/response_400/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor400(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_unattended_boot/put/security/__init__.py b/pynitrokey/nethsm/client/paths/config_unattended_boot/put/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_unattended_boot/put/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/config_unattended_boot/put/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/config_unattended_boot/put/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/config_unlock_passphrase/__init__.py b/pynitrokey/nethsm/client/paths/config_unlock_passphrase/__init__.py deleted file mode 100644 index 6269ca96..00000000 --- a/pynitrokey/nethsm/client/paths/config_unlock_passphrase/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.config_unlock_passphrase import ConfigUnlockPassphrase - -path = "/config/unlock-passphrase" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/__init__.py b/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/operation.py b/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/operation.py deleted file mode 100644 index 802bf589..00000000 --- a/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/operation.py +++ /dev/null @@ -1,188 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import unlock_passphrase_config - -from .. import path -from .responses import ( - response_204, - response_400, - response_401, - response_403, - response_406, - response_412, -) -from . import request_body -from .security import security_requirement_object_0 - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '204': typing.Type[response_204.ResponseFor204], - '400': typing.Type[response_400.ResponseFor400], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '204': response_204.ResponseFor204, - '400': response_400.ResponseFor400, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '204', -}) -_error_status_codes = frozenset({ - '400', - '401', - '403', - '406', - '412', -}) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_unlock_passphrase_put( - self, - body: typing.Union[ - unlock_passphrase_config.UnlockPassphraseConfigDictInput, - unlock_passphrase_config.UnlockPassphraseConfigDict, - ], - *, - skip_deserialization: typing.Literal[False] = False, - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_204.ApiResponse: ... - - @typing.overload - def _config_unlock_passphrase_put( - self, - body: typing.Union[ - unlock_passphrase_config.UnlockPassphraseConfigDictInput, - unlock_passphrase_config.UnlockPassphraseConfigDict, - ], - *, - skip_deserialization: typing.Literal[True], - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _config_unlock_passphrase_put( - self, - body: typing.Union[ - unlock_passphrase_config.UnlockPassphraseConfigDictInput, - unlock_passphrase_config.UnlockPassphraseConfigDict, - ], - *, - skip_deserialization: bool = False, - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path - headers = self._get_headers() - # TODO add cookie handling - - fields, serialized_body = self._get_fields_and_body( - request_body=request_body.RequestBody, - body=body, - content_type=content_type, - headers=headers - ) - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//config/unlock-passphrase/put/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='put', - host=host, - headers=headers, - fields=fields, - body=serialized_body, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '204', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '400', - '401', - '403', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class ConfigUnlockPassphrasePut(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - config_unlock_passphrase_put = BaseApi._config_unlock_passphrase_put - - -class ApiForPut(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - put = BaseApi._config_unlock_passphrase_put diff --git a/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/request_body/__init__.py b/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/request_body/__init__.py deleted file mode 100644 index ad29c4a8..00000000 --- a/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/request_body/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -class RequestBody(api_client.RequestBody): - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } - required = True diff --git a/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/request_body/content/__init__.py b/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/request_body/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/request_body/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/request_body/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/request_body/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/request_body/content/application_json/schema.py deleted file mode 100644 index 0d8ba277..00000000 --- a/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/request_body/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import unlock_passphrase_config -Schema: typing_extensions.TypeAlias = unlock_passphrase_config.UnlockPassphraseConfig diff --git a/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/__init__.py b/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/response_204/__init__.py b/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/response_204/__init__.py deleted file mode 100644 index 8e822e77..00000000 --- a/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/response_204/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor204(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/response_400/__init__.py b/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/response_400/__init__.py deleted file mode 100644 index 0458793b..00000000 --- a/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/response_400/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor400(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/security/__init__.py b/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/health_alive/__init__.py b/pynitrokey/nethsm/client/paths/health_alive/__init__.py deleted file mode 100644 index ec7e97f5..00000000 --- a/pynitrokey/nethsm/client/paths/health_alive/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.health_alive import HealthAlive - -path = "/health/alive" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/health_alive/get/__init__.py b/pynitrokey/nethsm/client/paths/health_alive/get/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/health_alive/get/operation.py b/pynitrokey/nethsm/client/paths/health_alive/get/operation.py deleted file mode 100644 index ed0cabd5..00000000 --- a/pynitrokey/nethsm/client/paths/health_alive/get/operation.py +++ /dev/null @@ -1,131 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .. import path -from .responses import ( - response_200, - response_406, - response_412, -) - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '200': typing.Type[response_200.ResponseFor200], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '200': response_200.ResponseFor200, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '200', -}) -_error_status_codes = frozenset({ - '406', - '412', -}) - - -class BaseApi(api_client.Api): - @typing.overload - def _health_alive_get( - self, - *, - skip_deserialization: typing.Literal[False] = False, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_200.ApiResponse: ... - - @typing.overload - def _health_alive_get( - self, - *, - skip_deserialization: typing.Literal[True], - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _health_alive_get( - self, - *, - skip_deserialization: bool = False, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path - # TODO add cookie handling - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='get', - host=host, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '200', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class HealthAliveGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - health_alive_get = BaseApi._health_alive_get - - -class ApiForGet(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - get = BaseApi._health_alive_get diff --git a/pynitrokey/nethsm/client/paths/health_alive/get/responses/__init__.py b/pynitrokey/nethsm/client/paths/health_alive/get/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/health_alive/get/responses/response_200/__init__.py b/pynitrokey/nethsm/client/paths/health_alive/get/responses/response_200/__init__.py deleted file mode 100644 index fc4b07d0..00000000 --- a/pynitrokey/nethsm/client/paths/health_alive/get/responses/response_200/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor200(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/health_alive/get/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/health_alive/get/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/health_alive/get/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/health_alive/get/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/health_alive/get/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/health_alive/get/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/health_ready/__init__.py b/pynitrokey/nethsm/client/paths/health_ready/__init__.py deleted file mode 100644 index 203b1df0..00000000 --- a/pynitrokey/nethsm/client/paths/health_ready/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.health_ready import HealthReady - -path = "/health/ready" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/health_ready/get/__init__.py b/pynitrokey/nethsm/client/paths/health_ready/get/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/health_ready/get/operation.py b/pynitrokey/nethsm/client/paths/health_ready/get/operation.py deleted file mode 100644 index e4a32143..00000000 --- a/pynitrokey/nethsm/client/paths/health_ready/get/operation.py +++ /dev/null @@ -1,131 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .. import path -from .responses import ( - response_200, - response_406, - response_412, -) - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '200': typing.Type[response_200.ResponseFor200], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '200': response_200.ResponseFor200, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '200', -}) -_error_status_codes = frozenset({ - '406', - '412', -}) - - -class BaseApi(api_client.Api): - @typing.overload - def _health_ready_get( - self, - *, - skip_deserialization: typing.Literal[False] = False, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_200.ApiResponse: ... - - @typing.overload - def _health_ready_get( - self, - *, - skip_deserialization: typing.Literal[True], - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _health_ready_get( - self, - *, - skip_deserialization: bool = False, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path - # TODO add cookie handling - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='get', - host=host, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '200', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class HealthReadyGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - health_ready_get = BaseApi._health_ready_get - - -class ApiForGet(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - get = BaseApi._health_ready_get diff --git a/pynitrokey/nethsm/client/paths/health_ready/get/responses/__init__.py b/pynitrokey/nethsm/client/paths/health_ready/get/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/health_ready/get/responses/response_200/__init__.py b/pynitrokey/nethsm/client/paths/health_ready/get/responses/response_200/__init__.py deleted file mode 100644 index fc4b07d0..00000000 --- a/pynitrokey/nethsm/client/paths/health_ready/get/responses/response_200/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor200(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/health_ready/get/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/health_ready/get/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/health_ready/get/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/health_ready/get/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/health_ready/get/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/health_ready/get/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/health_state/__init__.py b/pynitrokey/nethsm/client/paths/health_state/__init__.py deleted file mode 100644 index c3bab0d7..00000000 --- a/pynitrokey/nethsm/client/paths/health_state/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.health_state import HealthState - -path = "/health/state" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/health_state/get/__init__.py b/pynitrokey/nethsm/client/paths/health_state/get/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/health_state/get/operation.py b/pynitrokey/nethsm/client/paths/health_state/get/operation.py deleted file mode 100644 index 0323e662..00000000 --- a/pynitrokey/nethsm/client/paths/health_state/get/operation.py +++ /dev/null @@ -1,135 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .. import path -from .responses import ( - response_200, - response_406, -) - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '200': typing.Type[response_200.ResponseFor200], - '406': typing.Type[response_406.ResponseFor406], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '200': response_200.ResponseFor200, - '406': response_406.ResponseFor406, -} -_non_error_status_codes = frozenset({ - '200', -}) -_error_status_codes = frozenset({ - '406', -}) - -_all_accept_content_types = ( - "application/json", -) - - -class BaseApi(api_client.Api): - @typing.overload - def _health_state_get( - self, - *, - skip_deserialization: typing.Literal[False] = False, - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_200.ApiResponse: ... - - @typing.overload - def _health_state_get( - self, - *, - skip_deserialization: typing.Literal[True], - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _health_state_get( - self, - *, - skip_deserialization: bool = False, - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path - headers = self._get_headers(accept_content_types=accept_content_types) - # TODO add cookie handling - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='get', - host=host, - headers=headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '200', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '406', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class HealthStateGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - health_state_get = BaseApi._health_state_get - - -class ApiForGet(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - get = BaseApi._health_state_get diff --git a/pynitrokey/nethsm/client/paths/health_state/get/responses/__init__.py b/pynitrokey/nethsm/client/paths/health_state/get/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/health_state/get/responses/response_200/__init__.py b/pynitrokey/nethsm/client/paths/health_state/get/responses/response_200/__init__.py deleted file mode 100644 index 02f53751..00000000 --- a/pynitrokey/nethsm/client/paths/health_state/get/responses/response_200/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: application_json_schema.health_state_data.HealthStateDataDict - headers: schemas.Unset = schemas.unset - - -class ResponseFor200(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } diff --git a/pynitrokey/nethsm/client/paths/health_state/get/responses/response_200/content/__init__.py b/pynitrokey/nethsm/client/paths/health_state/get/responses/response_200/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/health_state/get/responses/response_200/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/health_state/get/responses/response_200/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/health_state/get/responses/response_200/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/health_state/get/responses/response_200/content/application_json/schema.py deleted file mode 100644 index 048a9d1a..00000000 --- a/pynitrokey/nethsm/client/paths/health_state/get/responses/response_200/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import health_state_data -Schema: typing_extensions.TypeAlias = health_state_data.HealthStateData diff --git a/pynitrokey/nethsm/client/paths/health_state/get/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/health_state/get/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/health_state/get/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/info/__init__.py b/pynitrokey/nethsm/client/paths/info/__init__.py deleted file mode 100644 index 21e25480..00000000 --- a/pynitrokey/nethsm/client/paths/info/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.info import Info - -path = "/info" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/info/get/__init__.py b/pynitrokey/nethsm/client/paths/info/get/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/info/get/operation.py b/pynitrokey/nethsm/client/paths/info/get/operation.py deleted file mode 100644 index 96a9bf66..00000000 --- a/pynitrokey/nethsm/client/paths/info/get/operation.py +++ /dev/null @@ -1,135 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .. import path -from .responses import ( - response_200, - response_406, -) - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '200': typing.Type[response_200.ResponseFor200], - '406': typing.Type[response_406.ResponseFor406], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '200': response_200.ResponseFor200, - '406': response_406.ResponseFor406, -} -_non_error_status_codes = frozenset({ - '200', -}) -_error_status_codes = frozenset({ - '406', -}) - -_all_accept_content_types = ( - "application/json", -) - - -class BaseApi(api_client.Api): - @typing.overload - def _info_get( - self, - *, - skip_deserialization: typing.Literal[False] = False, - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_200.ApiResponse: ... - - @typing.overload - def _info_get( - self, - *, - skip_deserialization: typing.Literal[True], - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _info_get( - self, - *, - skip_deserialization: bool = False, - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path - headers = self._get_headers(accept_content_types=accept_content_types) - # TODO add cookie handling - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='get', - host=host, - headers=headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '200', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '406', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class InfoGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - info_get = BaseApi._info_get - - -class ApiForGet(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - get = BaseApi._info_get diff --git a/pynitrokey/nethsm/client/paths/info/get/responses/__init__.py b/pynitrokey/nethsm/client/paths/info/get/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/info/get/responses/response_200/__init__.py b/pynitrokey/nethsm/client/paths/info/get/responses/response_200/__init__.py deleted file mode 100644 index 63d01f0b..00000000 --- a/pynitrokey/nethsm/client/paths/info/get/responses/response_200/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: application_json_schema.info_data.InfoDataDict - headers: schemas.Unset = schemas.unset - - -class ResponseFor200(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } diff --git a/pynitrokey/nethsm/client/paths/info/get/responses/response_200/content/__init__.py b/pynitrokey/nethsm/client/paths/info/get/responses/response_200/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/info/get/responses/response_200/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/info/get/responses/response_200/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/info/get/responses/response_200/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/info/get/responses/response_200/content/application_json/schema.py deleted file mode 100644 index abd03b50..00000000 --- a/pynitrokey/nethsm/client/paths/info/get/responses/response_200/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import info_data -Schema: typing_extensions.TypeAlias = info_data.InfoData diff --git a/pynitrokey/nethsm/client/paths/info/get/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/info/get/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/info/get/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys/__init__.py b/pynitrokey/nethsm/client/paths/keys/__init__.py deleted file mode 100644 index 9df13430..00000000 --- a/pynitrokey/nethsm/client/paths/keys/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.keys import Keys - -path = "/keys" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/keys/get/__init__.py b/pynitrokey/nethsm/client/paths/keys/get/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys/get/operation.py b/pynitrokey/nethsm/client/paths/keys/get/operation.py deleted file mode 100644 index ad5ea4ed..00000000 --- a/pynitrokey/nethsm/client/paths/keys/get/operation.py +++ /dev/null @@ -1,192 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .. import path -from .responses import ( - response_200, - response_401, - response_403, - response_406, - response_412, -) -from .parameters import parameter_0 -from .security import security_requirement_object_0 -from .query_parameters import QueryParameters, QueryParametersDictInput, QueryParametersDict -query_parameter_classes = ( - parameter_0.Parameter0, -) - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '200': typing.Type[response_200.ResponseFor200], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '200': response_200.ResponseFor200, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '200', -}) -_error_status_codes = frozenset({ - '401', - '403', - '406', - '412', -}) - -_all_accept_content_types = ( - "application/json", -) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_get( - self, - query_params: typing.Union[ - QueryParametersDictInput, - QueryParametersDict, - None - ] = None, - *, - skip_deserialization: typing.Literal[False] = False, - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_200.ApiResponse: ... - - @typing.overload - def _keys_get( - self, - query_params: typing.Union[ - QueryParametersDictInput, - QueryParametersDict, - None - ] = None, - *, - skip_deserialization: typing.Literal[True], - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _keys_get( - self, - query_params: typing.Union[ - QueryParametersDictInput, - QueryParametersDict, - None - ] = None, - *, - skip_deserialization: bool = False, - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - if query_params is not None: - query_params = QueryParameters.validate(query_params) - used_path, query_params_suffix = self._get_used_path( - path, - query_parameters=query_parameter_classes, - query_params=query_params, - skip_validation=True - ) - headers = self._get_headers(accept_content_types=accept_content_types) - # TODO add cookie handling - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//keys/get/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - query_params_suffix=query_params_suffix, - method='get', - host=host, - headers=headers, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '200', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '401', - '403', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class KeysGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - keys_get = BaseApi._keys_get - - -class ApiForGet(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - get = BaseApi._keys_get diff --git a/pynitrokey/nethsm/client/paths/keys/get/parameters/__init__.py b/pynitrokey/nethsm/client/paths/keys/get/parameters/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys/get/parameters/parameter_0/__init__.py b/pynitrokey/nethsm/client/paths/keys/get/parameters/parameter_0/__init__.py deleted file mode 100644 index e863149d..00000000 --- a/pynitrokey/nethsm/client/paths/keys/get/parameters/parameter_0/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from . import schema - - -class Parameter0(api_client.QueryParameter): - name = "filter" - style = api_client.ParameterStyle.FORM - schema: typing_extensions.TypeAlias = schema.Schema - explode = True diff --git a/pynitrokey/nethsm/client/paths/keys/get/parameters/parameter_0/schema.py b/pynitrokey/nethsm/client/paths/keys/get/parameters/parameter_0/schema.py deleted file mode 100644 index 951e9038..00000000 --- a/pynitrokey/nethsm/client/paths/keys/get/parameters/parameter_0/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -Schema: typing_extensions.TypeAlias = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/paths/keys/get/query_parameters.py b/pynitrokey/nethsm/client/paths/keys/get/query_parameters.py deleted file mode 100644 index 0d209476..00000000 --- a/pynitrokey/nethsm/client/paths/keys/get/query_parameters.py +++ /dev/null @@ -1,108 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema - -from pynitrokey.nethsm.client.paths.keys.get.parameters.parameter_0 import schema -Properties = typing.TypedDict( - 'Properties', - { - "filter": typing.Type[schema.Schema], - } -) - - -class QueryParametersDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - - __required_keys__: typing.FrozenSet[str] = frozenset({ - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - "filter", - }) - - def __new__( - cls, - *, - filter: typing.Union[ - str, - schemas.Unset - ] = schemas.unset, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - ): - arg_: typing.Dict[str, typing.Any] = {} - for key, val in ( - ("filter", filter), - ): - if isinstance(val, schemas.Unset): - continue - arg_[key] = val - used_arg_ = typing.cast(QueryParametersDictInput, arg_) - return QueryParameters.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - QueryParametersDictInput, - QueryParametersDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> QueryParametersDict: - return QueryParameters.validate(arg, configuration=configuration) - - @property - def filter(self) -> typing.Union[str, schemas.Unset]: - val = self.get("filter", schemas.unset) - if isinstance(val, schemas.Unset): - return val - return typing.cast( - str, - val - ) -QueryParametersDictInput = typing.TypedDict( - 'QueryParametersDictInput', - { - "filter": str, - }, - total=False -) - - -@dataclasses.dataclass(frozen=True) -class QueryParameters( - schemas.Schema[QueryParametersDict, tuple] -): - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - additional_properties: typing.Type[AdditionalProperties] = dataclasses.field(default_factory=lambda: AdditionalProperties) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: QueryParametersDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - QueryParametersDictInput, - QueryParametersDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> QueryParametersDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/paths/keys/get/responses/__init__.py b/pynitrokey/nethsm/client/paths/keys/get/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys/get/responses/response_200/__init__.py b/pynitrokey/nethsm/client/paths/keys/get/responses/response_200/__init__.py deleted file mode 100644 index 9c753110..00000000 --- a/pynitrokey/nethsm/client/paths/keys/get/responses/response_200/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: application_json_schema.key_list.KeyListTuple - headers: schemas.Unset = schemas.unset - - -class ResponseFor200(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } diff --git a/pynitrokey/nethsm/client/paths/keys/get/responses/response_200/content/__init__.py b/pynitrokey/nethsm/client/paths/keys/get/responses/response_200/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys/get/responses/response_200/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/keys/get/responses/response_200/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys/get/responses/response_200/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/keys/get/responses/response_200/content/application_json/schema.py deleted file mode 100644 index cc33ee29..00000000 --- a/pynitrokey/nethsm/client/paths/keys/get/responses/response_200/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import key_list -Schema: typing_extensions.TypeAlias = key_list.KeyList diff --git a/pynitrokey/nethsm/client/paths/keys/get/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/keys/get/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/keys/get/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys/get/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/keys/get/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/keys/get/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys/get/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/keys/get/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/keys/get/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys/get/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/keys/get/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/keys/get/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys/get/security/__init__.py b/pynitrokey/nethsm/client/paths/keys/get/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys/get/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/keys/get/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/keys/get/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/keys/post/__init__.py b/pynitrokey/nethsm/client/paths/keys/post/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys/post/operation.py b/pynitrokey/nethsm/client/paths/keys/post/operation.py deleted file mode 100644 index 66a0b2ad..00000000 --- a/pynitrokey/nethsm/client/paths/keys/post/operation.py +++ /dev/null @@ -1,263 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import pem_private_key -from pynitrokey.nethsm.client.components.schema import private_key - -from .. import path -from .responses import ( - response_201, - response_400, - response_401, - response_403, - response_406, - response_412, -) -from . import request_body -from .parameters import ( - parameter_0, - parameter_1, -) -from .security import security_requirement_object_0 -from .query_parameters import QueryParameters, QueryParametersDictInput, QueryParametersDict -query_parameter_classes = ( - parameter_0.Parameter0, - parameter_1.Parameter1, -) - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '201': typing.Type[response_201.ResponseFor201], - '400': typing.Type[response_400.ResponseFor400], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '201': response_201.ResponseFor201, - '400': response_400.ResponseFor400, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '201', -}) -_error_status_codes = frozenset({ - '400', - '401', - '403', - '406', - '412', -}) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_post( - self, - body: typing.Union[ - private_key.PrivateKeyDictInput, - private_key.PrivateKeyDict, - ], - query_params: typing.Union[ - QueryParametersDictInput, - QueryParametersDict, - None - ] = None, - *, - skip_deserialization: typing.Literal[False] = False, - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_201.ApiResponse: ... - - @typing.overload - def _keys_post( - self, - body: typing.Union[ - private_key.PrivateKeyDictInput, - private_key.PrivateKeyDict, - ], - query_params: typing.Union[ - QueryParametersDictInput, - QueryParametersDict, - None - ] = None, - *, - skip_deserialization: typing.Literal[True], - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _keys_post( - self, - body: str, - query_params: typing.Union[ - QueryParametersDictInput, - QueryParametersDict, - None - ] = None, - *, - skip_deserialization: typing.Literal[False] = False, - content_type: typing.Literal["application/x-pem-file"], - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_201.ApiResponse: ... - - @typing.overload - def _keys_post( - self, - body: str, - query_params: typing.Union[ - QueryParametersDictInput, - QueryParametersDict, - None - ] = None, - *, - skip_deserialization: typing.Literal[True], - content_type: typing.Literal["application/x-pem-file"], - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _keys_post( - self, - body: typing.Union[ - typing.Union[ - private_key.PrivateKeyDictInput, - private_key.PrivateKeyDict, - ], - str, - ], - query_params: typing.Union[ - QueryParametersDictInput, - QueryParametersDict, - None - ] = None, - *, - skip_deserialization: bool = False, - content_type: typing.Literal[ - "application/json", - "application/x-pem-file", - ] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - if query_params is not None: - query_params = QueryParameters.validate(query_params) - used_path, query_params_suffix = self._get_used_path( - path, - query_parameters=query_parameter_classes, - query_params=query_params, - skip_validation=True - ) - headers = self._get_headers() - # TODO add cookie handling - - fields, serialized_body = self._get_fields_and_body( - request_body=request_body.RequestBody, - body=body, - content_type=content_type, - headers=headers - ) - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//keys/post/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - query_params_suffix=query_params_suffix, - method='post', - host=host, - headers=headers, - fields=fields, - body=serialized_body, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '201', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '400', - '401', - '403', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class KeysPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - keys_post = BaseApi._keys_post - - -class ApiForPost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - post = BaseApi._keys_post diff --git a/pynitrokey/nethsm/client/paths/keys/post/parameters/__init__.py b/pynitrokey/nethsm/client/paths/keys/post/parameters/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys/post/parameters/parameter_0/__init__.py b/pynitrokey/nethsm/client/paths/keys/post/parameters/parameter_0/__init__.py deleted file mode 100644 index ba13e66e..00000000 --- a/pynitrokey/nethsm/client/paths/keys/post/parameters/parameter_0/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from . import schema - - -class Parameter0(api_client.QueryParameter): - name = "mechanisms" - style = api_client.ParameterStyle.FORM - schema: typing_extensions.TypeAlias = schema.Schema - explode = True diff --git a/pynitrokey/nethsm/client/paths/keys/post/parameters/parameter_0/schema.py b/pynitrokey/nethsm/client/paths/keys/post/parameters/parameter_0/schema.py deleted file mode 100644 index 90e13d89..00000000 --- a/pynitrokey/nethsm/client/paths/keys/post/parameters/parameter_0/schema.py +++ /dev/null @@ -1,104 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -from pynitrokey.nethsm.client.components.schema import key_mechanism - - -class SchemaTuple( - typing.Tuple[ - typing.Literal["RSA_Decryption_RAW", "RSA_Decryption_PKCS1", "RSA_Decryption_OAEP_MD5", "RSA_Decryption_OAEP_SHA1", "RSA_Decryption_OAEP_SHA224", "RSA_Decryption_OAEP_SHA256", "RSA_Decryption_OAEP_SHA384", "RSA_Decryption_OAEP_SHA512", "RSA_Signature_PKCS1", "RSA_Signature_PSS_MD5", "RSA_Signature_PSS_SHA1", "RSA_Signature_PSS_SHA224", "RSA_Signature_PSS_SHA256", "RSA_Signature_PSS_SHA384", "RSA_Signature_PSS_SHA512", "EdDSA_Signature", "ECDSA_Signature", "AES_Encryption_CBC", "AES_Decryption_CBC"], - ... - ] -): - - def __new__(cls, arg: typing.Union[SchemaTupleInput, SchemaTuple], configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None): - return Schema.validate(arg, configuration=configuration) -SchemaTupleInput = typing.Union[ - typing.List[ - typing.Literal[ - "RSA_Decryption_RAW", - "RSA_Decryption_PKCS1", - "RSA_Decryption_OAEP_MD5", - "RSA_Decryption_OAEP_SHA1", - "RSA_Decryption_OAEP_SHA224", - "RSA_Decryption_OAEP_SHA256", - "RSA_Decryption_OAEP_SHA384", - "RSA_Decryption_OAEP_SHA512", - "RSA_Signature_PKCS1", - "RSA_Signature_PSS_MD5", - "RSA_Signature_PSS_SHA1", - "RSA_Signature_PSS_SHA224", - "RSA_Signature_PSS_SHA256", - "RSA_Signature_PSS_SHA384", - "RSA_Signature_PSS_SHA512", - "EdDSA_Signature", - "ECDSA_Signature", - "AES_Encryption_CBC", - "AES_Decryption_CBC" - ], - ], - typing.Tuple[ - typing.Literal[ - "RSA_Decryption_RAW", - "RSA_Decryption_PKCS1", - "RSA_Decryption_OAEP_MD5", - "RSA_Decryption_OAEP_SHA1", - "RSA_Decryption_OAEP_SHA224", - "RSA_Decryption_OAEP_SHA256", - "RSA_Decryption_OAEP_SHA384", - "RSA_Decryption_OAEP_SHA512", - "RSA_Signature_PKCS1", - "RSA_Signature_PSS_MD5", - "RSA_Signature_PSS_SHA1", - "RSA_Signature_PSS_SHA224", - "RSA_Signature_PSS_SHA256", - "RSA_Signature_PSS_SHA384", - "RSA_Signature_PSS_SHA512", - "EdDSA_Signature", - "ECDSA_Signature", - "AES_Encryption_CBC", - "AES_Decryption_CBC" - ], - ... - ] -] - - -@dataclasses.dataclass(frozen=True) -class Schema( - schemas.Schema[schemas.immutabledict, SchemaTuple] -): - types: typing.FrozenSet[typing.Type] = frozenset({tuple}) - items: typing.Type[key_mechanism.KeyMechanism] = dataclasses.field(default_factory=lambda: key_mechanism.KeyMechanism) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - tuple: SchemaTuple - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - SchemaTupleInput, - SchemaTuple, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> SchemaTuple: - return super().validate_base( - arg, - configuration=configuration, - ) diff --git a/pynitrokey/nethsm/client/paths/keys/post/parameters/parameter_1/__init__.py b/pynitrokey/nethsm/client/paths/keys/post/parameters/parameter_1/__init__.py deleted file mode 100644 index 5280c5a3..00000000 --- a/pynitrokey/nethsm/client/paths/keys/post/parameters/parameter_1/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from . import schema - - -class Parameter1(api_client.QueryParameter): - name = "tags" - style = api_client.ParameterStyle.FORM - schema: typing_extensions.TypeAlias = schema.Schema - explode = True diff --git a/pynitrokey/nethsm/client/paths/keys/post/parameters/parameter_1/schema.py b/pynitrokey/nethsm/client/paths/keys/post/parameters/parameter_1/schema.py deleted file mode 100644 index 215befe9..00000000 --- a/pynitrokey/nethsm/client/paths/keys/post/parameters/parameter_1/schema.py +++ /dev/null @@ -1,64 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -from pynitrokey.nethsm.client.components.schema import id - - -class SchemaTuple( - typing.Tuple[ - str, - ... - ] -): - - def __new__(cls, arg: typing.Union[SchemaTupleInput, SchemaTuple], configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None): - return Schema.validate(arg, configuration=configuration) -SchemaTupleInput = typing.Union[ - typing.List[ - str, - ], - typing.Tuple[ - str, - ... - ] -] - - -@dataclasses.dataclass(frozen=True) -class Schema( - schemas.Schema[schemas.immutabledict, SchemaTuple] -): - types: typing.FrozenSet[typing.Type] = frozenset({tuple}) - items: typing.Type[id.ID] = dataclasses.field(default_factory=lambda: id.ID) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - tuple: SchemaTuple - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - SchemaTupleInput, - SchemaTuple, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> SchemaTuple: - return super().validate_base( - arg, - configuration=configuration, - ) diff --git a/pynitrokey/nethsm/client/paths/keys/post/query_parameters.py b/pynitrokey/nethsm/client/paths/keys/post/query_parameters.py deleted file mode 100644 index 78bb16c3..00000000 --- a/pynitrokey/nethsm/client/paths/keys/post/query_parameters.py +++ /dev/null @@ -1,134 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema - -from pynitrokey.nethsm.client.paths.keys.post.parameters.parameter_0 import schema -from pynitrokey.nethsm.client.paths.keys.post.parameters.parameter_1 import schema as schema_2 -Properties = typing.TypedDict( - 'Properties', - { - "mechanisms": typing.Type[schema.Schema], - "tags": typing.Type[schema_2.Schema], - } -) - - -class QueryParametersDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - __required_keys__: typing.FrozenSet[str] = frozenset({ - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - "mechanisms", - "tags", - }) - - def __new__( - cls, - *, - mechanisms: typing.Union[ - schema.SchemaTupleInput, - schema.SchemaTuple, - schemas.Unset - ] = schemas.unset, - tags: typing.Union[ - schema_2.SchemaTupleInput, - schema_2.SchemaTuple, - schemas.Unset - ] = schemas.unset, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - ): - arg_: typing.Dict[str, typing.Any] = {} - for key, val in ( - ("mechanisms", mechanisms), - ("tags", tags), - ): - if isinstance(val, schemas.Unset): - continue - arg_[key] = val - used_arg_ = typing.cast(QueryParametersDictInput, arg_) - return QueryParameters.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - QueryParametersDictInput, - QueryParametersDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> QueryParametersDict: - return QueryParameters.validate(arg, configuration=configuration) - - @property - def mechanisms(self) -> typing.Union[schema.SchemaTuple, schemas.Unset]: - val = self.get("mechanisms", schemas.unset) - if isinstance(val, schemas.Unset): - return val - return typing.cast( - schema.SchemaTuple, - val - ) - - @property - def tags(self) -> typing.Union[schema_2.SchemaTuple, schemas.Unset]: - val = self.get("tags", schemas.unset) - if isinstance(val, schemas.Unset): - return val - return typing.cast( - schema_2.SchemaTuple, - val - ) -QueryParametersDictInput = typing.TypedDict( - 'QueryParametersDictInput', - { - "mechanisms": typing.Union[ - schema.SchemaTupleInput, - schema.SchemaTuple - ], - "tags": typing.Union[ - schema_2.SchemaTupleInput, - schema_2.SchemaTuple - ], - }, - total=False -) - - -@dataclasses.dataclass(frozen=True) -class QueryParameters( - schemas.Schema[QueryParametersDict, tuple] -): - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - additional_properties: typing.Type[AdditionalProperties] = dataclasses.field(default_factory=lambda: AdditionalProperties) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: QueryParametersDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - QueryParametersDictInput, - QueryParametersDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> QueryParametersDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/paths/keys/post/request_body/__init__.py b/pynitrokey/nethsm/client/paths/keys/post/request_body/__init__.py deleted file mode 100644 index 9fa09553..00000000 --- a/pynitrokey/nethsm/client/paths/keys/post/request_body/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema -from .content.application_x_pem_file import schema as application_x_pem_file_schema - - -class RequestBody(api_client.RequestBody): - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - - - class ApplicationXPemFileMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_x_pem_file_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - 'application/x-pem-file': ApplicationXPemFileMediaType, - } - required = True diff --git a/pynitrokey/nethsm/client/paths/keys/post/request_body/content/__init__.py b/pynitrokey/nethsm/client/paths/keys/post/request_body/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys/post/request_body/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/keys/post/request_body/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys/post/request_body/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/keys/post/request_body/content/application_json/schema.py deleted file mode 100644 index 1e7efb0a..00000000 --- a/pynitrokey/nethsm/client/paths/keys/post/request_body/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import private_key -Schema: typing_extensions.TypeAlias = private_key.PrivateKey diff --git a/pynitrokey/nethsm/client/paths/keys/post/request_body/content/application_x_pem_file/__init__.py b/pynitrokey/nethsm/client/paths/keys/post/request_body/content/application_x_pem_file/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys/post/request_body/content/application_x_pem_file/schema.py b/pynitrokey/nethsm/client/paths/keys/post/request_body/content/application_x_pem_file/schema.py deleted file mode 100644 index 00854d77..00000000 --- a/pynitrokey/nethsm/client/paths/keys/post/request_body/content/application_x_pem_file/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import pem_private_key -Schema: typing_extensions.TypeAlias = pem_private_key.PemPrivateKey diff --git a/pynitrokey/nethsm/client/paths/keys/post/responses/__init__.py b/pynitrokey/nethsm/client/paths/keys/post/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys/post/responses/response_201/__init__.py b/pynitrokey/nethsm/client/paths/keys/post/responses/response_201/__init__.py deleted file mode 100644 index 18d9e496..00000000 --- a/pynitrokey/nethsm/client/paths/keys/post/responses/response_201/__init__.py +++ /dev/null @@ -1,28 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .headers import header_location -from . import header_parameters -parameters: typing.Dict[str, typing.Type[api_client.HeaderParameterWithoutName]] = { - 'location': header_location.Location, -} - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - headers: header_parameters.HeadersDict - body: schemas.Unset = schemas.unset - - -class ResponseFor201(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) - headers=parameters - headers_schema = header_parameters.Headers diff --git a/pynitrokey/nethsm/client/paths/keys/post/responses/response_201/header_parameters.py b/pynitrokey/nethsm/client/paths/keys/post/responses/response_201/header_parameters.py deleted file mode 100644 index 8d0c98c1..00000000 --- a/pynitrokey/nethsm/client/paths/keys/post/responses/response_201/header_parameters.py +++ /dev/null @@ -1,108 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema - -from pynitrokey.nethsm.client.paths.keys.post.responses.response_201.headers.header_location import schema -Properties = typing.TypedDict( - 'Properties', - { - "location": typing.Type[schema.Schema], - } -) - - -class HeadersDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - - __required_keys__: typing.FrozenSet[str] = frozenset({ - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - "location", - }) - - def __new__( - cls, - *, - location: typing.Union[ - str, - schemas.Unset - ] = schemas.unset, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - ): - arg_: typing.Dict[str, typing.Any] = {} - for key, val in ( - ("location", location), - ): - if isinstance(val, schemas.Unset): - continue - arg_[key] = val - used_arg_ = typing.cast(HeadersDictInput, arg_) - return Headers.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - HeadersDictInput, - HeadersDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> HeadersDict: - return Headers.validate(arg, configuration=configuration) - - @property - def location(self) -> typing.Union[str, schemas.Unset]: - val = self.get("location", schemas.unset) - if isinstance(val, schemas.Unset): - return val - return typing.cast( - str, - val - ) -HeadersDictInput = typing.TypedDict( - 'HeadersDictInput', - { - "location": str, - }, - total=False -) - - -@dataclasses.dataclass(frozen=True) -class Headers( - schemas.Schema[HeadersDict, tuple] -): - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - additional_properties: typing.Type[AdditionalProperties] = dataclasses.field(default_factory=lambda: AdditionalProperties) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: HeadersDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - HeadersDictInput, - HeadersDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> HeadersDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/paths/keys/post/responses/response_201/headers/__init__.py b/pynitrokey/nethsm/client/paths/keys/post/responses/response_201/headers/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys/post/responses/response_201/headers/header_location/__init__.py b/pynitrokey/nethsm/client/paths/keys/post/responses/response_201/headers/header_location/__init__.py deleted file mode 100644 index 46bc76aa..00000000 --- a/pynitrokey/nethsm/client/paths/keys/post/responses/response_201/headers/header_location/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from . import schema - - -class Location(api_client.HeaderParameterWithoutName): - style = api_client.ParameterStyle.SIMPLE - schema: typing_extensions.TypeAlias = schema.Schema diff --git a/pynitrokey/nethsm/client/paths/keys/post/responses/response_201/headers/header_location/schema.py b/pynitrokey/nethsm/client/paths/keys/post/responses/response_201/headers/header_location/schema.py deleted file mode 100644 index 951e9038..00000000 --- a/pynitrokey/nethsm/client/paths/keys/post/responses/response_201/headers/header_location/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -Schema: typing_extensions.TypeAlias = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/paths/keys/post/responses/response_400/__init__.py b/pynitrokey/nethsm/client/paths/keys/post/responses/response_400/__init__.py deleted file mode 100644 index 0458793b..00000000 --- a/pynitrokey/nethsm/client/paths/keys/post/responses/response_400/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor400(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys/post/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/keys/post/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/keys/post/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys/post/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/keys/post/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/keys/post/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys/post/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/keys/post/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/keys/post/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys/post/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/keys/post/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/keys/post/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys/post/security/__init__.py b/pynitrokey/nethsm/client/paths/keys/post/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys/post/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/keys/post/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/keys/post/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/keys_generate/__init__.py b/pynitrokey/nethsm/client/paths/keys_generate/__init__.py deleted file mode 100644 index b301713a..00000000 --- a/pynitrokey/nethsm/client/paths/keys_generate/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.keys_generate import KeysGenerate - -path = "/keys/generate" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/keys_generate/post/__init__.py b/pynitrokey/nethsm/client/paths/keys_generate/post/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_generate/post/operation.py b/pynitrokey/nethsm/client/paths/keys_generate/post/operation.py deleted file mode 100644 index 8df778e4..00000000 --- a/pynitrokey/nethsm/client/paths/keys_generate/post/operation.py +++ /dev/null @@ -1,188 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import key_generate_request_data - -from .. import path -from .responses import ( - response_201, - response_400, - response_401, - response_403, - response_406, - response_412, -) -from . import request_body -from .security import security_requirement_object_0 - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '201': typing.Type[response_201.ResponseFor201], - '400': typing.Type[response_400.ResponseFor400], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '201': response_201.ResponseFor201, - '400': response_400.ResponseFor400, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '201', -}) -_error_status_codes = frozenset({ - '400', - '401', - '403', - '406', - '412', -}) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_generate_post( - self, - body: typing.Union[ - key_generate_request_data.KeyGenerateRequestDataDictInput, - key_generate_request_data.KeyGenerateRequestDataDict, - ], - *, - skip_deserialization: typing.Literal[False] = False, - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_201.ApiResponse: ... - - @typing.overload - def _keys_generate_post( - self, - body: typing.Union[ - key_generate_request_data.KeyGenerateRequestDataDictInput, - key_generate_request_data.KeyGenerateRequestDataDict, - ], - *, - skip_deserialization: typing.Literal[True], - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _keys_generate_post( - self, - body: typing.Union[ - key_generate_request_data.KeyGenerateRequestDataDictInput, - key_generate_request_data.KeyGenerateRequestDataDict, - ], - *, - skip_deserialization: bool = False, - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path - headers = self._get_headers() - # TODO add cookie handling - - fields, serialized_body = self._get_fields_and_body( - request_body=request_body.RequestBody, - body=body, - content_type=content_type, - headers=headers - ) - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//keys/generate/post/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='post', - host=host, - headers=headers, - fields=fields, - body=serialized_body, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '201', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '400', - '401', - '403', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class KeysGeneratePost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - keys_generate_post = BaseApi._keys_generate_post - - -class ApiForPost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - post = BaseApi._keys_generate_post diff --git a/pynitrokey/nethsm/client/paths/keys_generate/post/request_body/__init__.py b/pynitrokey/nethsm/client/paths/keys_generate/post/request_body/__init__.py deleted file mode 100644 index ad29c4a8..00000000 --- a/pynitrokey/nethsm/client/paths/keys_generate/post/request_body/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -class RequestBody(api_client.RequestBody): - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } - required = True diff --git a/pynitrokey/nethsm/client/paths/keys_generate/post/request_body/content/__init__.py b/pynitrokey/nethsm/client/paths/keys_generate/post/request_body/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_generate/post/request_body/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/keys_generate/post/request_body/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_generate/post/request_body/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/keys_generate/post/request_body/content/application_json/schema.py deleted file mode 100644 index a7fcd449..00000000 --- a/pynitrokey/nethsm/client/paths/keys_generate/post/request_body/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import key_generate_request_data -Schema: typing_extensions.TypeAlias = key_generate_request_data.KeyGenerateRequestData diff --git a/pynitrokey/nethsm/client/paths/keys_generate/post/responses/__init__.py b/pynitrokey/nethsm/client/paths/keys_generate/post/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_201/__init__.py b/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_201/__init__.py deleted file mode 100644 index 18d9e496..00000000 --- a/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_201/__init__.py +++ /dev/null @@ -1,28 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .headers import header_location -from . import header_parameters -parameters: typing.Dict[str, typing.Type[api_client.HeaderParameterWithoutName]] = { - 'location': header_location.Location, -} - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - headers: header_parameters.HeadersDict - body: schemas.Unset = schemas.unset - - -class ResponseFor201(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) - headers=parameters - headers_schema = header_parameters.Headers diff --git a/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_201/header_parameters.py b/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_201/header_parameters.py deleted file mode 100644 index aacfc2ab..00000000 --- a/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_201/header_parameters.py +++ /dev/null @@ -1,108 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema - -from pynitrokey.nethsm.client.paths.keys_generate.post.responses.response_201.headers.header_location import schema -Properties = typing.TypedDict( - 'Properties', - { - "location": typing.Type[schema.Schema], - } -) - - -class HeadersDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - - __required_keys__: typing.FrozenSet[str] = frozenset({ - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - "location", - }) - - def __new__( - cls, - *, - location: typing.Union[ - str, - schemas.Unset - ] = schemas.unset, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - ): - arg_: typing.Dict[str, typing.Any] = {} - for key, val in ( - ("location", location), - ): - if isinstance(val, schemas.Unset): - continue - arg_[key] = val - used_arg_ = typing.cast(HeadersDictInput, arg_) - return Headers.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - HeadersDictInput, - HeadersDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> HeadersDict: - return Headers.validate(arg, configuration=configuration) - - @property - def location(self) -> typing.Union[str, schemas.Unset]: - val = self.get("location", schemas.unset) - if isinstance(val, schemas.Unset): - return val - return typing.cast( - str, - val - ) -HeadersDictInput = typing.TypedDict( - 'HeadersDictInput', - { - "location": str, - }, - total=False -) - - -@dataclasses.dataclass(frozen=True) -class Headers( - schemas.Schema[HeadersDict, tuple] -): - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - additional_properties: typing.Type[AdditionalProperties] = dataclasses.field(default_factory=lambda: AdditionalProperties) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: HeadersDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - HeadersDictInput, - HeadersDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> HeadersDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_201/headers/__init__.py b/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_201/headers/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_201/headers/header_location/__init__.py b/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_201/headers/header_location/__init__.py deleted file mode 100644 index 46bc76aa..00000000 --- a/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_201/headers/header_location/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from . import schema - - -class Location(api_client.HeaderParameterWithoutName): - style = api_client.ParameterStyle.SIMPLE - schema: typing_extensions.TypeAlias = schema.Schema diff --git a/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_201/headers/header_location/schema.py b/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_201/headers/header_location/schema.py deleted file mode 100644 index 951e9038..00000000 --- a/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_201/headers/header_location/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -Schema: typing_extensions.TypeAlias = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_400/__init__.py b/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_400/__init__.py deleted file mode 100644 index 0458793b..00000000 --- a/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_400/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor400(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_generate/post/security/__init__.py b/pynitrokey/nethsm/client/paths/keys_generate/post/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_generate/post/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/keys_generate/post/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/keys_generate/post/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/__init__.py deleted file mode 100644 index cda9fffd..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.keys_key_id import KeysKeyID - -path = "/keys/{KeyID}" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/delete/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/delete/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/delete/operation.py b/pynitrokey/nethsm/client/paths/keys_key_id/delete/operation.py deleted file mode 100644 index 44b913a7..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/delete/operation.py +++ /dev/null @@ -1,183 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .. import path -from .responses import ( - response_204, - response_401, - response_403, - response_404, - response_406, - response_412, -) -from .parameters import parameter_0 -from .security import security_requirement_object_0 -from .path_parameters import PathParameters, PathParametersDictInput, PathParametersDict -path_parameter_classes = ( - parameter_0.Parameter0, -) - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '204': typing.Type[response_204.ResponseFor204], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '404': typing.Type[response_404.ResponseFor404], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '204': response_204.ResponseFor204, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '404': response_404.ResponseFor404, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '204', -}) -_error_status_codes = frozenset({ - '401', - '403', - '404', - '406', - '412', -}) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_delete( - self, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[False] = False, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_204.ApiResponse: ... - - @typing.overload - def _keys_key_id_delete( - self, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[True], - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _keys_key_id_delete( - self, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: bool = False, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - path_params = PathParameters.validate(path_params) - used_path, query_params_suffix = self._get_used_path( - path, - path_parameters=path_parameter_classes, - path_params=path_params, - skip_validation=True - ) - # TODO add cookie handling - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//keys/{KeyID}/delete/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='delete', - host=host, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '204', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '401', - '403', - '404', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class KeysKeyIDDelete(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - keys_key_id_delete = BaseApi._keys_key_id_delete - - -class ApiForDelete(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - delete = BaseApi._keys_key_id_delete diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/delete/parameters/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/delete/parameters/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/delete/parameters/parameter_0/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/delete/parameters/parameter_0/__init__.py deleted file mode 100644 index 29e0385b..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/delete/parameters/parameter_0/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from . import schema - - -class Parameter0(api_client.PathParameter): - name = "KeyID" - style = api_client.ParameterStyle.SIMPLE - schema: typing_extensions.TypeAlias = schema.Schema - required = True diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/delete/parameters/parameter_0/schema.py b/pynitrokey/nethsm/client/paths/keys_key_id/delete/parameters/parameter_0/schema.py deleted file mode 100644 index 951e9038..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/delete/parameters/parameter_0/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -Schema: typing_extensions.TypeAlias = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/delete/path_parameters.py b/pynitrokey/nethsm/client/paths/keys_key_id/delete/path_parameters.py deleted file mode 100644 index 68e33102..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/delete/path_parameters.py +++ /dev/null @@ -1,100 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema - -from pynitrokey.nethsm.client.paths.keys_key_id.delete.parameters.parameter_0 import schema -Properties = typing.TypedDict( - 'Properties', - { - "KeyID": typing.Type[schema.Schema], - } -) - - -class PathParametersDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - - __required_keys__: typing.FrozenSet[str] = frozenset({ - "KeyID", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - KeyID: str, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - ): - arg_: typing.Dict[str, typing.Any] = { - "KeyID": KeyID, - } - used_arg_ = typing.cast(PathParametersDictInput, arg_) - return PathParameters.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return PathParameters.validate(arg, configuration=configuration) - - @property - def KeyID(self) -> str: - return typing.cast( - str, - self.__getitem__("KeyID") - ) -PathParametersDictInput = typing.TypedDict( - 'PathParametersDictInput', - { - "KeyID": str, - } -) - - -@dataclasses.dataclass(frozen=True) -class PathParameters( - schemas.Schema[PathParametersDict, tuple] -): - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "KeyID", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - additional_properties: typing.Type[AdditionalProperties] = dataclasses.field(default_factory=lambda: AdditionalProperties) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: PathParametersDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/response_204/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/response_204/__init__.py deleted file mode 100644 index 8e822e77..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/response_204/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor204(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/response_404/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/response_404/__init__.py deleted file mode 100644 index e43c74d8..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/response_404/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor404(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/delete/security/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/delete/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/delete/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/keys_key_id/delete/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/delete/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/get/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/get/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/get/operation.py b/pynitrokey/nethsm/client/paths/keys_key_id/get/operation.py deleted file mode 100644 index 92e8203c..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/get/operation.py +++ /dev/null @@ -1,197 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .. import path -from .responses import ( - response_200, - response_400, - response_401, - response_403, - response_404, - response_406, - response_412, -) -from .parameters import parameter_0 -from .security import security_requirement_object_0 -from .path_parameters import PathParameters, PathParametersDictInput, PathParametersDict -path_parameter_classes = ( - parameter_0.Parameter0, -) - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '200': typing.Type[response_200.ResponseFor200], - '400': typing.Type[response_400.ResponseFor400], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '404': typing.Type[response_404.ResponseFor404], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '200': response_200.ResponseFor200, - '400': response_400.ResponseFor400, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '404': response_404.ResponseFor404, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '200', -}) -_error_status_codes = frozenset({ - '400', - '401', - '403', - '404', - '406', - '412', -}) - -_all_accept_content_types = ( - "application/json", -) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_get( - self, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[False] = False, - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_200.ApiResponse: ... - - @typing.overload - def _keys_key_id_get( - self, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[True], - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _keys_key_id_get( - self, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: bool = False, - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - path_params = PathParameters.validate(path_params) - used_path, query_params_suffix = self._get_used_path( - path, - path_parameters=path_parameter_classes, - path_params=path_params, - skip_validation=True - ) - headers = self._get_headers(accept_content_types=accept_content_types) - # TODO add cookie handling - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//keys/{KeyID}/get/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='get', - host=host, - headers=headers, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '200', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '400', - '401', - '403', - '404', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class KeysKeyIDGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - keys_key_id_get = BaseApi._keys_key_id_get - - -class ApiForGet(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - get = BaseApi._keys_key_id_get diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/get/parameters/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/get/parameters/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/get/parameters/parameter_0/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/get/parameters/parameter_0/__init__.py deleted file mode 100644 index 29e0385b..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/get/parameters/parameter_0/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from . import schema - - -class Parameter0(api_client.PathParameter): - name = "KeyID" - style = api_client.ParameterStyle.SIMPLE - schema: typing_extensions.TypeAlias = schema.Schema - required = True diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/get/parameters/parameter_0/schema.py b/pynitrokey/nethsm/client/paths/keys_key_id/get/parameters/parameter_0/schema.py deleted file mode 100644 index 951e9038..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/get/parameters/parameter_0/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -Schema: typing_extensions.TypeAlias = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/get/path_parameters.py b/pynitrokey/nethsm/client/paths/keys_key_id/get/path_parameters.py deleted file mode 100644 index 70a2591e..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/get/path_parameters.py +++ /dev/null @@ -1,100 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema - -from pynitrokey.nethsm.client.paths.keys_key_id.get.parameters.parameter_0 import schema -Properties = typing.TypedDict( - 'Properties', - { - "KeyID": typing.Type[schema.Schema], - } -) - - -class PathParametersDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - - __required_keys__: typing.FrozenSet[str] = frozenset({ - "KeyID", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - KeyID: str, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - ): - arg_: typing.Dict[str, typing.Any] = { - "KeyID": KeyID, - } - used_arg_ = typing.cast(PathParametersDictInput, arg_) - return PathParameters.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return PathParameters.validate(arg, configuration=configuration) - - @property - def KeyID(self) -> str: - return typing.cast( - str, - self.__getitem__("KeyID") - ) -PathParametersDictInput = typing.TypedDict( - 'PathParametersDictInput', - { - "KeyID": str, - } -) - - -@dataclasses.dataclass(frozen=True) -class PathParameters( - schemas.Schema[PathParametersDict, tuple] -): - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "KeyID", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - additional_properties: typing.Type[AdditionalProperties] = dataclasses.field(default_factory=lambda: AdditionalProperties) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: PathParametersDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_200/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_200/__init__.py deleted file mode 100644 index 35f1ea17..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_200/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: application_json_schema.public_key.PublicKeyDict - headers: schemas.Unset = schemas.unset - - -class ResponseFor200(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_200/content/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_200/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_200/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_200/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_200/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_200/content/application_json/schema.py deleted file mode 100644 index 189217cd..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_200/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import public_key -Schema: typing_extensions.TypeAlias = public_key.PublicKey diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_400/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_400/__init__.py deleted file mode 100644 index 0458793b..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_400/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor400(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_404/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_404/__init__.py deleted file mode 100644 index e43c74d8..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_404/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor404(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/get/security/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/get/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/get/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/keys_key_id/get/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/get/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/put/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/put/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/put/operation.py b/pynitrokey/nethsm/client/paths/keys_key_id/put/operation.py deleted file mode 100644 index f25e2643..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/put/operation.py +++ /dev/null @@ -1,296 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import pem_private_key -from pynitrokey.nethsm.client.components.schema import private_key - -from .. import path -from .responses import ( - response_204, - response_400, - response_401, - response_403, - response_406, - response_409, - response_412, -) -from . import request_body -from .parameters import ( - parameter_0, - parameter_1, - parameter_2, -) -from .security import security_requirement_object_0 -from .path_parameters import PathParameters, PathParametersDictInput, PathParametersDict -from .query_parameters import QueryParameters, QueryParametersDictInput, QueryParametersDict -query_parameter_classes = ( - parameter_0.Parameter0, - parameter_1.Parameter1, -) -path_parameter_classes = ( - parameter_2.Parameter2, -) - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '204': typing.Type[response_204.ResponseFor204], - '400': typing.Type[response_400.ResponseFor400], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '406': typing.Type[response_406.ResponseFor406], - '409': typing.Type[response_409.ResponseFor409], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '204': response_204.ResponseFor204, - '400': response_400.ResponseFor400, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '406': response_406.ResponseFor406, - '409': response_409.ResponseFor409, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '204', -}) -_error_status_codes = frozenset({ - '400', - '401', - '403', - '406', - '409', - '412', -}) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_put( - self, - body: typing.Union[ - private_key.PrivateKeyDictInput, - private_key.PrivateKeyDict, - ], - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - query_params: typing.Union[ - QueryParametersDictInput, - QueryParametersDict, - None - ] = None, - *, - skip_deserialization: typing.Literal[False] = False, - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_204.ApiResponse: ... - - @typing.overload - def _keys_key_id_put( - self, - body: typing.Union[ - private_key.PrivateKeyDictInput, - private_key.PrivateKeyDict, - ], - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - query_params: typing.Union[ - QueryParametersDictInput, - QueryParametersDict, - None - ] = None, - *, - skip_deserialization: typing.Literal[True], - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _keys_key_id_put( - self, - body: str, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - query_params: typing.Union[ - QueryParametersDictInput, - QueryParametersDict, - None - ] = None, - *, - skip_deserialization: typing.Literal[False] = False, - content_type: typing.Literal["application/x-pem-file"], - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_204.ApiResponse: ... - - @typing.overload - def _keys_key_id_put( - self, - body: str, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - query_params: typing.Union[ - QueryParametersDictInput, - QueryParametersDict, - None - ] = None, - *, - skip_deserialization: typing.Literal[True], - content_type: typing.Literal["application/x-pem-file"], - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _keys_key_id_put( - self, - body: typing.Union[ - typing.Union[ - private_key.PrivateKeyDictInput, - private_key.PrivateKeyDict, - ], - str, - ], - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - query_params: typing.Union[ - QueryParametersDictInput, - QueryParametersDict, - None - ] = None, - *, - skip_deserialization: bool = False, - content_type: typing.Literal[ - "application/json", - "application/x-pem-file", - ] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - path_params = PathParameters.validate(path_params) - if query_params is not None: - query_params = QueryParameters.validate(query_params) - used_path, query_params_suffix = self._get_used_path( - path, - path_parameters=path_parameter_classes, - path_params=path_params, - query_parameters=query_parameter_classes, - query_params=query_params, - skip_validation=True - ) - headers = self._get_headers() - # TODO add cookie handling - - fields, serialized_body = self._get_fields_and_body( - request_body=request_body.RequestBody, - body=body, - content_type=content_type, - headers=headers - ) - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//keys/{KeyID}/put/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - query_params_suffix=query_params_suffix, - method='put', - host=host, - headers=headers, - fields=fields, - body=serialized_body, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '204', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '400', - '401', - '403', - '406', - '409', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class KeysKeyIDPut(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - keys_key_id_put = BaseApi._keys_key_id_put - - -class ApiForPut(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - put = BaseApi._keys_key_id_put diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/parameter_0/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/parameter_0/__init__.py deleted file mode 100644 index ba13e66e..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/parameter_0/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from . import schema - - -class Parameter0(api_client.QueryParameter): - name = "mechanisms" - style = api_client.ParameterStyle.FORM - schema: typing_extensions.TypeAlias = schema.Schema - explode = True diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/parameter_0/schema.py b/pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/parameter_0/schema.py deleted file mode 100644 index 90e13d89..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/parameter_0/schema.py +++ /dev/null @@ -1,104 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -from pynitrokey.nethsm.client.components.schema import key_mechanism - - -class SchemaTuple( - typing.Tuple[ - typing.Literal["RSA_Decryption_RAW", "RSA_Decryption_PKCS1", "RSA_Decryption_OAEP_MD5", "RSA_Decryption_OAEP_SHA1", "RSA_Decryption_OAEP_SHA224", "RSA_Decryption_OAEP_SHA256", "RSA_Decryption_OAEP_SHA384", "RSA_Decryption_OAEP_SHA512", "RSA_Signature_PKCS1", "RSA_Signature_PSS_MD5", "RSA_Signature_PSS_SHA1", "RSA_Signature_PSS_SHA224", "RSA_Signature_PSS_SHA256", "RSA_Signature_PSS_SHA384", "RSA_Signature_PSS_SHA512", "EdDSA_Signature", "ECDSA_Signature", "AES_Encryption_CBC", "AES_Decryption_CBC"], - ... - ] -): - - def __new__(cls, arg: typing.Union[SchemaTupleInput, SchemaTuple], configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None): - return Schema.validate(arg, configuration=configuration) -SchemaTupleInput = typing.Union[ - typing.List[ - typing.Literal[ - "RSA_Decryption_RAW", - "RSA_Decryption_PKCS1", - "RSA_Decryption_OAEP_MD5", - "RSA_Decryption_OAEP_SHA1", - "RSA_Decryption_OAEP_SHA224", - "RSA_Decryption_OAEP_SHA256", - "RSA_Decryption_OAEP_SHA384", - "RSA_Decryption_OAEP_SHA512", - "RSA_Signature_PKCS1", - "RSA_Signature_PSS_MD5", - "RSA_Signature_PSS_SHA1", - "RSA_Signature_PSS_SHA224", - "RSA_Signature_PSS_SHA256", - "RSA_Signature_PSS_SHA384", - "RSA_Signature_PSS_SHA512", - "EdDSA_Signature", - "ECDSA_Signature", - "AES_Encryption_CBC", - "AES_Decryption_CBC" - ], - ], - typing.Tuple[ - typing.Literal[ - "RSA_Decryption_RAW", - "RSA_Decryption_PKCS1", - "RSA_Decryption_OAEP_MD5", - "RSA_Decryption_OAEP_SHA1", - "RSA_Decryption_OAEP_SHA224", - "RSA_Decryption_OAEP_SHA256", - "RSA_Decryption_OAEP_SHA384", - "RSA_Decryption_OAEP_SHA512", - "RSA_Signature_PKCS1", - "RSA_Signature_PSS_MD5", - "RSA_Signature_PSS_SHA1", - "RSA_Signature_PSS_SHA224", - "RSA_Signature_PSS_SHA256", - "RSA_Signature_PSS_SHA384", - "RSA_Signature_PSS_SHA512", - "EdDSA_Signature", - "ECDSA_Signature", - "AES_Encryption_CBC", - "AES_Decryption_CBC" - ], - ... - ] -] - - -@dataclasses.dataclass(frozen=True) -class Schema( - schemas.Schema[schemas.immutabledict, SchemaTuple] -): - types: typing.FrozenSet[typing.Type] = frozenset({tuple}) - items: typing.Type[key_mechanism.KeyMechanism] = dataclasses.field(default_factory=lambda: key_mechanism.KeyMechanism) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - tuple: SchemaTuple - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - SchemaTupleInput, - SchemaTuple, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> SchemaTuple: - return super().validate_base( - arg, - configuration=configuration, - ) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/parameter_1/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/parameter_1/__init__.py deleted file mode 100644 index 5280c5a3..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/parameter_1/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from . import schema - - -class Parameter1(api_client.QueryParameter): - name = "tags" - style = api_client.ParameterStyle.FORM - schema: typing_extensions.TypeAlias = schema.Schema - explode = True diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/parameter_1/schema.py b/pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/parameter_1/schema.py deleted file mode 100644 index 215befe9..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/parameter_1/schema.py +++ /dev/null @@ -1,64 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -from pynitrokey.nethsm.client.components.schema import id - - -class SchemaTuple( - typing.Tuple[ - str, - ... - ] -): - - def __new__(cls, arg: typing.Union[SchemaTupleInput, SchemaTuple], configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None): - return Schema.validate(arg, configuration=configuration) -SchemaTupleInput = typing.Union[ - typing.List[ - str, - ], - typing.Tuple[ - str, - ... - ] -] - - -@dataclasses.dataclass(frozen=True) -class Schema( - schemas.Schema[schemas.immutabledict, SchemaTuple] -): - types: typing.FrozenSet[typing.Type] = frozenset({tuple}) - items: typing.Type[id.ID] = dataclasses.field(default_factory=lambda: id.ID) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - tuple: SchemaTuple - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - SchemaTupleInput, - SchemaTuple, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> SchemaTuple: - return super().validate_base( - arg, - configuration=configuration, - ) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/parameter_2/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/parameter_2/__init__.py deleted file mode 100644 index 7f1ce921..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/parameter_2/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from . import schema - - -class Parameter2(api_client.PathParameter): - name = "KeyID" - style = api_client.ParameterStyle.SIMPLE - schema: typing_extensions.TypeAlias = schema.Schema - required = True diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/parameter_2/schema.py b/pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/parameter_2/schema.py deleted file mode 100644 index 951e9038..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/parameter_2/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -Schema: typing_extensions.TypeAlias = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/put/path_parameters.py b/pynitrokey/nethsm/client/paths/keys_key_id/put/path_parameters.py deleted file mode 100644 index a42304f5..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/put/path_parameters.py +++ /dev/null @@ -1,100 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema - -from pynitrokey.nethsm.client.paths.keys_key_id.put.parameters.parameter_2 import schema -Properties = typing.TypedDict( - 'Properties', - { - "KeyID": typing.Type[schema.Schema], - } -) - - -class PathParametersDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - - __required_keys__: typing.FrozenSet[str] = frozenset({ - "KeyID", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - KeyID: str, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - ): - arg_: typing.Dict[str, typing.Any] = { - "KeyID": KeyID, - } - used_arg_ = typing.cast(PathParametersDictInput, arg_) - return PathParameters.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return PathParameters.validate(arg, configuration=configuration) - - @property - def KeyID(self) -> str: - return typing.cast( - str, - self.__getitem__("KeyID") - ) -PathParametersDictInput = typing.TypedDict( - 'PathParametersDictInput', - { - "KeyID": str, - } -) - - -@dataclasses.dataclass(frozen=True) -class PathParameters( - schemas.Schema[PathParametersDict, tuple] -): - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "KeyID", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - additional_properties: typing.Type[AdditionalProperties] = dataclasses.field(default_factory=lambda: AdditionalProperties) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: PathParametersDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/put/query_parameters.py b/pynitrokey/nethsm/client/paths/keys_key_id/put/query_parameters.py deleted file mode 100644 index 87529526..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/put/query_parameters.py +++ /dev/null @@ -1,134 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema - -from pynitrokey.nethsm.client.paths.keys_key_id.put.parameters.parameter_0 import schema -from pynitrokey.nethsm.client.paths.keys_key_id.put.parameters.parameter_1 import schema as schema_2 -Properties = typing.TypedDict( - 'Properties', - { - "mechanisms": typing.Type[schema.Schema], - "tags": typing.Type[schema_2.Schema], - } -) - - -class QueryParametersDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - __required_keys__: typing.FrozenSet[str] = frozenset({ - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - "mechanisms", - "tags", - }) - - def __new__( - cls, - *, - mechanisms: typing.Union[ - schema.SchemaTupleInput, - schema.SchemaTuple, - schemas.Unset - ] = schemas.unset, - tags: typing.Union[ - schema_2.SchemaTupleInput, - schema_2.SchemaTuple, - schemas.Unset - ] = schemas.unset, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - ): - arg_: typing.Dict[str, typing.Any] = {} - for key, val in ( - ("mechanisms", mechanisms), - ("tags", tags), - ): - if isinstance(val, schemas.Unset): - continue - arg_[key] = val - used_arg_ = typing.cast(QueryParametersDictInput, arg_) - return QueryParameters.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - QueryParametersDictInput, - QueryParametersDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> QueryParametersDict: - return QueryParameters.validate(arg, configuration=configuration) - - @property - def mechanisms(self) -> typing.Union[schema.SchemaTuple, schemas.Unset]: - val = self.get("mechanisms", schemas.unset) - if isinstance(val, schemas.Unset): - return val - return typing.cast( - schema.SchemaTuple, - val - ) - - @property - def tags(self) -> typing.Union[schema_2.SchemaTuple, schemas.Unset]: - val = self.get("tags", schemas.unset) - if isinstance(val, schemas.Unset): - return val - return typing.cast( - schema_2.SchemaTuple, - val - ) -QueryParametersDictInput = typing.TypedDict( - 'QueryParametersDictInput', - { - "mechanisms": typing.Union[ - schema.SchemaTupleInput, - schema.SchemaTuple - ], - "tags": typing.Union[ - schema_2.SchemaTupleInput, - schema_2.SchemaTuple - ], - }, - total=False -) - - -@dataclasses.dataclass(frozen=True) -class QueryParameters( - schemas.Schema[QueryParametersDict, tuple] -): - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - additional_properties: typing.Type[AdditionalProperties] = dataclasses.field(default_factory=lambda: AdditionalProperties) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: QueryParametersDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - QueryParametersDictInput, - QueryParametersDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> QueryParametersDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/put/request_body/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/put/request_body/__init__.py deleted file mode 100644 index 9fa09553..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/put/request_body/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema -from .content.application_x_pem_file import schema as application_x_pem_file_schema - - -class RequestBody(api_client.RequestBody): - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - - - class ApplicationXPemFileMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_x_pem_file_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - 'application/x-pem-file': ApplicationXPemFileMediaType, - } - required = True diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/put/request_body/content/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/put/request_body/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/put/request_body/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/put/request_body/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/put/request_body/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/keys_key_id/put/request_body/content/application_json/schema.py deleted file mode 100644 index 1e7efb0a..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/put/request_body/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import private_key -Schema: typing_extensions.TypeAlias = private_key.PrivateKey diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/put/request_body/content/application_x_pem_file/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/put/request_body/content/application_x_pem_file/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/put/request_body/content/application_x_pem_file/schema.py b/pynitrokey/nethsm/client/paths/keys_key_id/put/request_body/content/application_x_pem_file/schema.py deleted file mode 100644 index 00854d77..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/put/request_body/content/application_x_pem_file/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import pem_private_key -Schema: typing_extensions.TypeAlias = pem_private_key.PemPrivateKey diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/put/responses/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/put/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_204/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_204/__init__.py deleted file mode 100644 index 8e822e77..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_204/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor204(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_400/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_400/__init__.py deleted file mode 100644 index 0458793b..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_400/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor400(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_409/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_409/__init__.py deleted file mode 100644 index ce260df9..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_409/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor409(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/put/security/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/put/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/put/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/keys_key_id/put/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/put/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/__init__.py deleted file mode 100644 index 143c7cb2..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.keys_key_id_cert import KeysKeyIDCert - -path = "/keys/{KeyID}/cert" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/operation.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/operation.py deleted file mode 100644 index c34e6ad3..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/operation.py +++ /dev/null @@ -1,188 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .. import path -from .responses import ( - response_204, - response_401, - response_403, - response_404, - response_406, - response_409, - response_412, -) -from .parameters import parameter_0 -from .security import security_requirement_object_0 -from .path_parameters import PathParameters, PathParametersDictInput, PathParametersDict -path_parameter_classes = ( - parameter_0.Parameter0, -) - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '204': typing.Type[response_204.ResponseFor204], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '404': typing.Type[response_404.ResponseFor404], - '406': typing.Type[response_406.ResponseFor406], - '409': typing.Type[response_409.ResponseFor409], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '204': response_204.ResponseFor204, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '404': response_404.ResponseFor404, - '406': response_406.ResponseFor406, - '409': response_409.ResponseFor409, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '204', -}) -_error_status_codes = frozenset({ - '401', - '403', - '404', - '406', - '409', - '412', -}) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_cert_delete( - self, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[False] = False, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_204.ApiResponse: ... - - @typing.overload - def _keys_key_id_cert_delete( - self, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[True], - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _keys_key_id_cert_delete( - self, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: bool = False, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - path_params = PathParameters.validate(path_params) - used_path, query_params_suffix = self._get_used_path( - path, - path_parameters=path_parameter_classes, - path_params=path_params, - skip_validation=True - ) - # TODO add cookie handling - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//keys/{KeyID}/cert/delete/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='delete', - host=host, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '204', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '401', - '403', - '404', - '406', - '409', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class KeysKeyIDCertDelete(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - keys_key_id_cert_delete = BaseApi._keys_key_id_cert_delete - - -class ApiForDelete(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - delete = BaseApi._keys_key_id_cert_delete diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/parameters/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/parameters/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/parameters/parameter_0/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/parameters/parameter_0/__init__.py deleted file mode 100644 index 29e0385b..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/parameters/parameter_0/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from . import schema - - -class Parameter0(api_client.PathParameter): - name = "KeyID" - style = api_client.ParameterStyle.SIMPLE - schema: typing_extensions.TypeAlias = schema.Schema - required = True diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/parameters/parameter_0/schema.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/parameters/parameter_0/schema.py deleted file mode 100644 index 951e9038..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/parameters/parameter_0/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -Schema: typing_extensions.TypeAlias = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/path_parameters.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/path_parameters.py deleted file mode 100644 index cd120950..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/path_parameters.py +++ /dev/null @@ -1,100 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema - -from pynitrokey.nethsm.client.paths.keys_key_id_cert.delete.parameters.parameter_0 import schema -Properties = typing.TypedDict( - 'Properties', - { - "KeyID": typing.Type[schema.Schema], - } -) - - -class PathParametersDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - - __required_keys__: typing.FrozenSet[str] = frozenset({ - "KeyID", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - KeyID: str, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - ): - arg_: typing.Dict[str, typing.Any] = { - "KeyID": KeyID, - } - used_arg_ = typing.cast(PathParametersDictInput, arg_) - return PathParameters.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return PathParameters.validate(arg, configuration=configuration) - - @property - def KeyID(self) -> str: - return typing.cast( - str, - self.__getitem__("KeyID") - ) -PathParametersDictInput = typing.TypedDict( - 'PathParametersDictInput', - { - "KeyID": str, - } -) - - -@dataclasses.dataclass(frozen=True) -class PathParameters( - schemas.Schema[PathParametersDict, tuple] -): - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "KeyID", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - additional_properties: typing.Type[AdditionalProperties] = dataclasses.field(default_factory=lambda: AdditionalProperties) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: PathParametersDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_204/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_204/__init__.py deleted file mode 100644 index 8e822e77..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_204/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor204(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_404/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_404/__init__.py deleted file mode 100644 index e43c74d8..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_404/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor404(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_409/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_409/__init__.py deleted file mode 100644 index ce260df9..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_409/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor409(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/security/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/operation.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/operation.py deleted file mode 100644 index 551f8af6..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/operation.py +++ /dev/null @@ -1,199 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .. import path -from .responses import ( - response_200, - response_400, - response_401, - response_403, - response_404, - response_406, - response_412, -) -from .parameters import parameter_0 -from .security import security_requirement_object_0 -from .path_parameters import PathParameters, PathParametersDictInput, PathParametersDict -path_parameter_classes = ( - parameter_0.Parameter0, -) - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '200': typing.Type[response_200.ResponseFor200], - '400': typing.Type[response_400.ResponseFor400], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '404': typing.Type[response_404.ResponseFor404], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '200': response_200.ResponseFor200, - '400': response_400.ResponseFor400, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '404': response_404.ResponseFor404, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '200', -}) -_error_status_codes = frozenset({ - '400', - '401', - '403', - '404', - '406', - '412', -}) - -_all_accept_content_types = ( - "application/x-pem-file", - "application/x-x509-ca-cert", - "application/pgp-keys", -) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_cert_get( - self, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[False] = False, - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_200.ApiResponse: ... - - @typing.overload - def _keys_key_id_cert_get( - self, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[True], - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _keys_key_id_cert_get( - self, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: bool = False, - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - path_params = PathParameters.validate(path_params) - used_path, query_params_suffix = self._get_used_path( - path, - path_parameters=path_parameter_classes, - path_params=path_params, - skip_validation=True - ) - headers = self._get_headers(accept_content_types=accept_content_types) - # TODO add cookie handling - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//keys/{KeyID}/cert/get/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='get', - host=host, - headers=headers, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '200', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '400', - '401', - '403', - '404', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class KeysKeyIDCertGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - keys_key_id_cert_get = BaseApi._keys_key_id_cert_get - - -class ApiForGet(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - get = BaseApi._keys_key_id_cert_get diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/parameters/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/parameters/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/parameters/parameter_0/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/parameters/parameter_0/__init__.py deleted file mode 100644 index 29e0385b..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/parameters/parameter_0/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from . import schema - - -class Parameter0(api_client.PathParameter): - name = "KeyID" - style = api_client.ParameterStyle.SIMPLE - schema: typing_extensions.TypeAlias = schema.Schema - required = True diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/parameters/parameter_0/schema.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/parameters/parameter_0/schema.py deleted file mode 100644 index 951e9038..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/parameters/parameter_0/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -Schema: typing_extensions.TypeAlias = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/path_parameters.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/path_parameters.py deleted file mode 100644 index e8922e8a..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/path_parameters.py +++ /dev/null @@ -1,100 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema - -from pynitrokey.nethsm.client.paths.keys_key_id_cert.get.parameters.parameter_0 import schema -Properties = typing.TypedDict( - 'Properties', - { - "KeyID": typing.Type[schema.Schema], - } -) - - -class PathParametersDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - - __required_keys__: typing.FrozenSet[str] = frozenset({ - "KeyID", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - KeyID: str, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - ): - arg_: typing.Dict[str, typing.Any] = { - "KeyID": KeyID, - } - used_arg_ = typing.cast(PathParametersDictInput, arg_) - return PathParameters.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return PathParameters.validate(arg, configuration=configuration) - - @property - def KeyID(self) -> str: - return typing.cast( - str, - self.__getitem__("KeyID") - ) -PathParametersDictInput = typing.TypedDict( - 'PathParametersDictInput', - { - "KeyID": str, - } -) - - -@dataclasses.dataclass(frozen=True) -class PathParameters( - schemas.Schema[PathParametersDict, tuple] -): - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "KeyID", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - additional_properties: typing.Type[AdditionalProperties] = dataclasses.field(default_factory=lambda: AdditionalProperties) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: PathParametersDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/__init__.py deleted file mode 100644 index 7575f81e..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/__init__.py +++ /dev/null @@ -1,45 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_x_pem_file import schema as application_x_pem_file_schema -from .content.application_xx509_ca_cert import schema as application_xx509_ca_cert_schema -from .content.application_pgp_keys import schema as application_pgp_keys_schema - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - str, - str, - str, - ] - headers: schemas.Unset = schemas.unset - - -class ResponseFor200(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) - - - class ApplicationXPemFileMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_x_pem_file_schema.Schema - - - class ApplicationXX509CaCertMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_xx509_ca_cert_schema.Schema - - - class ApplicationPgpKeysMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_pgp_keys_schema.Schema - content = { - 'application/x-pem-file': ApplicationXPemFileMediaType, - 'application/x-x509-ca-cert': ApplicationXX509CaCertMediaType, - 'application/pgp-keys': ApplicationPgpKeysMediaType, - } diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/content/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/content/application_pgp_keys/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/content/application_pgp_keys/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/content/application_pgp_keys/schema.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/content/application_pgp_keys/schema.py deleted file mode 100644 index 66f736fb..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/content/application_pgp_keys/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import pgp_private_key -Schema: typing_extensions.TypeAlias = pgp_private_key.PGPPrivateKey diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/content/application_x_pem_file/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/content/application_x_pem_file/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/content/application_x_pem_file/schema.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/content/application_x_pem_file/schema.py deleted file mode 100644 index 1457aaf5..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/content/application_x_pem_file/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import pem_cert -Schema: typing_extensions.TypeAlias = pem_cert.PemCert diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/content/application_xx509_ca_cert/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/content/application_xx509_ca_cert/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/content/application_xx509_ca_cert/schema.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/content/application_xx509_ca_cert/schema.py deleted file mode 100644 index 951e9038..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/content/application_xx509_ca_cert/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -Schema: typing_extensions.TypeAlias = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_400/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_400/__init__.py deleted file mode 100644 index 0458793b..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_400/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor400(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_404/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_404/__init__.py deleted file mode 100644 index e43c74d8..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_404/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor404(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/security/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/operation.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/operation.py deleted file mode 100644 index 095c081a..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/operation.py +++ /dev/null @@ -1,280 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import pem_cert -from pynitrokey.nethsm.client.components.schema import pgp_private_key -from pynitrokey.nethsm.client.paths.keys_key_id_cert.put.request_body.content.application_xx509_ca_cert import schema - -from .. import path -from .responses import ( - response_201, - response_401, - response_403, - response_406, - response_409, - response_412, -) -from . import request_body -from .parameters import parameter_0 -from .security import security_requirement_object_0 -from .path_parameters import PathParameters, PathParametersDictInput, PathParametersDict -path_parameter_classes = ( - parameter_0.Parameter0, -) - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '201': typing.Type[response_201.ResponseFor201], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '406': typing.Type[response_406.ResponseFor406], - '409': typing.Type[response_409.ResponseFor409], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '201': response_201.ResponseFor201, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '406': response_406.ResponseFor406, - '409': response_409.ResponseFor409, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '201', -}) -_error_status_codes = frozenset({ - '401', - '403', - '406', - '409', - '412', -}) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_cert_put( - self, - body: str, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[False] = False, - content_type: typing.Literal["application/x-pem-file"] = "application/x-pem-file", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_201.ApiResponse: ... - - @typing.overload - def _keys_key_id_cert_put( - self, - body: str, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[True], - content_type: typing.Literal["application/x-pem-file"] = "application/x-pem-file", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _keys_key_id_cert_put( - self, - body: str, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[False] = False, - content_type: typing.Literal["application/x-x509-ca-cert"], - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_201.ApiResponse: ... - - @typing.overload - def _keys_key_id_cert_put( - self, - body: str, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[True], - content_type: typing.Literal["application/x-x509-ca-cert"], - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _keys_key_id_cert_put( - self, - body: str, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[False] = False, - content_type: typing.Literal["application/pgp-keys"], - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_201.ApiResponse: ... - - @typing.overload - def _keys_key_id_cert_put( - self, - body: str, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[True], - content_type: typing.Literal["application/pgp-keys"], - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _keys_key_id_cert_put( - self, - body: typing.Union[ - str, - str, - str, - ], - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: bool = False, - content_type: typing.Literal[ - "application/x-pem-file", - "application/x-x509-ca-cert", - "application/pgp-keys", - ] = "application/x-pem-file", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - path_params = PathParameters.validate(path_params) - used_path, query_params_suffix = self._get_used_path( - path, - path_parameters=path_parameter_classes, - path_params=path_params, - skip_validation=True - ) - headers = self._get_headers() - # TODO add cookie handling - - fields, serialized_body = self._get_fields_and_body( - request_body=request_body.RequestBody, - body=body, - content_type=content_type, - headers=headers - ) - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//keys/{KeyID}/cert/put/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='put', - host=host, - headers=headers, - fields=fields, - body=serialized_body, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '201', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '401', - '403', - '406', - '409', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class KeysKeyIDCertPut(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - keys_key_id_cert_put = BaseApi._keys_key_id_cert_put - - -class ApiForPut(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - put = BaseApi._keys_key_id_cert_put diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/parameters/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/parameters/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/parameters/parameter_0/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/parameters/parameter_0/__init__.py deleted file mode 100644 index 29e0385b..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/parameters/parameter_0/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from . import schema - - -class Parameter0(api_client.PathParameter): - name = "KeyID" - style = api_client.ParameterStyle.SIMPLE - schema: typing_extensions.TypeAlias = schema.Schema - required = True diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/parameters/parameter_0/schema.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/parameters/parameter_0/schema.py deleted file mode 100644 index 951e9038..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/parameters/parameter_0/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -Schema: typing_extensions.TypeAlias = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/path_parameters.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/path_parameters.py deleted file mode 100644 index 7f83832b..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/path_parameters.py +++ /dev/null @@ -1,100 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema - -from pynitrokey.nethsm.client.paths.keys_key_id_cert.put.parameters.parameter_0 import schema -Properties = typing.TypedDict( - 'Properties', - { - "KeyID": typing.Type[schema.Schema], - } -) - - -class PathParametersDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - - __required_keys__: typing.FrozenSet[str] = frozenset({ - "KeyID", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - KeyID: str, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - ): - arg_: typing.Dict[str, typing.Any] = { - "KeyID": KeyID, - } - used_arg_ = typing.cast(PathParametersDictInput, arg_) - return PathParameters.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return PathParameters.validate(arg, configuration=configuration) - - @property - def KeyID(self) -> str: - return typing.cast( - str, - self.__getitem__("KeyID") - ) -PathParametersDictInput = typing.TypedDict( - 'PathParametersDictInput', - { - "KeyID": str, - } -) - - -@dataclasses.dataclass(frozen=True) -class PathParameters( - schemas.Schema[PathParametersDict, tuple] -): - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "KeyID", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - additional_properties: typing.Type[AdditionalProperties] = dataclasses.field(default_factory=lambda: AdditionalProperties) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: PathParametersDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/__init__.py deleted file mode 100644 index a64bbd85..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/__init__.py +++ /dev/null @@ -1,32 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_x_pem_file import schema as application_x_pem_file_schema -from .content.application_xx509_ca_cert import schema as application_xx509_ca_cert_schema -from .content.application_pgp_keys import schema as application_pgp_keys_schema - - -class RequestBody(api_client.RequestBody): - - - class ApplicationXPemFileMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_x_pem_file_schema.Schema - - - class ApplicationXX509CaCertMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_xx509_ca_cert_schema.Schema - - - class ApplicationPgpKeysMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_pgp_keys_schema.Schema - content = { - 'application/x-pem-file': ApplicationXPemFileMediaType, - 'application/x-x509-ca-cert': ApplicationXX509CaCertMediaType, - 'application/pgp-keys': ApplicationPgpKeysMediaType, - } - required = True diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/content/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/content/application_pgp_keys/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/content/application_pgp_keys/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/content/application_pgp_keys/schema.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/content/application_pgp_keys/schema.py deleted file mode 100644 index 66f736fb..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/content/application_pgp_keys/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import pgp_private_key -Schema: typing_extensions.TypeAlias = pgp_private_key.PGPPrivateKey diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/content/application_x_pem_file/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/content/application_x_pem_file/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/content/application_x_pem_file/schema.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/content/application_x_pem_file/schema.py deleted file mode 100644 index 1457aaf5..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/content/application_x_pem_file/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import pem_cert -Schema: typing_extensions.TypeAlias = pem_cert.PemCert diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/content/application_xx509_ca_cert/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/content/application_xx509_ca_cert/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/content/application_xx509_ca_cert/schema.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/content/application_xx509_ca_cert/schema.py deleted file mode 100644 index 951e9038..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/content/application_xx509_ca_cert/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -Schema: typing_extensions.TypeAlias = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/response_201/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/response_201/__init__.py deleted file mode 100644 index dca4edc5..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/response_201/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor201(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/response_409/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/response_409/__init__.py deleted file mode 100644 index ce260df9..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/response_409/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor409(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/security/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/__init__.py deleted file mode 100644 index 4b053b4c..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.keys_key_id_csr_pem import KeysKeyIDCsrPem - -path = "/keys/{KeyID}/csr.pem" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/operation.py b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/operation.py deleted file mode 100644 index 03bbbbcb..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/operation.py +++ /dev/null @@ -1,223 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import distinguished_name - -from .. import path -from .responses import ( - response_200, - response_400, - response_401, - response_403, - response_404, - response_406, - response_412, -) -from . import request_body -from .parameters import parameter_0 -from .security import security_requirement_object_0 -from .path_parameters import PathParameters, PathParametersDictInput, PathParametersDict -path_parameter_classes = ( - parameter_0.Parameter0, -) - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '200': typing.Type[response_200.ResponseFor200], - '400': typing.Type[response_400.ResponseFor400], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '404': typing.Type[response_404.ResponseFor404], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '200': response_200.ResponseFor200, - '400': response_400.ResponseFor400, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '404': response_404.ResponseFor404, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '200', -}) -_error_status_codes = frozenset({ - '400', - '401', - '403', - '404', - '406', - '412', -}) - -_all_accept_content_types = ( - "application/x-pem-file", -) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_csr_pem_post( - self, - body: typing.Union[ - distinguished_name.DistinguishedNameDictInput, - distinguished_name.DistinguishedNameDict, - ], - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[False] = False, - content_type: typing.Literal["application/json"] = "application/json", - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_200.ApiResponse: ... - - @typing.overload - def _keys_key_id_csr_pem_post( - self, - body: typing.Union[ - distinguished_name.DistinguishedNameDictInput, - distinguished_name.DistinguishedNameDict, - ], - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[True], - content_type: typing.Literal["application/json"] = "application/json", - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _keys_key_id_csr_pem_post( - self, - body: typing.Union[ - distinguished_name.DistinguishedNameDictInput, - distinguished_name.DistinguishedNameDict, - ], - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: bool = False, - content_type: typing.Literal["application/json"] = "application/json", - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - path_params = PathParameters.validate(path_params) - used_path, query_params_suffix = self._get_used_path( - path, - path_parameters=path_parameter_classes, - path_params=path_params, - skip_validation=True - ) - headers = self._get_headers(accept_content_types=accept_content_types) - # TODO add cookie handling - - fields, serialized_body = self._get_fields_and_body( - request_body=request_body.RequestBody, - body=body, - content_type=content_type, - headers=headers - ) - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//keys/{KeyID}/csr.pem/post/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='post', - host=host, - headers=headers, - fields=fields, - body=serialized_body, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '200', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '400', - '401', - '403', - '404', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class KeysKeyIDCsrPemPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - keys_key_id_csr_pem_post = BaseApi._keys_key_id_csr_pem_post - - -class ApiForPost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - post = BaseApi._keys_key_id_csr_pem_post diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/parameters/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/parameters/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/parameters/parameter_0/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/parameters/parameter_0/__init__.py deleted file mode 100644 index 29e0385b..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/parameters/parameter_0/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from . import schema - - -class Parameter0(api_client.PathParameter): - name = "KeyID" - style = api_client.ParameterStyle.SIMPLE - schema: typing_extensions.TypeAlias = schema.Schema - required = True diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/parameters/parameter_0/schema.py b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/parameters/parameter_0/schema.py deleted file mode 100644 index 951e9038..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/parameters/parameter_0/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -Schema: typing_extensions.TypeAlias = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/path_parameters.py b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/path_parameters.py deleted file mode 100644 index 3f0c47bf..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/path_parameters.py +++ /dev/null @@ -1,100 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema - -from pynitrokey.nethsm.client.paths.keys_key_id_csr_pem.post.parameters.parameter_0 import schema -Properties = typing.TypedDict( - 'Properties', - { - "KeyID": typing.Type[schema.Schema], - } -) - - -class PathParametersDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - - __required_keys__: typing.FrozenSet[str] = frozenset({ - "KeyID", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - KeyID: str, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - ): - arg_: typing.Dict[str, typing.Any] = { - "KeyID": KeyID, - } - used_arg_ = typing.cast(PathParametersDictInput, arg_) - return PathParameters.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return PathParameters.validate(arg, configuration=configuration) - - @property - def KeyID(self) -> str: - return typing.cast( - str, - self.__getitem__("KeyID") - ) -PathParametersDictInput = typing.TypedDict( - 'PathParametersDictInput', - { - "KeyID": str, - } -) - - -@dataclasses.dataclass(frozen=True) -class PathParameters( - schemas.Schema[PathParametersDict, tuple] -): - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "KeyID", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - additional_properties: typing.Type[AdditionalProperties] = dataclasses.field(default_factory=lambda: AdditionalProperties) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: PathParametersDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/request_body/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/request_body/__init__.py deleted file mode 100644 index ad29c4a8..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/request_body/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -class RequestBody(api_client.RequestBody): - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } - required = True diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/request_body/content/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/request_body/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/request_body/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/request_body/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/request_body/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/request_body/content/application_json/schema.py deleted file mode 100644 index 500078b6..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/request_body/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import distinguished_name -Schema: typing_extensions.TypeAlias = distinguished_name.DistinguishedName diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_200/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_200/__init__.py deleted file mode 100644 index 9354e71e..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_200/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_x_pem_file import schema as application_x_pem_file_schema - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: str - headers: schemas.Unset = schemas.unset - - -class ResponseFor200(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) - - - class ApplicationXPemFileMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_x_pem_file_schema.Schema - content = { - 'application/x-pem-file': ApplicationXPemFileMediaType, - } diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_200/content/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_200/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_200/content/application_x_pem_file/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_200/content/application_x_pem_file/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_200/content/application_x_pem_file/schema.py b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_200/content/application_x_pem_file/schema.py deleted file mode 100644 index dadf2ae9..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_200/content/application_x_pem_file/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import pem_csr -Schema: typing_extensions.TypeAlias = pem_csr.PemCSR diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_400/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_400/__init__.py deleted file mode 100644 index 0458793b..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_400/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor400(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_404/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_404/__init__.py deleted file mode 100644 index e43c74d8..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_404/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor404(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/security/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/__init__.py deleted file mode 100644 index f55549ac..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.keys_key_id_decrypt import KeysKeyIDDecrypt - -path = "/keys/{KeyID}/decrypt" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/operation.py b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/operation.py deleted file mode 100644 index dcad38a6..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/operation.py +++ /dev/null @@ -1,223 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import decrypt_request_data - -from .. import path -from .responses import ( - response_200, - response_400, - response_401, - response_403, - response_404, - response_406, - response_412, -) -from . import request_body -from .parameters import parameter_0 -from .security import security_requirement_object_0 -from .path_parameters import PathParameters, PathParametersDictInput, PathParametersDict -path_parameter_classes = ( - parameter_0.Parameter0, -) - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '200': typing.Type[response_200.ResponseFor200], - '400': typing.Type[response_400.ResponseFor400], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '404': typing.Type[response_404.ResponseFor404], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '200': response_200.ResponseFor200, - '400': response_400.ResponseFor400, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '404': response_404.ResponseFor404, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '200', -}) -_error_status_codes = frozenset({ - '400', - '401', - '403', - '404', - '406', - '412', -}) - -_all_accept_content_types = ( - "application/json", -) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_decrypt_post( - self, - body: typing.Union[ - decrypt_request_data.DecryptRequestDataDictInput, - decrypt_request_data.DecryptRequestDataDict, - ], - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[False] = False, - content_type: typing.Literal["application/json"] = "application/json", - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_200.ApiResponse: ... - - @typing.overload - def _keys_key_id_decrypt_post( - self, - body: typing.Union[ - decrypt_request_data.DecryptRequestDataDictInput, - decrypt_request_data.DecryptRequestDataDict, - ], - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[True], - content_type: typing.Literal["application/json"] = "application/json", - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _keys_key_id_decrypt_post( - self, - body: typing.Union[ - decrypt_request_data.DecryptRequestDataDictInput, - decrypt_request_data.DecryptRequestDataDict, - ], - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: bool = False, - content_type: typing.Literal["application/json"] = "application/json", - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - path_params = PathParameters.validate(path_params) - used_path, query_params_suffix = self._get_used_path( - path, - path_parameters=path_parameter_classes, - path_params=path_params, - skip_validation=True - ) - headers = self._get_headers(accept_content_types=accept_content_types) - # TODO add cookie handling - - fields, serialized_body = self._get_fields_and_body( - request_body=request_body.RequestBody, - body=body, - content_type=content_type, - headers=headers - ) - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//keys/{KeyID}/decrypt/post/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='post', - host=host, - headers=headers, - fields=fields, - body=serialized_body, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '200', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '400', - '401', - '403', - '404', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class KeysKeyIDDecryptPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - keys_key_id_decrypt_post = BaseApi._keys_key_id_decrypt_post - - -class ApiForPost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - post = BaseApi._keys_key_id_decrypt_post diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/parameters/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/parameters/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/parameters/parameter_0/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/parameters/parameter_0/__init__.py deleted file mode 100644 index 29e0385b..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/parameters/parameter_0/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from . import schema - - -class Parameter0(api_client.PathParameter): - name = "KeyID" - style = api_client.ParameterStyle.SIMPLE - schema: typing_extensions.TypeAlias = schema.Schema - required = True diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/parameters/parameter_0/schema.py b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/parameters/parameter_0/schema.py deleted file mode 100644 index 951e9038..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/parameters/parameter_0/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -Schema: typing_extensions.TypeAlias = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/path_parameters.py b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/path_parameters.py deleted file mode 100644 index d864052c..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/path_parameters.py +++ /dev/null @@ -1,100 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema - -from pynitrokey.nethsm.client.paths.keys_key_id_decrypt.post.parameters.parameter_0 import schema -Properties = typing.TypedDict( - 'Properties', - { - "KeyID": typing.Type[schema.Schema], - } -) - - -class PathParametersDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - - __required_keys__: typing.FrozenSet[str] = frozenset({ - "KeyID", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - KeyID: str, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - ): - arg_: typing.Dict[str, typing.Any] = { - "KeyID": KeyID, - } - used_arg_ = typing.cast(PathParametersDictInput, arg_) - return PathParameters.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return PathParameters.validate(arg, configuration=configuration) - - @property - def KeyID(self) -> str: - return typing.cast( - str, - self.__getitem__("KeyID") - ) -PathParametersDictInput = typing.TypedDict( - 'PathParametersDictInput', - { - "KeyID": str, - } -) - - -@dataclasses.dataclass(frozen=True) -class PathParameters( - schemas.Schema[PathParametersDict, tuple] -): - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "KeyID", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - additional_properties: typing.Type[AdditionalProperties] = dataclasses.field(default_factory=lambda: AdditionalProperties) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: PathParametersDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/request_body/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/request_body/__init__.py deleted file mode 100644 index ad29c4a8..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/request_body/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -class RequestBody(api_client.RequestBody): - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } - required = True diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/request_body/content/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/request_body/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/request_body/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/request_body/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/request_body/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/request_body/content/application_json/schema.py deleted file mode 100644 index 8fc31244..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/request_body/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import decrypt_request_data -Schema: typing_extensions.TypeAlias = decrypt_request_data.DecryptRequestData diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_200/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_200/__init__.py deleted file mode 100644 index 08652f9e..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_200/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: application_json_schema.decrypt_data.DecryptDataDict - headers: schemas.Unset = schemas.unset - - -class ResponseFor200(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_200/content/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_200/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_200/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_200/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_200/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_200/content/application_json/schema.py deleted file mode 100644 index f57a6fec..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_200/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import decrypt_data -Schema: typing_extensions.TypeAlias = decrypt_data.DecryptData diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_400/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_400/__init__.py deleted file mode 100644 index 0458793b..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_400/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor400(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_404/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_404/__init__.py deleted file mode 100644 index e43c74d8..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_404/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor404(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/security/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/__init__.py deleted file mode 100644 index ffcde5b3..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.keys_key_id_encrypt import KeysKeyIDEncrypt - -path = "/keys/{KeyID}/encrypt" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/operation.py b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/operation.py deleted file mode 100644 index 650e434a..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/operation.py +++ /dev/null @@ -1,223 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import encrypt_request_data - -from .. import path -from .responses import ( - response_200, - response_400, - response_401, - response_403, - response_404, - response_406, - response_412, -) -from . import request_body -from .parameters import parameter_0 -from .security import security_requirement_object_0 -from .path_parameters import PathParameters, PathParametersDictInput, PathParametersDict -path_parameter_classes = ( - parameter_0.Parameter0, -) - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '200': typing.Type[response_200.ResponseFor200], - '400': typing.Type[response_400.ResponseFor400], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '404': typing.Type[response_404.ResponseFor404], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '200': response_200.ResponseFor200, - '400': response_400.ResponseFor400, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '404': response_404.ResponseFor404, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '200', -}) -_error_status_codes = frozenset({ - '400', - '401', - '403', - '404', - '406', - '412', -}) - -_all_accept_content_types = ( - "application/json", -) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_encrypt_post( - self, - body: typing.Union[ - encrypt_request_data.EncryptRequestDataDictInput, - encrypt_request_data.EncryptRequestDataDict, - ], - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[False] = False, - content_type: typing.Literal["application/json"] = "application/json", - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_200.ApiResponse: ... - - @typing.overload - def _keys_key_id_encrypt_post( - self, - body: typing.Union[ - encrypt_request_data.EncryptRequestDataDictInput, - encrypt_request_data.EncryptRequestDataDict, - ], - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[True], - content_type: typing.Literal["application/json"] = "application/json", - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _keys_key_id_encrypt_post( - self, - body: typing.Union[ - encrypt_request_data.EncryptRequestDataDictInput, - encrypt_request_data.EncryptRequestDataDict, - ], - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: bool = False, - content_type: typing.Literal["application/json"] = "application/json", - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - path_params = PathParameters.validate(path_params) - used_path, query_params_suffix = self._get_used_path( - path, - path_parameters=path_parameter_classes, - path_params=path_params, - skip_validation=True - ) - headers = self._get_headers(accept_content_types=accept_content_types) - # TODO add cookie handling - - fields, serialized_body = self._get_fields_and_body( - request_body=request_body.RequestBody, - body=body, - content_type=content_type, - headers=headers - ) - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//keys/{KeyID}/encrypt/post/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='post', - host=host, - headers=headers, - fields=fields, - body=serialized_body, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '200', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '400', - '401', - '403', - '404', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class KeysKeyIDEncryptPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - keys_key_id_encrypt_post = BaseApi._keys_key_id_encrypt_post - - -class ApiForPost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - post = BaseApi._keys_key_id_encrypt_post diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/parameters/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/parameters/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/parameters/parameter_0/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/parameters/parameter_0/__init__.py deleted file mode 100644 index 29e0385b..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/parameters/parameter_0/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from . import schema - - -class Parameter0(api_client.PathParameter): - name = "KeyID" - style = api_client.ParameterStyle.SIMPLE - schema: typing_extensions.TypeAlias = schema.Schema - required = True diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/parameters/parameter_0/schema.py b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/parameters/parameter_0/schema.py deleted file mode 100644 index 951e9038..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/parameters/parameter_0/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -Schema: typing_extensions.TypeAlias = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/path_parameters.py b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/path_parameters.py deleted file mode 100644 index 2e93a97b..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/path_parameters.py +++ /dev/null @@ -1,100 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema - -from pynitrokey.nethsm.client.paths.keys_key_id_encrypt.post.parameters.parameter_0 import schema -Properties = typing.TypedDict( - 'Properties', - { - "KeyID": typing.Type[schema.Schema], - } -) - - -class PathParametersDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - - __required_keys__: typing.FrozenSet[str] = frozenset({ - "KeyID", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - KeyID: str, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - ): - arg_: typing.Dict[str, typing.Any] = { - "KeyID": KeyID, - } - used_arg_ = typing.cast(PathParametersDictInput, arg_) - return PathParameters.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return PathParameters.validate(arg, configuration=configuration) - - @property - def KeyID(self) -> str: - return typing.cast( - str, - self.__getitem__("KeyID") - ) -PathParametersDictInput = typing.TypedDict( - 'PathParametersDictInput', - { - "KeyID": str, - } -) - - -@dataclasses.dataclass(frozen=True) -class PathParameters( - schemas.Schema[PathParametersDict, tuple] -): - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "KeyID", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - additional_properties: typing.Type[AdditionalProperties] = dataclasses.field(default_factory=lambda: AdditionalProperties) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: PathParametersDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/request_body/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/request_body/__init__.py deleted file mode 100644 index ad29c4a8..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/request_body/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -class RequestBody(api_client.RequestBody): - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } - required = True diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/request_body/content/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/request_body/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/request_body/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/request_body/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/request_body/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/request_body/content/application_json/schema.py deleted file mode 100644 index 4d496175..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/request_body/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import encrypt_request_data -Schema: typing_extensions.TypeAlias = encrypt_request_data.EncryptRequestData diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_200/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_200/__init__.py deleted file mode 100644 index f7309ebd..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_200/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: application_json_schema.encrypt_data.EncryptDataDict - headers: schemas.Unset = schemas.unset - - -class ResponseFor200(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_200/content/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_200/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_200/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_200/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_200/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_200/content/application_json/schema.py deleted file mode 100644 index a2d5fc49..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_200/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import encrypt_data -Schema: typing_extensions.TypeAlias = encrypt_data.EncryptData diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_400/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_400/__init__.py deleted file mode 100644 index 0458793b..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_400/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor400(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_404/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_404/__init__.py deleted file mode 100644 index e43c74d8..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_404/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor404(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/security/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/__init__.py deleted file mode 100644 index 608b4298..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.keys_key_id_public_pem import KeysKeyIDPublicPem - -path = "/keys/{KeyID}/public.pem" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/operation.py b/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/operation.py deleted file mode 100644 index 02468708..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/operation.py +++ /dev/null @@ -1,197 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .. import path -from .responses import ( - response_200, - response_400, - response_401, - response_403, - response_404, - response_406, - response_412, -) -from .parameters import parameter_0 -from .security import security_requirement_object_0 -from .path_parameters import PathParameters, PathParametersDictInput, PathParametersDict -path_parameter_classes = ( - parameter_0.Parameter0, -) - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '200': typing.Type[response_200.ResponseFor200], - '400': typing.Type[response_400.ResponseFor400], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '404': typing.Type[response_404.ResponseFor404], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '200': response_200.ResponseFor200, - '400': response_400.ResponseFor400, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '404': response_404.ResponseFor404, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '200', -}) -_error_status_codes = frozenset({ - '400', - '401', - '403', - '404', - '406', - '412', -}) - -_all_accept_content_types = ( - "application/x-pem-file", -) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_public_pem_get( - self, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[False] = False, - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_200.ApiResponse: ... - - @typing.overload - def _keys_key_id_public_pem_get( - self, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[True], - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _keys_key_id_public_pem_get( - self, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: bool = False, - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - path_params = PathParameters.validate(path_params) - used_path, query_params_suffix = self._get_used_path( - path, - path_parameters=path_parameter_classes, - path_params=path_params, - skip_validation=True - ) - headers = self._get_headers(accept_content_types=accept_content_types) - # TODO add cookie handling - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//keys/{KeyID}/public.pem/get/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='get', - host=host, - headers=headers, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '200', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '400', - '401', - '403', - '404', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class KeysKeyIDPublicPemGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - keys_key_id_public_pem_get = BaseApi._keys_key_id_public_pem_get - - -class ApiForGet(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - get = BaseApi._keys_key_id_public_pem_get diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/parameters/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/parameters/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/parameters/parameter_0/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/parameters/parameter_0/__init__.py deleted file mode 100644 index 29e0385b..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/parameters/parameter_0/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from . import schema - - -class Parameter0(api_client.PathParameter): - name = "KeyID" - style = api_client.ParameterStyle.SIMPLE - schema: typing_extensions.TypeAlias = schema.Schema - required = True diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/parameters/parameter_0/schema.py b/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/parameters/parameter_0/schema.py deleted file mode 100644 index 951e9038..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/parameters/parameter_0/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -Schema: typing_extensions.TypeAlias = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/path_parameters.py b/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/path_parameters.py deleted file mode 100644 index 8c57d6bc..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/path_parameters.py +++ /dev/null @@ -1,100 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema - -from pynitrokey.nethsm.client.paths.keys_key_id_public_pem.get.parameters.parameter_0 import schema -Properties = typing.TypedDict( - 'Properties', - { - "KeyID": typing.Type[schema.Schema], - } -) - - -class PathParametersDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - - __required_keys__: typing.FrozenSet[str] = frozenset({ - "KeyID", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - KeyID: str, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - ): - arg_: typing.Dict[str, typing.Any] = { - "KeyID": KeyID, - } - used_arg_ = typing.cast(PathParametersDictInput, arg_) - return PathParameters.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return PathParameters.validate(arg, configuration=configuration) - - @property - def KeyID(self) -> str: - return typing.cast( - str, - self.__getitem__("KeyID") - ) -PathParametersDictInput = typing.TypedDict( - 'PathParametersDictInput', - { - "KeyID": str, - } -) - - -@dataclasses.dataclass(frozen=True) -class PathParameters( - schemas.Schema[PathParametersDict, tuple] -): - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "KeyID", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - additional_properties: typing.Type[AdditionalProperties] = dataclasses.field(default_factory=lambda: AdditionalProperties) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: PathParametersDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_200/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_200/__init__.py deleted file mode 100644 index 9354e71e..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_200/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_x_pem_file import schema as application_x_pem_file_schema - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: str - headers: schemas.Unset = schemas.unset - - -class ResponseFor200(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) - - - class ApplicationXPemFileMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_x_pem_file_schema.Schema - content = { - 'application/x-pem-file': ApplicationXPemFileMediaType, - } diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_200/content/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_200/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_200/content/application_x_pem_file/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_200/content/application_x_pem_file/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_200/content/application_x_pem_file/schema.py b/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_200/content/application_x_pem_file/schema.py deleted file mode 100644 index 82e35dcd..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_200/content/application_x_pem_file/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import pem_public_key -Schema: typing_extensions.TypeAlias = pem_public_key.PemPublicKey diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_400/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_400/__init__.py deleted file mode 100644 index 0458793b..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_400/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor400(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_404/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_404/__init__.py deleted file mode 100644 index e43c74d8..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_404/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor404(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/security/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/__init__.py deleted file mode 100644 index 0a6330fe..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.keys_key_id_restrictions_tags_tag import KeysKeyIDRestrictionsTagsTag - -path = "/keys/{KeyID}/restrictions/tags/{Tag}" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/operation.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/operation.py deleted file mode 100644 index d972c7bb..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/operation.py +++ /dev/null @@ -1,187 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .. import path -from .responses import ( - response_204, - response_401, - response_403, - response_404, - response_406, - response_412, -) -from .parameters import ( - parameter_0, - parameter_1, -) -from .security import security_requirement_object_0 -from .path_parameters import PathParameters, PathParametersDictInput, PathParametersDict -path_parameter_classes = ( - parameter_0.Parameter0, - parameter_1.Parameter1, -) - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '204': typing.Type[response_204.ResponseFor204], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '404': typing.Type[response_404.ResponseFor404], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '204': response_204.ResponseFor204, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '404': response_404.ResponseFor404, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '204', -}) -_error_status_codes = frozenset({ - '401', - '403', - '404', - '406', - '412', -}) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_restrictions_tags_tag_delete( - self, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[False] = False, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_204.ApiResponse: ... - - @typing.overload - def _keys_key_id_restrictions_tags_tag_delete( - self, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[True], - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _keys_key_id_restrictions_tags_tag_delete( - self, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: bool = False, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - path_params = PathParameters.validate(path_params) - used_path, query_params_suffix = self._get_used_path( - path, - path_parameters=path_parameter_classes, - path_params=path_params, - skip_validation=True - ) - # TODO add cookie handling - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//keys/{KeyID}/restrictions/tags/{Tag}/delete/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='delete', - host=host, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '204', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '401', - '403', - '404', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class KeysKeyIDRestrictionsTagsTagDelete(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - keys_key_id_restrictions_tags_tag_delete = BaseApi._keys_key_id_restrictions_tags_tag_delete - - -class ApiForDelete(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - delete = BaseApi._keys_key_id_restrictions_tags_tag_delete diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/parameters/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/parameters/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/parameters/parameter_0/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/parameters/parameter_0/__init__.py deleted file mode 100644 index 476a96cc..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/parameters/parameter_0/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from . import schema - - -class Parameter0(api_client.PathParameter): - name = "Tag" - style = api_client.ParameterStyle.SIMPLE - schema: typing_extensions.TypeAlias = schema.Schema - required = True diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/parameters/parameter_0/schema.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/parameters/parameter_0/schema.py deleted file mode 100644 index 951e9038..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/parameters/parameter_0/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -Schema: typing_extensions.TypeAlias = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/parameters/parameter_1/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/parameters/parameter_1/__init__.py deleted file mode 100644 index 6e6a5f19..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/parameters/parameter_1/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from . import schema - - -class Parameter1(api_client.PathParameter): - name = "KeyID" - style = api_client.ParameterStyle.SIMPLE - schema: typing_extensions.TypeAlias = schema.Schema - required = True diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/parameters/parameter_1/schema.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/parameters/parameter_1/schema.py deleted file mode 100644 index 951e9038..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/parameters/parameter_1/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -Schema: typing_extensions.TypeAlias = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/path_parameters.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/path_parameters.py deleted file mode 100644 index 2de5ce89..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/path_parameters.py +++ /dev/null @@ -1,113 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema - -from pynitrokey.nethsm.client.paths.keys_key_id_restrictions_tags_tag.delete.parameters.parameter_0 import schema as schema_2 -from pynitrokey.nethsm.client.paths.keys_key_id_restrictions_tags_tag.delete.parameters.parameter_1 import schema -Properties = typing.TypedDict( - 'Properties', - { - "KeyID": typing.Type[schema.Schema], - "Tag": typing.Type[schema_2.Schema], - } -) - - -class PathParametersDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - __required_keys__: typing.FrozenSet[str] = frozenset({ - "KeyID", - "Tag", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - KeyID: str, - Tag: str, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - ): - arg_: typing.Dict[str, typing.Any] = { - "KeyID": KeyID, - "Tag": Tag, - } - used_arg_ = typing.cast(PathParametersDictInput, arg_) - return PathParameters.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return PathParameters.validate(arg, configuration=configuration) - - @property - def KeyID(self) -> str: - return typing.cast( - str, - self.__getitem__("KeyID") - ) - - @property - def Tag(self) -> str: - return typing.cast( - str, - self.__getitem__("Tag") - ) -PathParametersDictInput = typing.TypedDict( - 'PathParametersDictInput', - { - "KeyID": str, - "Tag": str, - } -) - - -@dataclasses.dataclass(frozen=True) -class PathParameters( - schemas.Schema[PathParametersDict, tuple] -): - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "KeyID", - "Tag", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - additional_properties: typing.Type[AdditionalProperties] = dataclasses.field(default_factory=lambda: AdditionalProperties) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: PathParametersDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/response_204/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/response_204/__init__.py deleted file mode 100644 index 8e822e77..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/response_204/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor204(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/response_404/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/response_404/__init__.py deleted file mode 100644 index e43c74d8..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/response_404/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor404(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/security/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/operation.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/operation.py deleted file mode 100644 index 977b4cd6..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/operation.py +++ /dev/null @@ -1,200 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .. import path -from .responses import ( - response_204, - response_304, - response_400, - response_401, - response_403, - response_404, - response_406, - response_412, -) -from .parameters import ( - parameter_0, - parameter_1, -) -from .security import security_requirement_object_0 -from .path_parameters import PathParameters, PathParametersDictInput, PathParametersDict -path_parameter_classes = ( - parameter_0.Parameter0, - parameter_1.Parameter1, -) - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '204': typing.Type[response_204.ResponseFor204], - '304': typing.Type[response_304.ResponseFor304], - '400': typing.Type[response_400.ResponseFor400], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '404': typing.Type[response_404.ResponseFor404], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '204': response_204.ResponseFor204, - '304': response_304.ResponseFor304, - '400': response_400.ResponseFor400, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '404': response_404.ResponseFor404, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '204', - '304', -}) -_error_status_codes = frozenset({ - '400', - '401', - '403', - '404', - '406', - '412', -}) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_restrictions_tags_tag_put( - self, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[False] = False, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> typing.Union[ - response_204.ApiResponse, - response_304.ApiResponse, - ]: ... - - @typing.overload - def _keys_key_id_restrictions_tags_tag_put( - self, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[True], - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _keys_key_id_restrictions_tags_tag_put( - self, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: bool = False, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - path_params = PathParameters.validate(path_params) - used_path, query_params_suffix = self._get_used_path( - path, - path_parameters=path_parameter_classes, - path_params=path_params, - skip_validation=True - ) - # TODO add cookie handling - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//keys/{KeyID}/restrictions/tags/{Tag}/put/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='put', - host=host, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '204', - '304', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '400', - '401', - '403', - '404', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class KeysKeyIDRestrictionsTagsTagPut(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - keys_key_id_restrictions_tags_tag_put = BaseApi._keys_key_id_restrictions_tags_tag_put - - -class ApiForPut(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - put = BaseApi._keys_key_id_restrictions_tags_tag_put diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/parameters/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/parameters/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/parameters/parameter_0/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/parameters/parameter_0/__init__.py deleted file mode 100644 index 476a96cc..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/parameters/parameter_0/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from . import schema - - -class Parameter0(api_client.PathParameter): - name = "Tag" - style = api_client.ParameterStyle.SIMPLE - schema: typing_extensions.TypeAlias = schema.Schema - required = True diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/parameters/parameter_0/schema.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/parameters/parameter_0/schema.py deleted file mode 100644 index 951e9038..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/parameters/parameter_0/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -Schema: typing_extensions.TypeAlias = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/parameters/parameter_1/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/parameters/parameter_1/__init__.py deleted file mode 100644 index 6e6a5f19..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/parameters/parameter_1/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from . import schema - - -class Parameter1(api_client.PathParameter): - name = "KeyID" - style = api_client.ParameterStyle.SIMPLE - schema: typing_extensions.TypeAlias = schema.Schema - required = True diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/parameters/parameter_1/schema.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/parameters/parameter_1/schema.py deleted file mode 100644 index 951e9038..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/parameters/parameter_1/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -Schema: typing_extensions.TypeAlias = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/path_parameters.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/path_parameters.py deleted file mode 100644 index 0e94422f..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/path_parameters.py +++ /dev/null @@ -1,113 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema - -from pynitrokey.nethsm.client.paths.keys_key_id_restrictions_tags_tag.put.parameters.parameter_0 import schema as schema_2 -from pynitrokey.nethsm.client.paths.keys_key_id_restrictions_tags_tag.put.parameters.parameter_1 import schema -Properties = typing.TypedDict( - 'Properties', - { - "KeyID": typing.Type[schema.Schema], - "Tag": typing.Type[schema_2.Schema], - } -) - - -class PathParametersDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - __required_keys__: typing.FrozenSet[str] = frozenset({ - "KeyID", - "Tag", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - KeyID: str, - Tag: str, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - ): - arg_: typing.Dict[str, typing.Any] = { - "KeyID": KeyID, - "Tag": Tag, - } - used_arg_ = typing.cast(PathParametersDictInput, arg_) - return PathParameters.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return PathParameters.validate(arg, configuration=configuration) - - @property - def KeyID(self) -> str: - return typing.cast( - str, - self.__getitem__("KeyID") - ) - - @property - def Tag(self) -> str: - return typing.cast( - str, - self.__getitem__("Tag") - ) -PathParametersDictInput = typing.TypedDict( - 'PathParametersDictInput', - { - "KeyID": str, - "Tag": str, - } -) - - -@dataclasses.dataclass(frozen=True) -class PathParameters( - schemas.Schema[PathParametersDict, tuple] -): - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "KeyID", - "Tag", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - additional_properties: typing.Type[AdditionalProperties] = dataclasses.field(default_factory=lambda: AdditionalProperties) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: PathParametersDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_204/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_204/__init__.py deleted file mode 100644 index 8e822e77..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_204/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor204(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_304/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_304/__init__.py deleted file mode 100644 index 287e3265..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_304/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor304(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_400/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_400/__init__.py deleted file mode 100644 index 0458793b..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_400/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor400(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_404/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_404/__init__.py deleted file mode 100644 index e43c74d8..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_404/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor404(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/security/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_sign/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_sign/__init__.py deleted file mode 100644 index 0c954441..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_sign/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.keys_key_id_sign import KeysKeyIDSign - -path = "/keys/{KeyID}/sign" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/operation.py b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/operation.py deleted file mode 100644 index 000cde0f..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/operation.py +++ /dev/null @@ -1,223 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import sign_request_data - -from .. import path -from .responses import ( - response_200, - response_400, - response_401, - response_403, - response_404, - response_406, - response_412, -) -from . import request_body -from .parameters import parameter_0 -from .security import security_requirement_object_0 -from .path_parameters import PathParameters, PathParametersDictInput, PathParametersDict -path_parameter_classes = ( - parameter_0.Parameter0, -) - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '200': typing.Type[response_200.ResponseFor200], - '400': typing.Type[response_400.ResponseFor400], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '404': typing.Type[response_404.ResponseFor404], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '200': response_200.ResponseFor200, - '400': response_400.ResponseFor400, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '404': response_404.ResponseFor404, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '200', -}) -_error_status_codes = frozenset({ - '400', - '401', - '403', - '404', - '406', - '412', -}) - -_all_accept_content_types = ( - "application/json", -) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_sign_post( - self, - body: typing.Union[ - sign_request_data.SignRequestDataDictInput, - sign_request_data.SignRequestDataDict, - ], - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[False] = False, - content_type: typing.Literal["application/json"] = "application/json", - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_200.ApiResponse: ... - - @typing.overload - def _keys_key_id_sign_post( - self, - body: typing.Union[ - sign_request_data.SignRequestDataDictInput, - sign_request_data.SignRequestDataDict, - ], - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[True], - content_type: typing.Literal["application/json"] = "application/json", - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _keys_key_id_sign_post( - self, - body: typing.Union[ - sign_request_data.SignRequestDataDictInput, - sign_request_data.SignRequestDataDict, - ], - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: bool = False, - content_type: typing.Literal["application/json"] = "application/json", - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - path_params = PathParameters.validate(path_params) - used_path, query_params_suffix = self._get_used_path( - path, - path_parameters=path_parameter_classes, - path_params=path_params, - skip_validation=True - ) - headers = self._get_headers(accept_content_types=accept_content_types) - # TODO add cookie handling - - fields, serialized_body = self._get_fields_and_body( - request_body=request_body.RequestBody, - body=body, - content_type=content_type, - headers=headers - ) - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//keys/{KeyID}/sign/post/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='post', - host=host, - headers=headers, - fields=fields, - body=serialized_body, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '200', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '400', - '401', - '403', - '404', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class KeysKeyIDSignPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - keys_key_id_sign_post = BaseApi._keys_key_id_sign_post - - -class ApiForPost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - post = BaseApi._keys_key_id_sign_post diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/parameters/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/parameters/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/parameters/parameter_0/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/parameters/parameter_0/__init__.py deleted file mode 100644 index 29e0385b..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/parameters/parameter_0/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from . import schema - - -class Parameter0(api_client.PathParameter): - name = "KeyID" - style = api_client.ParameterStyle.SIMPLE - schema: typing_extensions.TypeAlias = schema.Schema - required = True diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/parameters/parameter_0/schema.py b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/parameters/parameter_0/schema.py deleted file mode 100644 index 951e9038..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/parameters/parameter_0/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -Schema: typing_extensions.TypeAlias = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/path_parameters.py b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/path_parameters.py deleted file mode 100644 index 1369866a..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/path_parameters.py +++ /dev/null @@ -1,100 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema - -from pynitrokey.nethsm.client.paths.keys_key_id_sign.post.parameters.parameter_0 import schema -Properties = typing.TypedDict( - 'Properties', - { - "KeyID": typing.Type[schema.Schema], - } -) - - -class PathParametersDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - - __required_keys__: typing.FrozenSet[str] = frozenset({ - "KeyID", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - KeyID: str, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - ): - arg_: typing.Dict[str, typing.Any] = { - "KeyID": KeyID, - } - used_arg_ = typing.cast(PathParametersDictInput, arg_) - return PathParameters.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return PathParameters.validate(arg, configuration=configuration) - - @property - def KeyID(self) -> str: - return typing.cast( - str, - self.__getitem__("KeyID") - ) -PathParametersDictInput = typing.TypedDict( - 'PathParametersDictInput', - { - "KeyID": str, - } -) - - -@dataclasses.dataclass(frozen=True) -class PathParameters( - schemas.Schema[PathParametersDict, tuple] -): - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "KeyID", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - additional_properties: typing.Type[AdditionalProperties] = dataclasses.field(default_factory=lambda: AdditionalProperties) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: PathParametersDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/request_body/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/request_body/__init__.py deleted file mode 100644 index ad29c4a8..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/request_body/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -class RequestBody(api_client.RequestBody): - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } - required = True diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/request_body/content/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/request_body/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/request_body/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/request_body/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/request_body/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/request_body/content/application_json/schema.py deleted file mode 100644 index e2dc4b06..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/request_body/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import sign_request_data -Schema: typing_extensions.TypeAlias = sign_request_data.SignRequestData diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_200/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_200/__init__.py deleted file mode 100644 index ceb5e774..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_200/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: application_json_schema.sign_data.SignDataDict - headers: schemas.Unset = schemas.unset - - -class ResponseFor200(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_200/content/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_200/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_200/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_200/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_200/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_200/content/application_json/schema.py deleted file mode 100644 index 8a3a0d87..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_200/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import sign_data -Schema: typing_extensions.TypeAlias = sign_data.SignData diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_400/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_400/__init__.py deleted file mode 100644 index 0458793b..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_400/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor400(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_404/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_404/__init__.py deleted file mode 100644 index e43c74d8..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_404/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor404(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/security/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/lock/__init__.py b/pynitrokey/nethsm/client/paths/lock/__init__.py deleted file mode 100644 index d3a99891..00000000 --- a/pynitrokey/nethsm/client/paths/lock/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.lock import Lock - -path = "/lock" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/lock/post/__init__.py b/pynitrokey/nethsm/client/paths/lock/post/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/lock/post/operation.py b/pynitrokey/nethsm/client/paths/lock/post/operation.py deleted file mode 100644 index f4c30dd8..00000000 --- a/pynitrokey/nethsm/client/paths/lock/post/operation.py +++ /dev/null @@ -1,155 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .. import path -from .responses import ( - response_204, - response_401, - response_403, - response_406, - response_412, -) -from .security import security_requirement_object_0 - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '204': typing.Type[response_204.ResponseFor204], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '204': response_204.ResponseFor204, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '204', -}) -_error_status_codes = frozenset({ - '401', - '403', - '406', - '412', -}) - - -class BaseApi(api_client.Api): - @typing.overload - def _lock_post( - self, - *, - skip_deserialization: typing.Literal[False] = False, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_204.ApiResponse: ... - - @typing.overload - def _lock_post( - self, - *, - skip_deserialization: typing.Literal[True], - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _lock_post( - self, - *, - skip_deserialization: bool = False, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path - # TODO add cookie handling - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//lock/post/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='post', - host=host, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '204', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '401', - '403', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class LockPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - lock_post = BaseApi._lock_post - - -class ApiForPost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - post = BaseApi._lock_post diff --git a/pynitrokey/nethsm/client/paths/lock/post/responses/__init__.py b/pynitrokey/nethsm/client/paths/lock/post/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/lock/post/responses/response_204/__init__.py b/pynitrokey/nethsm/client/paths/lock/post/responses/response_204/__init__.py deleted file mode 100644 index 8e822e77..00000000 --- a/pynitrokey/nethsm/client/paths/lock/post/responses/response_204/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor204(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/lock/post/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/lock/post/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/lock/post/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/lock/post/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/lock/post/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/lock/post/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/lock/post/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/lock/post/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/lock/post/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/lock/post/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/lock/post/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/lock/post/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/lock/post/security/__init__.py b/pynitrokey/nethsm/client/paths/lock/post/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/lock/post/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/lock/post/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/lock/post/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/metrics/__init__.py b/pynitrokey/nethsm/client/paths/metrics/__init__.py deleted file mode 100644 index d6b45ce5..00000000 --- a/pynitrokey/nethsm/client/paths/metrics/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.metrics import Metrics - -path = "/metrics" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/metrics/get/__init__.py b/pynitrokey/nethsm/client/paths/metrics/get/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/metrics/get/operation.py b/pynitrokey/nethsm/client/paths/metrics/get/operation.py deleted file mode 100644 index 21f1db42..00000000 --- a/pynitrokey/nethsm/client/paths/metrics/get/operation.py +++ /dev/null @@ -1,164 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .. import path -from .responses import ( - response_200, - response_401, - response_403, - response_406, - response_412, -) -from .security import security_requirement_object_0 - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '200': typing.Type[response_200.ResponseFor200], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '200': response_200.ResponseFor200, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '200', -}) -_error_status_codes = frozenset({ - '401', - '403', - '406', - '412', -}) - -_all_accept_content_types = ( - "application/json", -) - - -class BaseApi(api_client.Api): - @typing.overload - def _metrics_get( - self, - *, - skip_deserialization: typing.Literal[False] = False, - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_200.ApiResponse: ... - - @typing.overload - def _metrics_get( - self, - *, - skip_deserialization: typing.Literal[True], - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _metrics_get( - self, - *, - skip_deserialization: bool = False, - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path - headers = self._get_headers(accept_content_types=accept_content_types) - # TODO add cookie handling - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//metrics/get/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='get', - host=host, - headers=headers, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '200', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '401', - '403', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class MetricsGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - metrics_get = BaseApi._metrics_get - - -class ApiForGet(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - get = BaseApi._metrics_get diff --git a/pynitrokey/nethsm/client/paths/metrics/get/responses/__init__.py b/pynitrokey/nethsm/client/paths/metrics/get/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/metrics/get/responses/response_200/__init__.py b/pynitrokey/nethsm/client/paths/metrics/get/responses/response_200/__init__.py deleted file mode 100644 index 1a163a3e..00000000 --- a/pynitrokey/nethsm/client/paths/metrics/get/responses/response_200/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES] - headers: schemas.Unset = schemas.unset - - -class ResponseFor200(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } diff --git a/pynitrokey/nethsm/client/paths/metrics/get/responses/response_200/content/__init__.py b/pynitrokey/nethsm/client/paths/metrics/get/responses/response_200/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/metrics/get/responses/response_200/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/metrics/get/responses/response_200/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/metrics/get/responses/response_200/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/metrics/get/responses/response_200/content/application_json/schema.py deleted file mode 100644 index d2dd7a3d..00000000 --- a/pynitrokey/nethsm/client/paths/metrics/get/responses/response_200/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import metrics_data -Schema: typing_extensions.TypeAlias = metrics_data.MetricsData diff --git a/pynitrokey/nethsm/client/paths/metrics/get/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/metrics/get/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/metrics/get/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/metrics/get/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/metrics/get/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/metrics/get/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/metrics/get/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/metrics/get/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/metrics/get/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/metrics/get/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/metrics/get/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/metrics/get/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/metrics/get/security/__init__.py b/pynitrokey/nethsm/client/paths/metrics/get/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/metrics/get/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/metrics/get/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/metrics/get/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/provision/__init__.py b/pynitrokey/nethsm/client/paths/provision/__init__.py deleted file mode 100644 index ff082400..00000000 --- a/pynitrokey/nethsm/client/paths/provision/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.provision import Provision - -path = "/provision" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/provision/post/__init__.py b/pynitrokey/nethsm/client/paths/provision/post/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/provision/post/operation.py b/pynitrokey/nethsm/client/paths/provision/post/operation.py deleted file mode 100644 index 2a8db709..00000000 --- a/pynitrokey/nethsm/client/paths/provision/post/operation.py +++ /dev/null @@ -1,164 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import provision_request_data - -from .. import path -from .responses import ( - response_204, - response_400, - response_406, - response_412, -) -from . import request_body - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '204': typing.Type[response_204.ResponseFor204], - '400': typing.Type[response_400.ResponseFor400], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '204': response_204.ResponseFor204, - '400': response_400.ResponseFor400, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '204', -}) -_error_status_codes = frozenset({ - '400', - '406', - '412', -}) - - -class BaseApi(api_client.Api): - @typing.overload - def _provision_post( - self, - body: typing.Union[ - provision_request_data.ProvisionRequestDataDictInput, - provision_request_data.ProvisionRequestDataDict, - ], - *, - skip_deserialization: typing.Literal[False] = False, - content_type: typing.Literal["application/json"] = "application/json", - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_204.ApiResponse: ... - - @typing.overload - def _provision_post( - self, - body: typing.Union[ - provision_request_data.ProvisionRequestDataDictInput, - provision_request_data.ProvisionRequestDataDict, - ], - *, - skip_deserialization: typing.Literal[True], - content_type: typing.Literal["application/json"] = "application/json", - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _provision_post( - self, - body: typing.Union[ - provision_request_data.ProvisionRequestDataDictInput, - provision_request_data.ProvisionRequestDataDict, - ], - *, - skip_deserialization: bool = False, - content_type: typing.Literal["application/json"] = "application/json", - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path - headers = self._get_headers() - # TODO add cookie handling - - fields, serialized_body = self._get_fields_and_body( - request_body=request_body.RequestBody, - body=body, - content_type=content_type, - headers=headers - ) - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='post', - host=host, - headers=headers, - fields=fields, - body=serialized_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '204', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '400', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class ProvisionPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - provision_post = BaseApi._provision_post - - -class ApiForPost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - post = BaseApi._provision_post diff --git a/pynitrokey/nethsm/client/paths/provision/post/request_body/__init__.py b/pynitrokey/nethsm/client/paths/provision/post/request_body/__init__.py deleted file mode 100644 index ad29c4a8..00000000 --- a/pynitrokey/nethsm/client/paths/provision/post/request_body/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -class RequestBody(api_client.RequestBody): - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } - required = True diff --git a/pynitrokey/nethsm/client/paths/provision/post/request_body/content/__init__.py b/pynitrokey/nethsm/client/paths/provision/post/request_body/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/provision/post/request_body/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/provision/post/request_body/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/provision/post/request_body/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/provision/post/request_body/content/application_json/schema.py deleted file mode 100644 index a492e70e..00000000 --- a/pynitrokey/nethsm/client/paths/provision/post/request_body/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import provision_request_data -Schema: typing_extensions.TypeAlias = provision_request_data.ProvisionRequestData diff --git a/pynitrokey/nethsm/client/paths/provision/post/responses/__init__.py b/pynitrokey/nethsm/client/paths/provision/post/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/provision/post/responses/response_204/__init__.py b/pynitrokey/nethsm/client/paths/provision/post/responses/response_204/__init__.py deleted file mode 100644 index 8e822e77..00000000 --- a/pynitrokey/nethsm/client/paths/provision/post/responses/response_204/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor204(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/provision/post/responses/response_400/__init__.py b/pynitrokey/nethsm/client/paths/provision/post/responses/response_400/__init__.py deleted file mode 100644 index 0458793b..00000000 --- a/pynitrokey/nethsm/client/paths/provision/post/responses/response_400/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor400(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/provision/post/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/provision/post/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/provision/post/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/provision/post/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/provision/post/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/provision/post/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/random/__init__.py b/pynitrokey/nethsm/client/paths/random/__init__.py deleted file mode 100644 index bb6d109a..00000000 --- a/pynitrokey/nethsm/client/paths/random/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.random import Random - -path = "/random" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/random/post/__init__.py b/pynitrokey/nethsm/client/paths/random/post/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/random/post/operation.py b/pynitrokey/nethsm/client/paths/random/post/operation.py deleted file mode 100644 index 72c64a12..00000000 --- a/pynitrokey/nethsm/client/paths/random/post/operation.py +++ /dev/null @@ -1,195 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import random_request_data - -from .. import path -from .responses import ( - response_200, - response_400, - response_401, - response_403, - response_406, - response_412, -) -from . import request_body -from .security import security_requirement_object_0 - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '200': typing.Type[response_200.ResponseFor200], - '400': typing.Type[response_400.ResponseFor400], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '200': response_200.ResponseFor200, - '400': response_400.ResponseFor400, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '200', -}) -_error_status_codes = frozenset({ - '400', - '401', - '403', - '406', - '412', -}) - -_all_accept_content_types = ( - "application/json", -) - - -class BaseApi(api_client.Api): - @typing.overload - def _random_post( - self, - body: typing.Union[ - random_request_data.RandomRequestDataDictInput, - random_request_data.RandomRequestDataDict, - ], - *, - skip_deserialization: typing.Literal[False] = False, - content_type: typing.Literal["application/json"] = "application/json", - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_200.ApiResponse: ... - - @typing.overload - def _random_post( - self, - body: typing.Union[ - random_request_data.RandomRequestDataDictInput, - random_request_data.RandomRequestDataDict, - ], - *, - skip_deserialization: typing.Literal[True], - content_type: typing.Literal["application/json"] = "application/json", - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _random_post( - self, - body: typing.Union[ - random_request_data.RandomRequestDataDictInput, - random_request_data.RandomRequestDataDict, - ], - *, - skip_deserialization: bool = False, - content_type: typing.Literal["application/json"] = "application/json", - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path - headers = self._get_headers(accept_content_types=accept_content_types) - # TODO add cookie handling - - fields, serialized_body = self._get_fields_and_body( - request_body=request_body.RequestBody, - body=body, - content_type=content_type, - headers=headers - ) - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//random/post/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='post', - host=host, - headers=headers, - fields=fields, - body=serialized_body, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '200', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '400', - '401', - '403', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class RandomPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - random_post = BaseApi._random_post - - -class ApiForPost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - post = BaseApi._random_post diff --git a/pynitrokey/nethsm/client/paths/random/post/request_body/__init__.py b/pynitrokey/nethsm/client/paths/random/post/request_body/__init__.py deleted file mode 100644 index ad29c4a8..00000000 --- a/pynitrokey/nethsm/client/paths/random/post/request_body/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -class RequestBody(api_client.RequestBody): - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } - required = True diff --git a/pynitrokey/nethsm/client/paths/random/post/request_body/content/__init__.py b/pynitrokey/nethsm/client/paths/random/post/request_body/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/random/post/request_body/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/random/post/request_body/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/random/post/request_body/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/random/post/request_body/content/application_json/schema.py deleted file mode 100644 index b1d691a8..00000000 --- a/pynitrokey/nethsm/client/paths/random/post/request_body/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import random_request_data -Schema: typing_extensions.TypeAlias = random_request_data.RandomRequestData diff --git a/pynitrokey/nethsm/client/paths/random/post/responses/__init__.py b/pynitrokey/nethsm/client/paths/random/post/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/random/post/responses/response_200/__init__.py b/pynitrokey/nethsm/client/paths/random/post/responses/response_200/__init__.py deleted file mode 100644 index 566e2394..00000000 --- a/pynitrokey/nethsm/client/paths/random/post/responses/response_200/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: application_json_schema.random_data.RandomDataDict - headers: schemas.Unset = schemas.unset - - -class ResponseFor200(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } diff --git a/pynitrokey/nethsm/client/paths/random/post/responses/response_200/content/__init__.py b/pynitrokey/nethsm/client/paths/random/post/responses/response_200/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/random/post/responses/response_200/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/random/post/responses/response_200/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/random/post/responses/response_200/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/random/post/responses/response_200/content/application_json/schema.py deleted file mode 100644 index 4502d95e..00000000 --- a/pynitrokey/nethsm/client/paths/random/post/responses/response_200/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import random_data -Schema: typing_extensions.TypeAlias = random_data.RandomData diff --git a/pynitrokey/nethsm/client/paths/random/post/responses/response_400/__init__.py b/pynitrokey/nethsm/client/paths/random/post/responses/response_400/__init__.py deleted file mode 100644 index 0458793b..00000000 --- a/pynitrokey/nethsm/client/paths/random/post/responses/response_400/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor400(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/random/post/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/random/post/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/random/post/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/random/post/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/random/post/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/random/post/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/random/post/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/random/post/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/random/post/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/random/post/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/random/post/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/random/post/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/random/post/security/__init__.py b/pynitrokey/nethsm/client/paths/random/post/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/random/post/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/random/post/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/random/post/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/system_backup/__init__.py b/pynitrokey/nethsm/client/paths/system_backup/__init__.py deleted file mode 100644 index 5439df83..00000000 --- a/pynitrokey/nethsm/client/paths/system_backup/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.system_backup import SystemBackup - -path = "/system/backup" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/system_backup/post/__init__.py b/pynitrokey/nethsm/client/paths/system_backup/post/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/system_backup/post/operation.py b/pynitrokey/nethsm/client/paths/system_backup/post/operation.py deleted file mode 100644 index 12f37f03..00000000 --- a/pynitrokey/nethsm/client/paths/system_backup/post/operation.py +++ /dev/null @@ -1,155 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .. import path -from .responses import ( - response_200, - response_401, - response_403, - response_406, - response_412, -) -from .security import security_requirement_object_0 - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '200': typing.Type[response_200.ResponseFor200], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '200': response_200.ResponseFor200, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '200', -}) -_error_status_codes = frozenset({ - '401', - '403', - '406', - '412', -}) - - -class BaseApi(api_client.Api): - @typing.overload - def _system_backup_post( - self, - *, - skip_deserialization: typing.Literal[False] = False, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_200.ApiResponse: ... - - @typing.overload - def _system_backup_post( - self, - *, - skip_deserialization: typing.Literal[True], - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _system_backup_post( - self, - *, - skip_deserialization: bool = False, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path - # TODO add cookie handling - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//system/backup/post/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='post', - host=host, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '200', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '401', - '403', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class SystemBackupPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - system_backup_post = BaseApi._system_backup_post - - -class ApiForPost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - post = BaseApi._system_backup_post diff --git a/pynitrokey/nethsm/client/paths/system_backup/post/responses/__init__.py b/pynitrokey/nethsm/client/paths/system_backup/post/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/system_backup/post/responses/response_200/__init__.py b/pynitrokey/nethsm/client/paths/system_backup/post/responses/response_200/__init__.py deleted file mode 100644 index fc4b07d0..00000000 --- a/pynitrokey/nethsm/client/paths/system_backup/post/responses/response_200/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor200(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_backup/post/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/system_backup/post/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/system_backup/post/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_backup/post/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/system_backup/post/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/system_backup/post/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_backup/post/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/system_backup/post/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/system_backup/post/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_backup/post/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/system_backup/post/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/system_backup/post/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_backup/post/security/__init__.py b/pynitrokey/nethsm/client/paths/system_backup/post/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/system_backup/post/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/system_backup/post/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/system_backup/post/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/system_cancel_update/__init__.py b/pynitrokey/nethsm/client/paths/system_cancel_update/__init__.py deleted file mode 100644 index 1db88e33..00000000 --- a/pynitrokey/nethsm/client/paths/system_cancel_update/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.system_cancel_update import SystemCancelUpdate - -path = "/system/cancel-update" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/system_cancel_update/post/__init__.py b/pynitrokey/nethsm/client/paths/system_cancel_update/post/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/system_cancel_update/post/operation.py b/pynitrokey/nethsm/client/paths/system_cancel_update/post/operation.py deleted file mode 100644 index 731f0643..00000000 --- a/pynitrokey/nethsm/client/paths/system_cancel_update/post/operation.py +++ /dev/null @@ -1,155 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .. import path -from .responses import ( - response_204, - response_401, - response_403, - response_406, - response_412, -) -from .security import security_requirement_object_0 - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '204': typing.Type[response_204.ResponseFor204], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '204': response_204.ResponseFor204, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '204', -}) -_error_status_codes = frozenset({ - '401', - '403', - '406', - '412', -}) - - -class BaseApi(api_client.Api): - @typing.overload - def _system_cancel_update_post( - self, - *, - skip_deserialization: typing.Literal[False] = False, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_204.ApiResponse: ... - - @typing.overload - def _system_cancel_update_post( - self, - *, - skip_deserialization: typing.Literal[True], - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _system_cancel_update_post( - self, - *, - skip_deserialization: bool = False, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path - # TODO add cookie handling - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//system/cancel-update/post/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='post', - host=host, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '204', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '401', - '403', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class SystemCancelUpdatePost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - system_cancel_update_post = BaseApi._system_cancel_update_post - - -class ApiForPost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - post = BaseApi._system_cancel_update_post diff --git a/pynitrokey/nethsm/client/paths/system_cancel_update/post/responses/__init__.py b/pynitrokey/nethsm/client/paths/system_cancel_update/post/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/system_cancel_update/post/responses/response_204/__init__.py b/pynitrokey/nethsm/client/paths/system_cancel_update/post/responses/response_204/__init__.py deleted file mode 100644 index 8e822e77..00000000 --- a/pynitrokey/nethsm/client/paths/system_cancel_update/post/responses/response_204/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor204(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_cancel_update/post/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/system_cancel_update/post/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/system_cancel_update/post/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_cancel_update/post/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/system_cancel_update/post/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/system_cancel_update/post/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_cancel_update/post/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/system_cancel_update/post/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/system_cancel_update/post/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_cancel_update/post/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/system_cancel_update/post/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/system_cancel_update/post/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_cancel_update/post/security/__init__.py b/pynitrokey/nethsm/client/paths/system_cancel_update/post/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/system_cancel_update/post/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/system_cancel_update/post/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/system_cancel_update/post/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/system_commit_update/__init__.py b/pynitrokey/nethsm/client/paths/system_commit_update/__init__.py deleted file mode 100644 index 906cfe0d..00000000 --- a/pynitrokey/nethsm/client/paths/system_commit_update/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.system_commit_update import SystemCommitUpdate - -path = "/system/commit-update" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/system_commit_update/post/__init__.py b/pynitrokey/nethsm/client/paths/system_commit_update/post/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/system_commit_update/post/operation.py b/pynitrokey/nethsm/client/paths/system_commit_update/post/operation.py deleted file mode 100644 index ad55e8b3..00000000 --- a/pynitrokey/nethsm/client/paths/system_commit_update/post/operation.py +++ /dev/null @@ -1,155 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .. import path -from .responses import ( - response_204, - response_401, - response_403, - response_406, - response_412, -) -from .security import security_requirement_object_0 - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '204': typing.Type[response_204.ResponseFor204], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '204': response_204.ResponseFor204, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '204', -}) -_error_status_codes = frozenset({ - '401', - '403', - '406', - '412', -}) - - -class BaseApi(api_client.Api): - @typing.overload - def _system_commit_update_post( - self, - *, - skip_deserialization: typing.Literal[False] = False, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_204.ApiResponse: ... - - @typing.overload - def _system_commit_update_post( - self, - *, - skip_deserialization: typing.Literal[True], - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _system_commit_update_post( - self, - *, - skip_deserialization: bool = False, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path - # TODO add cookie handling - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//system/commit-update/post/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='post', - host=host, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '204', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '401', - '403', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class SystemCommitUpdatePost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - system_commit_update_post = BaseApi._system_commit_update_post - - -class ApiForPost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - post = BaseApi._system_commit_update_post diff --git a/pynitrokey/nethsm/client/paths/system_commit_update/post/responses/__init__.py b/pynitrokey/nethsm/client/paths/system_commit_update/post/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/system_commit_update/post/responses/response_204/__init__.py b/pynitrokey/nethsm/client/paths/system_commit_update/post/responses/response_204/__init__.py deleted file mode 100644 index 8e822e77..00000000 --- a/pynitrokey/nethsm/client/paths/system_commit_update/post/responses/response_204/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor204(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_commit_update/post/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/system_commit_update/post/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/system_commit_update/post/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_commit_update/post/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/system_commit_update/post/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/system_commit_update/post/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_commit_update/post/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/system_commit_update/post/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/system_commit_update/post/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_commit_update/post/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/system_commit_update/post/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/system_commit_update/post/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_commit_update/post/security/__init__.py b/pynitrokey/nethsm/client/paths/system_commit_update/post/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/system_commit_update/post/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/system_commit_update/post/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/system_commit_update/post/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/system_factory_reset/__init__.py b/pynitrokey/nethsm/client/paths/system_factory_reset/__init__.py deleted file mode 100644 index a99b3df4..00000000 --- a/pynitrokey/nethsm/client/paths/system_factory_reset/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.system_factory_reset import SystemFactoryReset - -path = "/system/factory-reset" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/system_factory_reset/post/__init__.py b/pynitrokey/nethsm/client/paths/system_factory_reset/post/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/system_factory_reset/post/operation.py b/pynitrokey/nethsm/client/paths/system_factory_reset/post/operation.py deleted file mode 100644 index 40301089..00000000 --- a/pynitrokey/nethsm/client/paths/system_factory_reset/post/operation.py +++ /dev/null @@ -1,155 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .. import path -from .responses import ( - response_204, - response_401, - response_403, - response_406, - response_412, -) -from .security import security_requirement_object_0 - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '204': typing.Type[response_204.ResponseFor204], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '204': response_204.ResponseFor204, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '204', -}) -_error_status_codes = frozenset({ - '401', - '403', - '406', - '412', -}) - - -class BaseApi(api_client.Api): - @typing.overload - def _system_factory_reset_post( - self, - *, - skip_deserialization: typing.Literal[False] = False, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_204.ApiResponse: ... - - @typing.overload - def _system_factory_reset_post( - self, - *, - skip_deserialization: typing.Literal[True], - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _system_factory_reset_post( - self, - *, - skip_deserialization: bool = False, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path - # TODO add cookie handling - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//system/factory-reset/post/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='post', - host=host, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '204', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '401', - '403', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class SystemFactoryResetPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - system_factory_reset_post = BaseApi._system_factory_reset_post - - -class ApiForPost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - post = BaseApi._system_factory_reset_post diff --git a/pynitrokey/nethsm/client/paths/system_factory_reset/post/responses/__init__.py b/pynitrokey/nethsm/client/paths/system_factory_reset/post/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/system_factory_reset/post/responses/response_204/__init__.py b/pynitrokey/nethsm/client/paths/system_factory_reset/post/responses/response_204/__init__.py deleted file mode 100644 index 8e822e77..00000000 --- a/pynitrokey/nethsm/client/paths/system_factory_reset/post/responses/response_204/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor204(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_factory_reset/post/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/system_factory_reset/post/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/system_factory_reset/post/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_factory_reset/post/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/system_factory_reset/post/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/system_factory_reset/post/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_factory_reset/post/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/system_factory_reset/post/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/system_factory_reset/post/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_factory_reset/post/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/system_factory_reset/post/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/system_factory_reset/post/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_factory_reset/post/security/__init__.py b/pynitrokey/nethsm/client/paths/system_factory_reset/post/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/system_factory_reset/post/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/system_factory_reset/post/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/system_factory_reset/post/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/system_info/__init__.py b/pynitrokey/nethsm/client/paths/system_info/__init__.py deleted file mode 100644 index 5acb17bc..00000000 --- a/pynitrokey/nethsm/client/paths/system_info/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.system_info import SystemInfo - -path = "/system/info" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/system_info/get/__init__.py b/pynitrokey/nethsm/client/paths/system_info/get/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/system_info/get/operation.py b/pynitrokey/nethsm/client/paths/system_info/get/operation.py deleted file mode 100644 index eeab7125..00000000 --- a/pynitrokey/nethsm/client/paths/system_info/get/operation.py +++ /dev/null @@ -1,164 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .. import path -from .responses import ( - response_200, - response_401, - response_403, - response_406, - response_412, -) -from .security import security_requirement_object_0 - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '200': typing.Type[response_200.ResponseFor200], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '200': response_200.ResponseFor200, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '200', -}) -_error_status_codes = frozenset({ - '401', - '403', - '406', - '412', -}) - -_all_accept_content_types = ( - "application/json", -) - - -class BaseApi(api_client.Api): - @typing.overload - def _system_info_get( - self, - *, - skip_deserialization: typing.Literal[False] = False, - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_200.ApiResponse: ... - - @typing.overload - def _system_info_get( - self, - *, - skip_deserialization: typing.Literal[True], - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _system_info_get( - self, - *, - skip_deserialization: bool = False, - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path - headers = self._get_headers(accept_content_types=accept_content_types) - # TODO add cookie handling - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//system/info/get/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='get', - host=host, - headers=headers, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '200', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '401', - '403', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class SystemInfoGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - system_info_get = BaseApi._system_info_get - - -class ApiForGet(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - get = BaseApi._system_info_get diff --git a/pynitrokey/nethsm/client/paths/system_info/get/responses/__init__.py b/pynitrokey/nethsm/client/paths/system_info/get/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/system_info/get/responses/response_200/__init__.py b/pynitrokey/nethsm/client/paths/system_info/get/responses/response_200/__init__.py deleted file mode 100644 index fc0cfe63..00000000 --- a/pynitrokey/nethsm/client/paths/system_info/get/responses/response_200/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: application_json_schema.system_info.SystemInfoDict - headers: schemas.Unset = schemas.unset - - -class ResponseFor200(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } diff --git a/pynitrokey/nethsm/client/paths/system_info/get/responses/response_200/content/__init__.py b/pynitrokey/nethsm/client/paths/system_info/get/responses/response_200/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/system_info/get/responses/response_200/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/system_info/get/responses/response_200/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/system_info/get/responses/response_200/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/system_info/get/responses/response_200/content/application_json/schema.py deleted file mode 100644 index d0e4230c..00000000 --- a/pynitrokey/nethsm/client/paths/system_info/get/responses/response_200/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import system_info -Schema: typing_extensions.TypeAlias = system_info.SystemInfo diff --git a/pynitrokey/nethsm/client/paths/system_info/get/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/system_info/get/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/system_info/get/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_info/get/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/system_info/get/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/system_info/get/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_info/get/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/system_info/get/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/system_info/get/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_info/get/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/system_info/get/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/system_info/get/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_info/get/security/__init__.py b/pynitrokey/nethsm/client/paths/system_info/get/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/system_info/get/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/system_info/get/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/system_info/get/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/system_reboot/__init__.py b/pynitrokey/nethsm/client/paths/system_reboot/__init__.py deleted file mode 100644 index a4c53188..00000000 --- a/pynitrokey/nethsm/client/paths/system_reboot/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.system_reboot import SystemReboot - -path = "/system/reboot" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/system_reboot/post/__init__.py b/pynitrokey/nethsm/client/paths/system_reboot/post/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/system_reboot/post/operation.py b/pynitrokey/nethsm/client/paths/system_reboot/post/operation.py deleted file mode 100644 index 5efee474..00000000 --- a/pynitrokey/nethsm/client/paths/system_reboot/post/operation.py +++ /dev/null @@ -1,155 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .. import path -from .responses import ( - response_204, - response_401, - response_403, - response_406, - response_412, -) -from .security import security_requirement_object_0 - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '204': typing.Type[response_204.ResponseFor204], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '204': response_204.ResponseFor204, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '204', -}) -_error_status_codes = frozenset({ - '401', - '403', - '406', - '412', -}) - - -class BaseApi(api_client.Api): - @typing.overload - def _system_reboot_post( - self, - *, - skip_deserialization: typing.Literal[False] = False, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_204.ApiResponse: ... - - @typing.overload - def _system_reboot_post( - self, - *, - skip_deserialization: typing.Literal[True], - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _system_reboot_post( - self, - *, - skip_deserialization: bool = False, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path - # TODO add cookie handling - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//system/reboot/post/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='post', - host=host, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '204', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '401', - '403', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class SystemRebootPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - system_reboot_post = BaseApi._system_reboot_post - - -class ApiForPost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - post = BaseApi._system_reboot_post diff --git a/pynitrokey/nethsm/client/paths/system_reboot/post/responses/__init__.py b/pynitrokey/nethsm/client/paths/system_reboot/post/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/system_reboot/post/responses/response_204/__init__.py b/pynitrokey/nethsm/client/paths/system_reboot/post/responses/response_204/__init__.py deleted file mode 100644 index 8e822e77..00000000 --- a/pynitrokey/nethsm/client/paths/system_reboot/post/responses/response_204/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor204(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_reboot/post/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/system_reboot/post/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/system_reboot/post/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_reboot/post/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/system_reboot/post/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/system_reboot/post/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_reboot/post/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/system_reboot/post/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/system_reboot/post/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_reboot/post/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/system_reboot/post/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/system_reboot/post/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_reboot/post/security/__init__.py b/pynitrokey/nethsm/client/paths/system_reboot/post/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/system_reboot/post/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/system_reboot/post/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/system_reboot/post/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/system_restore/__init__.py b/pynitrokey/nethsm/client/paths/system_restore/__init__.py deleted file mode 100644 index e6b3146f..00000000 --- a/pynitrokey/nethsm/client/paths/system_restore/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.system_restore import SystemRestore - -path = "/system/restore" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/system_restore/post/__init__.py b/pynitrokey/nethsm/client/paths/system_restore/post/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/system_restore/post/operation.py b/pynitrokey/nethsm/client/paths/system_restore/post/operation.py deleted file mode 100644 index 1d7fff28..00000000 --- a/pynitrokey/nethsm/client/paths/system_restore/post/operation.py +++ /dev/null @@ -1,183 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.paths.system_restore.post.request_body.content.application_octet_stream import schema - -from .. import path -from .responses import ( - response_204, - response_400, - response_406, - response_412, -) -from . import request_body -from .parameters import ( - parameter_0, - parameter_1, -) -from .query_parameters import QueryParameters, QueryParametersDictInput, QueryParametersDict -query_parameter_classes = ( - parameter_0.Parameter0, - parameter_1.Parameter1, -) - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '204': typing.Type[response_204.ResponseFor204], - '400': typing.Type[response_400.ResponseFor400], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '204': response_204.ResponseFor204, - '400': response_400.ResponseFor400, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '204', -}) -_error_status_codes = frozenset({ - '400', - '406', - '412', -}) - - -class BaseApi(api_client.Api): - @typing.overload - def _system_restore_post( - self, - body: str, - query_params: typing.Union[ - QueryParametersDictInput, - QueryParametersDict - ], - *, - skip_deserialization: typing.Literal[False] = False, - content_type: typing.Literal["application/octet-stream"] = "application/octet-stream", - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_204.ApiResponse: ... - - @typing.overload - def _system_restore_post( - self, - body: str, - query_params: typing.Union[ - QueryParametersDictInput, - QueryParametersDict - ], - *, - skip_deserialization: typing.Literal[True], - content_type: typing.Literal["application/octet-stream"] = "application/octet-stream", - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _system_restore_post( - self, - body: str, - query_params: typing.Union[ - QueryParametersDictInput, - QueryParametersDict - ], - *, - skip_deserialization: bool = False, - content_type: typing.Literal["application/octet-stream"] = "application/octet-stream", - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - query_params = QueryParameters.validate(query_params) - used_path, query_params_suffix = self._get_used_path( - path, - query_parameters=query_parameter_classes, - query_params=query_params, - skip_validation=True - ) - headers = self._get_headers() - # TODO add cookie handling - - fields, serialized_body = self._get_fields_and_body( - request_body=request_body.RequestBody, - body=body, - content_type=content_type, - headers=headers - ) - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - query_params_suffix=query_params_suffix, - method='post', - host=host, - headers=headers, - fields=fields, - body=serialized_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '204', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '400', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class SystemRestorePost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - system_restore_post = BaseApi._system_restore_post - - -class ApiForPost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - post = BaseApi._system_restore_post diff --git a/pynitrokey/nethsm/client/paths/system_restore/post/parameters/__init__.py b/pynitrokey/nethsm/client/paths/system_restore/post/parameters/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/system_restore/post/parameters/parameter_0/__init__.py b/pynitrokey/nethsm/client/paths/system_restore/post/parameters/parameter_0/__init__.py deleted file mode 100644 index da2e873f..00000000 --- a/pynitrokey/nethsm/client/paths/system_restore/post/parameters/parameter_0/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from . import schema - - -class Parameter0(api_client.QueryParameter): - name = "backupPassphrase" - style = api_client.ParameterStyle.FORM - schema: typing_extensions.TypeAlias = schema.Schema - required = True - explode = True diff --git a/pynitrokey/nethsm/client/paths/system_restore/post/parameters/parameter_0/schema.py b/pynitrokey/nethsm/client/paths/system_restore/post/parameters/parameter_0/schema.py deleted file mode 100644 index 27a9983e..00000000 --- a/pynitrokey/nethsm/client/paths/system_restore/post/parameters/parameter_0/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import passphrase -Schema: typing_extensions.TypeAlias = passphrase.Passphrase diff --git a/pynitrokey/nethsm/client/paths/system_restore/post/parameters/parameter_1/__init__.py b/pynitrokey/nethsm/client/paths/system_restore/post/parameters/parameter_1/__init__.py deleted file mode 100644 index 5cb581b3..00000000 --- a/pynitrokey/nethsm/client/paths/system_restore/post/parameters/parameter_1/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from . import schema - - -class Parameter1(api_client.QueryParameter): - name = "systemTime" - style = api_client.ParameterStyle.FORM - schema: typing_extensions.TypeAlias = schema.Schema - explode = True diff --git a/pynitrokey/nethsm/client/paths/system_restore/post/parameters/parameter_1/schema.py b/pynitrokey/nethsm/client/paths/system_restore/post/parameters/parameter_1/schema.py deleted file mode 100644 index 57499bda..00000000 --- a/pynitrokey/nethsm/client/paths/system_restore/post/parameters/parameter_1/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -Schema: typing_extensions.TypeAlias = schemas.DateTimeSchema diff --git a/pynitrokey/nethsm/client/paths/system_restore/post/query_parameters.py b/pynitrokey/nethsm/client/paths/system_restore/post/query_parameters.py deleted file mode 100644 index 0e7c2dc9..00000000 --- a/pynitrokey/nethsm/client/paths/system_restore/post/query_parameters.py +++ /dev/null @@ -1,137 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema - -from pynitrokey.nethsm.client.components.schema import passphrase -from pynitrokey.nethsm.client.paths.system_restore.post.parameters.parameter_1 import schema -Properties = typing.TypedDict( - 'Properties', - { - "backupPassphrase": typing.Type[passphrase.Passphrase], - "systemTime": typing.Type[schema.Schema], - } -) -QueryParametersRequiredDictInput = typing.TypedDict( - 'QueryParametersRequiredDictInput', - { - "backupPassphrase": str, - } -) -QueryParametersOptionalDictInput = typing.TypedDict( - 'QueryParametersOptionalDictInput', - { - "systemTime": typing.Union[ - str, - datetime.datetime - ], - }, - total=False -) - - -class QueryParametersDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - __required_keys__: typing.FrozenSet[str] = frozenset({ - "backupPassphrase", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - "systemTime", - }) - - def __new__( - cls, - *, - backupPassphrase: str, - systemTime: typing.Union[ - str, - datetime.datetime, - schemas.Unset - ] = schemas.unset, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - ): - arg_: typing.Dict[str, typing.Any] = { - "backupPassphrase": backupPassphrase, - } - for key, val in ( - ("systemTime", systemTime), - ): - if isinstance(val, schemas.Unset): - continue - arg_[key] = val - used_arg_ = typing.cast(QueryParametersDictInput, arg_) - return QueryParameters.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - QueryParametersDictInput, - QueryParametersDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> QueryParametersDict: - return QueryParameters.validate(arg, configuration=configuration) - - @property - def backupPassphrase(self) -> str: - return typing.cast( - str, - self.__getitem__("backupPassphrase") - ) - - @property - def systemTime(self) -> typing.Union[str, schemas.Unset]: - val = self.get("systemTime", schemas.unset) - if isinstance(val, schemas.Unset): - return val - return typing.cast( - str, - val - ) - - -class QueryParametersDictInput(QueryParametersRequiredDictInput, QueryParametersOptionalDictInput): - pass - - -@dataclasses.dataclass(frozen=True) -class QueryParameters( - schemas.Schema[QueryParametersDict, tuple] -): - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "backupPassphrase", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - additional_properties: typing.Type[AdditionalProperties] = dataclasses.field(default_factory=lambda: AdditionalProperties) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: QueryParametersDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - QueryParametersDictInput, - QueryParametersDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> QueryParametersDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/paths/system_restore/post/request_body/__init__.py b/pynitrokey/nethsm/client/paths/system_restore/post/request_body/__init__.py deleted file mode 100644 index 73ff4116..00000000 --- a/pynitrokey/nethsm/client/paths/system_restore/post/request_body/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_octet_stream import schema as application_octet_stream_schema - - -class RequestBody(api_client.RequestBody): - - - class ApplicationOctetStreamMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_octet_stream_schema.Schema - content = { - 'application/octet-stream': ApplicationOctetStreamMediaType, - } - required = True diff --git a/pynitrokey/nethsm/client/paths/system_restore/post/request_body/content/__init__.py b/pynitrokey/nethsm/client/paths/system_restore/post/request_body/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/system_restore/post/request_body/content/application_octet_stream/__init__.py b/pynitrokey/nethsm/client/paths/system_restore/post/request_body/content/application_octet_stream/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/system_restore/post/request_body/content/application_octet_stream/schema.py b/pynitrokey/nethsm/client/paths/system_restore/post/request_body/content/application_octet_stream/schema.py deleted file mode 100644 index 951e9038..00000000 --- a/pynitrokey/nethsm/client/paths/system_restore/post/request_body/content/application_octet_stream/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -Schema: typing_extensions.TypeAlias = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/paths/system_restore/post/responses/__init__.py b/pynitrokey/nethsm/client/paths/system_restore/post/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/system_restore/post/responses/response_204/__init__.py b/pynitrokey/nethsm/client/paths/system_restore/post/responses/response_204/__init__.py deleted file mode 100644 index 8e822e77..00000000 --- a/pynitrokey/nethsm/client/paths/system_restore/post/responses/response_204/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor204(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_restore/post/responses/response_400/__init__.py b/pynitrokey/nethsm/client/paths/system_restore/post/responses/response_400/__init__.py deleted file mode 100644 index 0458793b..00000000 --- a/pynitrokey/nethsm/client/paths/system_restore/post/responses/response_400/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor400(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_restore/post/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/system_restore/post/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/system_restore/post/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_restore/post/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/system_restore/post/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/system_restore/post/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_shutdown/__init__.py b/pynitrokey/nethsm/client/paths/system_shutdown/__init__.py deleted file mode 100644 index 9cf06895..00000000 --- a/pynitrokey/nethsm/client/paths/system_shutdown/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.system_shutdown import SystemShutdown - -path = "/system/shutdown" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/system_shutdown/post/__init__.py b/pynitrokey/nethsm/client/paths/system_shutdown/post/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/system_shutdown/post/operation.py b/pynitrokey/nethsm/client/paths/system_shutdown/post/operation.py deleted file mode 100644 index 7a7cf4e1..00000000 --- a/pynitrokey/nethsm/client/paths/system_shutdown/post/operation.py +++ /dev/null @@ -1,155 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .. import path -from .responses import ( - response_204, - response_401, - response_403, - response_406, - response_412, -) -from .security import security_requirement_object_0 - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '204': typing.Type[response_204.ResponseFor204], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '204': response_204.ResponseFor204, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '204', -}) -_error_status_codes = frozenset({ - '401', - '403', - '406', - '412', -}) - - -class BaseApi(api_client.Api): - @typing.overload - def _system_shutdown_post( - self, - *, - skip_deserialization: typing.Literal[False] = False, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_204.ApiResponse: ... - - @typing.overload - def _system_shutdown_post( - self, - *, - skip_deserialization: typing.Literal[True], - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _system_shutdown_post( - self, - *, - skip_deserialization: bool = False, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path - # TODO add cookie handling - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//system/shutdown/post/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='post', - host=host, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '204', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '401', - '403', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class SystemShutdownPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - system_shutdown_post = BaseApi._system_shutdown_post - - -class ApiForPost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - post = BaseApi._system_shutdown_post diff --git a/pynitrokey/nethsm/client/paths/system_shutdown/post/responses/__init__.py b/pynitrokey/nethsm/client/paths/system_shutdown/post/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/system_shutdown/post/responses/response_204/__init__.py b/pynitrokey/nethsm/client/paths/system_shutdown/post/responses/response_204/__init__.py deleted file mode 100644 index 8e822e77..00000000 --- a/pynitrokey/nethsm/client/paths/system_shutdown/post/responses/response_204/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor204(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_shutdown/post/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/system_shutdown/post/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/system_shutdown/post/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_shutdown/post/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/system_shutdown/post/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/system_shutdown/post/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_shutdown/post/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/system_shutdown/post/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/system_shutdown/post/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_shutdown/post/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/system_shutdown/post/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/system_shutdown/post/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_shutdown/post/security/__init__.py b/pynitrokey/nethsm/client/paths/system_shutdown/post/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/system_shutdown/post/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/system_shutdown/post/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/system_shutdown/post/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/system_update/__init__.py b/pynitrokey/nethsm/client/paths/system_update/__init__.py deleted file mode 100644 index 77a9e07e..00000000 --- a/pynitrokey/nethsm/client/paths/system_update/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.system_update import SystemUpdate - -path = "/system/update" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/system_update/post/__init__.py b/pynitrokey/nethsm/client/paths/system_update/post/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/system_update/post/operation.py b/pynitrokey/nethsm/client/paths/system_update/post/operation.py deleted file mode 100644 index 61db7b17..00000000 --- a/pynitrokey/nethsm/client/paths/system_update/post/operation.py +++ /dev/null @@ -1,191 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.paths.system_update.post.request_body.content.application_octet_stream import schema - -from .. import path -from .responses import ( - response_200, - response_400, - response_401, - response_403, - response_406, - response_409, - response_412, -) -from . import request_body -from .security import security_requirement_object_0 - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '200': typing.Type[response_200.ResponseFor200], - '400': typing.Type[response_400.ResponseFor400], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '406': typing.Type[response_406.ResponseFor406], - '409': typing.Type[response_409.ResponseFor409], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '200': response_200.ResponseFor200, - '400': response_400.ResponseFor400, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '406': response_406.ResponseFor406, - '409': response_409.ResponseFor409, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '200', -}) -_error_status_codes = frozenset({ - '400', - '401', - '403', - '406', - '409', - '412', -}) - -_all_accept_content_types = ( - "application/json", -) - - -class BaseApi(api_client.Api): - @typing.overload - def _system_update_post( - self, - body: str, - *, - skip_deserialization: typing.Literal[False] = False, - content_type: typing.Literal["application/octet-stream"] = "application/octet-stream", - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_200.ApiResponse: ... - - @typing.overload - def _system_update_post( - self, - body: str, - *, - skip_deserialization: typing.Literal[True], - content_type: typing.Literal["application/octet-stream"] = "application/octet-stream", - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _system_update_post( - self, - body: str, - *, - skip_deserialization: bool = False, - content_type: typing.Literal["application/octet-stream"] = "application/octet-stream", - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path - headers = self._get_headers(accept_content_types=accept_content_types) - # TODO add cookie handling - - fields, serialized_body = self._get_fields_and_body( - request_body=request_body.RequestBody, - body=body, - content_type=content_type, - headers=headers - ) - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//system/update/post/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='post', - host=host, - headers=headers, - fields=fields, - body=serialized_body, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '200', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '400', - '401', - '403', - '406', - '409', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class SystemUpdatePost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - system_update_post = BaseApi._system_update_post - - -class ApiForPost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - post = BaseApi._system_update_post diff --git a/pynitrokey/nethsm/client/paths/system_update/post/request_body/__init__.py b/pynitrokey/nethsm/client/paths/system_update/post/request_body/__init__.py deleted file mode 100644 index 73ff4116..00000000 --- a/pynitrokey/nethsm/client/paths/system_update/post/request_body/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_octet_stream import schema as application_octet_stream_schema - - -class RequestBody(api_client.RequestBody): - - - class ApplicationOctetStreamMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_octet_stream_schema.Schema - content = { - 'application/octet-stream': ApplicationOctetStreamMediaType, - } - required = True diff --git a/pynitrokey/nethsm/client/paths/system_update/post/request_body/content/__init__.py b/pynitrokey/nethsm/client/paths/system_update/post/request_body/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/system_update/post/request_body/content/application_octet_stream/__init__.py b/pynitrokey/nethsm/client/paths/system_update/post/request_body/content/application_octet_stream/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/system_update/post/request_body/content/application_octet_stream/schema.py b/pynitrokey/nethsm/client/paths/system_update/post/request_body/content/application_octet_stream/schema.py deleted file mode 100644 index 951e9038..00000000 --- a/pynitrokey/nethsm/client/paths/system_update/post/request_body/content/application_octet_stream/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -Schema: typing_extensions.TypeAlias = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/paths/system_update/post/responses/__init__.py b/pynitrokey/nethsm/client/paths/system_update/post/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/system_update/post/responses/response_200/__init__.py b/pynitrokey/nethsm/client/paths/system_update/post/responses/response_200/__init__.py deleted file mode 100644 index 2f117879..00000000 --- a/pynitrokey/nethsm/client/paths/system_update/post/responses/response_200/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: application_json_schema.system_update_data.SystemUpdateDataDict - headers: schemas.Unset = schemas.unset - - -class ResponseFor200(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } diff --git a/pynitrokey/nethsm/client/paths/system_update/post/responses/response_200/content/__init__.py b/pynitrokey/nethsm/client/paths/system_update/post/responses/response_200/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/system_update/post/responses/response_200/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/system_update/post/responses/response_200/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/system_update/post/responses/response_200/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/system_update/post/responses/response_200/content/application_json/schema.py deleted file mode 100644 index eaa104bb..00000000 --- a/pynitrokey/nethsm/client/paths/system_update/post/responses/response_200/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import system_update_data -Schema: typing_extensions.TypeAlias = system_update_data.SystemUpdateData diff --git a/pynitrokey/nethsm/client/paths/system_update/post/responses/response_400/__init__.py b/pynitrokey/nethsm/client/paths/system_update/post/responses/response_400/__init__.py deleted file mode 100644 index 0458793b..00000000 --- a/pynitrokey/nethsm/client/paths/system_update/post/responses/response_400/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor400(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_update/post/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/system_update/post/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/system_update/post/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_update/post/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/system_update/post/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/system_update/post/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_update/post/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/system_update/post/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/system_update/post/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_update/post/responses/response_409/__init__.py b/pynitrokey/nethsm/client/paths/system_update/post/responses/response_409/__init__.py deleted file mode 100644 index ce260df9..00000000 --- a/pynitrokey/nethsm/client/paths/system_update/post/responses/response_409/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor409(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_update/post/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/system_update/post/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/system_update/post/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/system_update/post/security/__init__.py b/pynitrokey/nethsm/client/paths/system_update/post/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/system_update/post/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/system_update/post/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/system_update/post/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/unlock/__init__.py b/pynitrokey/nethsm/client/paths/unlock/__init__.py deleted file mode 100644 index e04e6b98..00000000 --- a/pynitrokey/nethsm/client/paths/unlock/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.unlock import Unlock - -path = "/unlock" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/unlock/post/__init__.py b/pynitrokey/nethsm/client/paths/unlock/post/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/unlock/post/operation.py b/pynitrokey/nethsm/client/paths/unlock/post/operation.py deleted file mode 100644 index 8c1a5678..00000000 --- a/pynitrokey/nethsm/client/paths/unlock/post/operation.py +++ /dev/null @@ -1,169 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import unlock_request_data - -from .. import path -from .responses import ( - response_204, - response_400, - response_403, - response_406, - response_412, -) -from . import request_body - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '204': typing.Type[response_204.ResponseFor204], - '400': typing.Type[response_400.ResponseFor400], - '403': typing.Type[response_403.ResponseFor403], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '204': response_204.ResponseFor204, - '400': response_400.ResponseFor400, - '403': response_403.ResponseFor403, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '204', -}) -_error_status_codes = frozenset({ - '400', - '403', - '406', - '412', -}) - - -class BaseApi(api_client.Api): - @typing.overload - def _unlock_post( - self, - body: typing.Union[ - unlock_request_data.UnlockRequestDataDictInput, - unlock_request_data.UnlockRequestDataDict, - ], - *, - skip_deserialization: typing.Literal[False] = False, - content_type: typing.Literal["application/json"] = "application/json", - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_204.ApiResponse: ... - - @typing.overload - def _unlock_post( - self, - body: typing.Union[ - unlock_request_data.UnlockRequestDataDictInput, - unlock_request_data.UnlockRequestDataDict, - ], - *, - skip_deserialization: typing.Literal[True], - content_type: typing.Literal["application/json"] = "application/json", - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _unlock_post( - self, - body: typing.Union[ - unlock_request_data.UnlockRequestDataDictInput, - unlock_request_data.UnlockRequestDataDict, - ], - *, - skip_deserialization: bool = False, - content_type: typing.Literal["application/json"] = "application/json", - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path - headers = self._get_headers() - # TODO add cookie handling - - fields, serialized_body = self._get_fields_and_body( - request_body=request_body.RequestBody, - body=body, - content_type=content_type, - headers=headers - ) - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='post', - host=host, - headers=headers, - fields=fields, - body=serialized_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '204', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '400', - '403', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class UnlockPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - unlock_post = BaseApi._unlock_post - - -class ApiForPost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - post = BaseApi._unlock_post diff --git a/pynitrokey/nethsm/client/paths/unlock/post/request_body/__init__.py b/pynitrokey/nethsm/client/paths/unlock/post/request_body/__init__.py deleted file mode 100644 index ad29c4a8..00000000 --- a/pynitrokey/nethsm/client/paths/unlock/post/request_body/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -class RequestBody(api_client.RequestBody): - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } - required = True diff --git a/pynitrokey/nethsm/client/paths/unlock/post/request_body/content/__init__.py b/pynitrokey/nethsm/client/paths/unlock/post/request_body/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/unlock/post/request_body/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/unlock/post/request_body/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/unlock/post/request_body/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/unlock/post/request_body/content/application_json/schema.py deleted file mode 100644 index 9b716bca..00000000 --- a/pynitrokey/nethsm/client/paths/unlock/post/request_body/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import unlock_request_data -Schema: typing_extensions.TypeAlias = unlock_request_data.UnlockRequestData diff --git a/pynitrokey/nethsm/client/paths/unlock/post/responses/__init__.py b/pynitrokey/nethsm/client/paths/unlock/post/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/unlock/post/responses/response_204/__init__.py b/pynitrokey/nethsm/client/paths/unlock/post/responses/response_204/__init__.py deleted file mode 100644 index 8e822e77..00000000 --- a/pynitrokey/nethsm/client/paths/unlock/post/responses/response_204/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor204(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/unlock/post/responses/response_400/__init__.py b/pynitrokey/nethsm/client/paths/unlock/post/responses/response_400/__init__.py deleted file mode 100644 index 0458793b..00000000 --- a/pynitrokey/nethsm/client/paths/unlock/post/responses/response_400/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor400(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/unlock/post/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/unlock/post/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/unlock/post/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/unlock/post/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/unlock/post/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/unlock/post/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/unlock/post/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/unlock/post/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/unlock/post/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users/__init__.py b/pynitrokey/nethsm/client/paths/users/__init__.py deleted file mode 100644 index cf0d7bd0..00000000 --- a/pynitrokey/nethsm/client/paths/users/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.users import Users - -path = "/users" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/users/get/__init__.py b/pynitrokey/nethsm/client/paths/users/get/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users/get/operation.py b/pynitrokey/nethsm/client/paths/users/get/operation.py deleted file mode 100644 index 80b744d0..00000000 --- a/pynitrokey/nethsm/client/paths/users/get/operation.py +++ /dev/null @@ -1,164 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .. import path -from .responses import ( - response_200, - response_401, - response_403, - response_406, - response_412, -) -from .security import security_requirement_object_0 - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '200': typing.Type[response_200.ResponseFor200], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '200': response_200.ResponseFor200, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '200', -}) -_error_status_codes = frozenset({ - '401', - '403', - '406', - '412', -}) - -_all_accept_content_types = ( - "application/json", -) - - -class BaseApi(api_client.Api): - @typing.overload - def _users_get( - self, - *, - skip_deserialization: typing.Literal[False] = False, - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_200.ApiResponse: ... - - @typing.overload - def _users_get( - self, - *, - skip_deserialization: typing.Literal[True], - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _users_get( - self, - *, - skip_deserialization: bool = False, - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path - headers = self._get_headers(accept_content_types=accept_content_types) - # TODO add cookie handling - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//users/get/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='get', - host=host, - headers=headers, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '200', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '401', - '403', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class UsersGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - users_get = BaseApi._users_get - - -class ApiForGet(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - get = BaseApi._users_get diff --git a/pynitrokey/nethsm/client/paths/users/get/responses/__init__.py b/pynitrokey/nethsm/client/paths/users/get/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users/get/responses/response_200/__init__.py b/pynitrokey/nethsm/client/paths/users/get/responses/response_200/__init__.py deleted file mode 100644 index b2010a34..00000000 --- a/pynitrokey/nethsm/client/paths/users/get/responses/response_200/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: application_json_schema.user_list.UserListTuple - headers: schemas.Unset = schemas.unset - - -class ResponseFor200(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } diff --git a/pynitrokey/nethsm/client/paths/users/get/responses/response_200/content/__init__.py b/pynitrokey/nethsm/client/paths/users/get/responses/response_200/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users/get/responses/response_200/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/users/get/responses/response_200/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users/get/responses/response_200/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/users/get/responses/response_200/content/application_json/schema.py deleted file mode 100644 index e88a209d..00000000 --- a/pynitrokey/nethsm/client/paths/users/get/responses/response_200/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import user_list -Schema: typing_extensions.TypeAlias = user_list.UserList diff --git a/pynitrokey/nethsm/client/paths/users/get/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/users/get/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/users/get/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users/get/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/users/get/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/users/get/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users/get/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/users/get/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/users/get/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users/get/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/users/get/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/users/get/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users/get/security/__init__.py b/pynitrokey/nethsm/client/paths/users/get/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users/get/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/users/get/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/users/get/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/users/post/__init__.py b/pynitrokey/nethsm/client/paths/users/post/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users/post/operation.py b/pynitrokey/nethsm/client/paths/users/post/operation.py deleted file mode 100644 index b5d4a97d..00000000 --- a/pynitrokey/nethsm/client/paths/users/post/operation.py +++ /dev/null @@ -1,188 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import user_post_data - -from .. import path -from .responses import ( - response_201, - response_400, - response_401, - response_403, - response_406, - response_412, -) -from . import request_body -from .security import security_requirement_object_0 - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '201': typing.Type[response_201.ResponseFor201], - '400': typing.Type[response_400.ResponseFor400], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '201': response_201.ResponseFor201, - '400': response_400.ResponseFor400, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '201', -}) -_error_status_codes = frozenset({ - '400', - '401', - '403', - '406', - '412', -}) - - -class BaseApi(api_client.Api): - @typing.overload - def _users_post( - self, - body: typing.Union[ - user_post_data.UserPostDataDictInput, - user_post_data.UserPostDataDict, - ], - *, - skip_deserialization: typing.Literal[False] = False, - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_201.ApiResponse: ... - - @typing.overload - def _users_post( - self, - body: typing.Union[ - user_post_data.UserPostDataDictInput, - user_post_data.UserPostDataDict, - ], - *, - skip_deserialization: typing.Literal[True], - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _users_post( - self, - body: typing.Union[ - user_post_data.UserPostDataDictInput, - user_post_data.UserPostDataDict, - ], - *, - skip_deserialization: bool = False, - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path - headers = self._get_headers() - # TODO add cookie handling - - fields, serialized_body = self._get_fields_and_body( - request_body=request_body.RequestBody, - body=body, - content_type=content_type, - headers=headers - ) - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//users/post/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='post', - host=host, - headers=headers, - fields=fields, - body=serialized_body, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '201', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '400', - '401', - '403', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class UsersPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - users_post = BaseApi._users_post - - -class ApiForPost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - post = BaseApi._users_post diff --git a/pynitrokey/nethsm/client/paths/users/post/request_body/__init__.py b/pynitrokey/nethsm/client/paths/users/post/request_body/__init__.py deleted file mode 100644 index ad29c4a8..00000000 --- a/pynitrokey/nethsm/client/paths/users/post/request_body/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -class RequestBody(api_client.RequestBody): - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } - required = True diff --git a/pynitrokey/nethsm/client/paths/users/post/request_body/content/__init__.py b/pynitrokey/nethsm/client/paths/users/post/request_body/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users/post/request_body/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/users/post/request_body/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users/post/request_body/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/users/post/request_body/content/application_json/schema.py deleted file mode 100644 index a532c81f..00000000 --- a/pynitrokey/nethsm/client/paths/users/post/request_body/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import user_post_data -Schema: typing_extensions.TypeAlias = user_post_data.UserPostData diff --git a/pynitrokey/nethsm/client/paths/users/post/responses/__init__.py b/pynitrokey/nethsm/client/paths/users/post/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users/post/responses/response_201/__init__.py b/pynitrokey/nethsm/client/paths/users/post/responses/response_201/__init__.py deleted file mode 100644 index dca4edc5..00000000 --- a/pynitrokey/nethsm/client/paths/users/post/responses/response_201/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor201(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users/post/responses/response_400/__init__.py b/pynitrokey/nethsm/client/paths/users/post/responses/response_400/__init__.py deleted file mode 100644 index 0458793b..00000000 --- a/pynitrokey/nethsm/client/paths/users/post/responses/response_400/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor400(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users/post/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/users/post/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/users/post/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users/post/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/users/post/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/users/post/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users/post/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/users/post/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/users/post/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users/post/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/users/post/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/users/post/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users/post/security/__init__.py b/pynitrokey/nethsm/client/paths/users/post/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users/post/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/users/post/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/users/post/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/users_user_id/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/__init__.py deleted file mode 100644 index 78b50211..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.users_user_id import UsersUserID - -path = "/users/{UserID}" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/users_user_id/delete/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/delete/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users_user_id/delete/operation.py b/pynitrokey/nethsm/client/paths/users_user_id/delete/operation.py deleted file mode 100644 index 381b40fa..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/delete/operation.py +++ /dev/null @@ -1,183 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .. import path -from .responses import ( - response_204, - response_401, - response_403, - response_404, - response_406, - response_412, -) -from .parameters import parameter_0 -from .security import security_requirement_object_0 -from .path_parameters import PathParameters, PathParametersDictInput, PathParametersDict -path_parameter_classes = ( - parameter_0.Parameter0, -) - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '204': typing.Type[response_204.ResponseFor204], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '404': typing.Type[response_404.ResponseFor404], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '204': response_204.ResponseFor204, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '404': response_404.ResponseFor404, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '204', -}) -_error_status_codes = frozenset({ - '401', - '403', - '404', - '406', - '412', -}) - - -class BaseApi(api_client.Api): - @typing.overload - def _users_user_id_delete( - self, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[False] = False, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_204.ApiResponse: ... - - @typing.overload - def _users_user_id_delete( - self, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[True], - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _users_user_id_delete( - self, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: bool = False, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - path_params = PathParameters.validate(path_params) - used_path, query_params_suffix = self._get_used_path( - path, - path_parameters=path_parameter_classes, - path_params=path_params, - skip_validation=True - ) - # TODO add cookie handling - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//users/{UserID}/delete/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='delete', - host=host, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '204', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '401', - '403', - '404', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class UsersUserIDDelete(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - users_user_id_delete = BaseApi._users_user_id_delete - - -class ApiForDelete(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - delete = BaseApi._users_user_id_delete diff --git a/pynitrokey/nethsm/client/paths/users_user_id/delete/parameters/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/delete/parameters/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users_user_id/delete/parameters/parameter_0/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/delete/parameters/parameter_0/__init__.py deleted file mode 100644 index bba16eb3..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/delete/parameters/parameter_0/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from . import schema - - -class Parameter0(api_client.PathParameter): - name = "UserID" - style = api_client.ParameterStyle.SIMPLE - schema: typing_extensions.TypeAlias = schema.Schema - required = True diff --git a/pynitrokey/nethsm/client/paths/users_user_id/delete/parameters/parameter_0/schema.py b/pynitrokey/nethsm/client/paths/users_user_id/delete/parameters/parameter_0/schema.py deleted file mode 100644 index 951e9038..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/delete/parameters/parameter_0/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -Schema: typing_extensions.TypeAlias = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/paths/users_user_id/delete/path_parameters.py b/pynitrokey/nethsm/client/paths/users_user_id/delete/path_parameters.py deleted file mode 100644 index 02a071af..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/delete/path_parameters.py +++ /dev/null @@ -1,100 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema - -from pynitrokey.nethsm.client.paths.users_user_id.delete.parameters.parameter_0 import schema -Properties = typing.TypedDict( - 'Properties', - { - "UserID": typing.Type[schema.Schema], - } -) - - -class PathParametersDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - - __required_keys__: typing.FrozenSet[str] = frozenset({ - "UserID", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - UserID: str, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - ): - arg_: typing.Dict[str, typing.Any] = { - "UserID": UserID, - } - used_arg_ = typing.cast(PathParametersDictInput, arg_) - return PathParameters.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return PathParameters.validate(arg, configuration=configuration) - - @property - def UserID(self) -> str: - return typing.cast( - str, - self.__getitem__("UserID") - ) -PathParametersDictInput = typing.TypedDict( - 'PathParametersDictInput', - { - "UserID": str, - } -) - - -@dataclasses.dataclass(frozen=True) -class PathParameters( - schemas.Schema[PathParametersDict, tuple] -): - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "UserID", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - additional_properties: typing.Type[AdditionalProperties] = dataclasses.field(default_factory=lambda: AdditionalProperties) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: PathParametersDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/paths/users_user_id/delete/responses/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/delete/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users_user_id/delete/responses/response_204/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/delete/responses/response_204/__init__.py deleted file mode 100644 index 8e822e77..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/delete/responses/response_204/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor204(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id/delete/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/delete/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/delete/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id/delete/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/delete/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/delete/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id/delete/responses/response_404/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/delete/responses/response_404/__init__.py deleted file mode 100644 index e43c74d8..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/delete/responses/response_404/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor404(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id/delete/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/delete/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/delete/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id/delete/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/delete/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/delete/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id/delete/security/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/delete/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users_user_id/delete/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/users_user_id/delete/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/delete/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/users_user_id/get/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/get/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users_user_id/get/operation.py b/pynitrokey/nethsm/client/paths/users_user_id/get/operation.py deleted file mode 100644 index 773a6ddf..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/get/operation.py +++ /dev/null @@ -1,197 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .. import path -from .responses import ( - response_200, - response_400, - response_401, - response_403, - response_404, - response_406, - response_412, -) -from .parameters import parameter_0 -from .security import security_requirement_object_0 -from .path_parameters import PathParameters, PathParametersDictInput, PathParametersDict -path_parameter_classes = ( - parameter_0.Parameter0, -) - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '200': typing.Type[response_200.ResponseFor200], - '400': typing.Type[response_400.ResponseFor400], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '404': typing.Type[response_404.ResponseFor404], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '200': response_200.ResponseFor200, - '400': response_400.ResponseFor400, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '404': response_404.ResponseFor404, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '200', -}) -_error_status_codes = frozenset({ - '400', - '401', - '403', - '404', - '406', - '412', -}) - -_all_accept_content_types = ( - "application/json", -) - - -class BaseApi(api_client.Api): - @typing.overload - def _users_user_id_get( - self, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[False] = False, - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_200.ApiResponse: ... - - @typing.overload - def _users_user_id_get( - self, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[True], - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _users_user_id_get( - self, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: bool = False, - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - path_params = PathParameters.validate(path_params) - used_path, query_params_suffix = self._get_used_path( - path, - path_parameters=path_parameter_classes, - path_params=path_params, - skip_validation=True - ) - headers = self._get_headers(accept_content_types=accept_content_types) - # TODO add cookie handling - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//users/{UserID}/get/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='get', - host=host, - headers=headers, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '200', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '400', - '401', - '403', - '404', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class UsersUserIDGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - users_user_id_get = BaseApi._users_user_id_get - - -class ApiForGet(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - get = BaseApi._users_user_id_get diff --git a/pynitrokey/nethsm/client/paths/users_user_id/get/parameters/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/get/parameters/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users_user_id/get/parameters/parameter_0/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/get/parameters/parameter_0/__init__.py deleted file mode 100644 index bba16eb3..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/get/parameters/parameter_0/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from . import schema - - -class Parameter0(api_client.PathParameter): - name = "UserID" - style = api_client.ParameterStyle.SIMPLE - schema: typing_extensions.TypeAlias = schema.Schema - required = True diff --git a/pynitrokey/nethsm/client/paths/users_user_id/get/parameters/parameter_0/schema.py b/pynitrokey/nethsm/client/paths/users_user_id/get/parameters/parameter_0/schema.py deleted file mode 100644 index 951e9038..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/get/parameters/parameter_0/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -Schema: typing_extensions.TypeAlias = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/paths/users_user_id/get/path_parameters.py b/pynitrokey/nethsm/client/paths/users_user_id/get/path_parameters.py deleted file mode 100644 index 7bb59cf9..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/get/path_parameters.py +++ /dev/null @@ -1,100 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema - -from pynitrokey.nethsm.client.paths.users_user_id.get.parameters.parameter_0 import schema -Properties = typing.TypedDict( - 'Properties', - { - "UserID": typing.Type[schema.Schema], - } -) - - -class PathParametersDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - - __required_keys__: typing.FrozenSet[str] = frozenset({ - "UserID", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - UserID: str, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - ): - arg_: typing.Dict[str, typing.Any] = { - "UserID": UserID, - } - used_arg_ = typing.cast(PathParametersDictInput, arg_) - return PathParameters.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return PathParameters.validate(arg, configuration=configuration) - - @property - def UserID(self) -> str: - return typing.cast( - str, - self.__getitem__("UserID") - ) -PathParametersDictInput = typing.TypedDict( - 'PathParametersDictInput', - { - "UserID": str, - } -) - - -@dataclasses.dataclass(frozen=True) -class PathParameters( - schemas.Schema[PathParametersDict, tuple] -): - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "UserID", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - additional_properties: typing.Type[AdditionalProperties] = dataclasses.field(default_factory=lambda: AdditionalProperties) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: PathParametersDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/paths/users_user_id/get/responses/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/get/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_200/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_200/__init__.py deleted file mode 100644 index 60b2f7a5..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_200/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: application_json_schema.user_data.UserDataDict - headers: schemas.Unset = schemas.unset - - -class ResponseFor200(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } diff --git a/pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_200/content/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_200/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_200/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_200/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_200/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_200/content/application_json/schema.py deleted file mode 100644 index a08695a4..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_200/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import user_data -Schema: typing_extensions.TypeAlias = user_data.UserData diff --git a/pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_400/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_400/__init__.py deleted file mode 100644 index 0458793b..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_400/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor400(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_404/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_404/__init__.py deleted file mode 100644 index e43c74d8..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_404/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor404(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id/get/security/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/get/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users_user_id/get/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/users_user_id/get/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/get/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/users_user_id/put/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/put/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users_user_id/put/operation.py b/pynitrokey/nethsm/client/paths/users_user_id/put/operation.py deleted file mode 100644 index 6a08d1fe..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/put/operation.py +++ /dev/null @@ -1,216 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import user_post_data - -from .. import path -from .responses import ( - response_201, - response_400, - response_401, - response_403, - response_406, - response_409, - response_412, -) -from . import request_body -from .parameters import parameter_0 -from .security import security_requirement_object_0 -from .path_parameters import PathParameters, PathParametersDictInput, PathParametersDict -path_parameter_classes = ( - parameter_0.Parameter0, -) - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '201': typing.Type[response_201.ResponseFor201], - '400': typing.Type[response_400.ResponseFor400], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '406': typing.Type[response_406.ResponseFor406], - '409': typing.Type[response_409.ResponseFor409], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '201': response_201.ResponseFor201, - '400': response_400.ResponseFor400, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '406': response_406.ResponseFor406, - '409': response_409.ResponseFor409, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '201', -}) -_error_status_codes = frozenset({ - '400', - '401', - '403', - '406', - '409', - '412', -}) - - -class BaseApi(api_client.Api): - @typing.overload - def _users_user_id_put( - self, - body: typing.Union[ - user_post_data.UserPostDataDictInput, - user_post_data.UserPostDataDict, - ], - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[False] = False, - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_201.ApiResponse: ... - - @typing.overload - def _users_user_id_put( - self, - body: typing.Union[ - user_post_data.UserPostDataDictInput, - user_post_data.UserPostDataDict, - ], - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[True], - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _users_user_id_put( - self, - body: typing.Union[ - user_post_data.UserPostDataDictInput, - user_post_data.UserPostDataDict, - ], - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: bool = False, - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - path_params = PathParameters.validate(path_params) - used_path, query_params_suffix = self._get_used_path( - path, - path_parameters=path_parameter_classes, - path_params=path_params, - skip_validation=True - ) - headers = self._get_headers() - # TODO add cookie handling - - fields, serialized_body = self._get_fields_and_body( - request_body=request_body.RequestBody, - body=body, - content_type=content_type, - headers=headers - ) - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//users/{UserID}/put/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='put', - host=host, - headers=headers, - fields=fields, - body=serialized_body, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '201', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '400', - '401', - '403', - '406', - '409', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class UsersUserIDPut(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - users_user_id_put = BaseApi._users_user_id_put - - -class ApiForPut(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - put = BaseApi._users_user_id_put diff --git a/pynitrokey/nethsm/client/paths/users_user_id/put/parameters/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/put/parameters/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users_user_id/put/parameters/parameter_0/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/put/parameters/parameter_0/__init__.py deleted file mode 100644 index bba16eb3..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/put/parameters/parameter_0/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from . import schema - - -class Parameter0(api_client.PathParameter): - name = "UserID" - style = api_client.ParameterStyle.SIMPLE - schema: typing_extensions.TypeAlias = schema.Schema - required = True diff --git a/pynitrokey/nethsm/client/paths/users_user_id/put/parameters/parameter_0/schema.py b/pynitrokey/nethsm/client/paths/users_user_id/put/parameters/parameter_0/schema.py deleted file mode 100644 index 951e9038..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/put/parameters/parameter_0/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -Schema: typing_extensions.TypeAlias = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/paths/users_user_id/put/path_parameters.py b/pynitrokey/nethsm/client/paths/users_user_id/put/path_parameters.py deleted file mode 100644 index 2a9b2a85..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/put/path_parameters.py +++ /dev/null @@ -1,100 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema - -from pynitrokey.nethsm.client.paths.users_user_id.put.parameters.parameter_0 import schema -Properties = typing.TypedDict( - 'Properties', - { - "UserID": typing.Type[schema.Schema], - } -) - - -class PathParametersDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - - __required_keys__: typing.FrozenSet[str] = frozenset({ - "UserID", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - UserID: str, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - ): - arg_: typing.Dict[str, typing.Any] = { - "UserID": UserID, - } - used_arg_ = typing.cast(PathParametersDictInput, arg_) - return PathParameters.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return PathParameters.validate(arg, configuration=configuration) - - @property - def UserID(self) -> str: - return typing.cast( - str, - self.__getitem__("UserID") - ) -PathParametersDictInput = typing.TypedDict( - 'PathParametersDictInput', - { - "UserID": str, - } -) - - -@dataclasses.dataclass(frozen=True) -class PathParameters( - schemas.Schema[PathParametersDict, tuple] -): - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "UserID", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - additional_properties: typing.Type[AdditionalProperties] = dataclasses.field(default_factory=lambda: AdditionalProperties) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: PathParametersDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/paths/users_user_id/put/request_body/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/put/request_body/__init__.py deleted file mode 100644 index ad29c4a8..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/put/request_body/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -class RequestBody(api_client.RequestBody): - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } - required = True diff --git a/pynitrokey/nethsm/client/paths/users_user_id/put/request_body/content/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/put/request_body/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users_user_id/put/request_body/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/put/request_body/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users_user_id/put/request_body/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/users_user_id/put/request_body/content/application_json/schema.py deleted file mode 100644 index a532c81f..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/put/request_body/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import user_post_data -Schema: typing_extensions.TypeAlias = user_post_data.UserPostData diff --git a/pynitrokey/nethsm/client/paths/users_user_id/put/responses/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/put/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_201/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_201/__init__.py deleted file mode 100644 index dca4edc5..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_201/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor201(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_400/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_400/__init__.py deleted file mode 100644 index 0458793b..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_400/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor400(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_409/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_409/__init__.py deleted file mode 100644 index ce260df9..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_409/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor409(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id/put/security/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/put/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users_user_id/put/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/users_user_id/put/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/put/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/__init__.py deleted file mode 100644 index 54c98289..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.users_user_id_passphrase import UsersUserIDPassphrase - -path = "/users/{UserID}/passphrase" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/operation.py b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/operation.py deleted file mode 100644 index fd676435..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/operation.py +++ /dev/null @@ -1,216 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import user_passphrase_post_data - -from .. import path -from .responses import ( - response_204, - response_400, - response_401, - response_403, - response_404, - response_406, - response_412, -) -from . import request_body -from .parameters import parameter_0 -from .security import security_requirement_object_0 -from .path_parameters import PathParameters, PathParametersDictInput, PathParametersDict -path_parameter_classes = ( - parameter_0.Parameter0, -) - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '204': typing.Type[response_204.ResponseFor204], - '400': typing.Type[response_400.ResponseFor400], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '404': typing.Type[response_404.ResponseFor404], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '204': response_204.ResponseFor204, - '400': response_400.ResponseFor400, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '404': response_404.ResponseFor404, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '204', -}) -_error_status_codes = frozenset({ - '400', - '401', - '403', - '404', - '406', - '412', -}) - - -class BaseApi(api_client.Api): - @typing.overload - def _users_user_id_passphrase_post( - self, - body: typing.Union[ - user_passphrase_post_data.UserPassphrasePostDataDictInput, - user_passphrase_post_data.UserPassphrasePostDataDict, - ], - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[False] = False, - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_204.ApiResponse: ... - - @typing.overload - def _users_user_id_passphrase_post( - self, - body: typing.Union[ - user_passphrase_post_data.UserPassphrasePostDataDictInput, - user_passphrase_post_data.UserPassphrasePostDataDict, - ], - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[True], - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _users_user_id_passphrase_post( - self, - body: typing.Union[ - user_passphrase_post_data.UserPassphrasePostDataDictInput, - user_passphrase_post_data.UserPassphrasePostDataDict, - ], - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: bool = False, - content_type: typing.Literal["application/json"] = "application/json", - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - path_params = PathParameters.validate(path_params) - used_path, query_params_suffix = self._get_used_path( - path, - path_parameters=path_parameter_classes, - path_params=path_params, - skip_validation=True - ) - headers = self._get_headers() - # TODO add cookie handling - - fields, serialized_body = self._get_fields_and_body( - request_body=request_body.RequestBody, - body=body, - content_type=content_type, - headers=headers - ) - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//users/{UserID}/passphrase/post/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='post', - host=host, - headers=headers, - fields=fields, - body=serialized_body, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '204', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '400', - '401', - '403', - '404', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class UsersUserIDPassphrasePost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - users_user_id_passphrase_post = BaseApi._users_user_id_passphrase_post - - -class ApiForPost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - post = BaseApi._users_user_id_passphrase_post diff --git a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/parameters/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/parameters/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/parameters/parameter_0/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/parameters/parameter_0/__init__.py deleted file mode 100644 index bba16eb3..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/parameters/parameter_0/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from . import schema - - -class Parameter0(api_client.PathParameter): - name = "UserID" - style = api_client.ParameterStyle.SIMPLE - schema: typing_extensions.TypeAlias = schema.Schema - required = True diff --git a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/parameters/parameter_0/schema.py b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/parameters/parameter_0/schema.py deleted file mode 100644 index 951e9038..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/parameters/parameter_0/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -Schema: typing_extensions.TypeAlias = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/path_parameters.py b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/path_parameters.py deleted file mode 100644 index 0e5c38ed..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/path_parameters.py +++ /dev/null @@ -1,100 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema - -from pynitrokey.nethsm.client.paths.users_user_id_passphrase.post.parameters.parameter_0 import schema -Properties = typing.TypedDict( - 'Properties', - { - "UserID": typing.Type[schema.Schema], - } -) - - -class PathParametersDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - - __required_keys__: typing.FrozenSet[str] = frozenset({ - "UserID", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - UserID: str, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - ): - arg_: typing.Dict[str, typing.Any] = { - "UserID": UserID, - } - used_arg_ = typing.cast(PathParametersDictInput, arg_) - return PathParameters.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return PathParameters.validate(arg, configuration=configuration) - - @property - def UserID(self) -> str: - return typing.cast( - str, - self.__getitem__("UserID") - ) -PathParametersDictInput = typing.TypedDict( - 'PathParametersDictInput', - { - "UserID": str, - } -) - - -@dataclasses.dataclass(frozen=True) -class PathParameters( - schemas.Schema[PathParametersDict, tuple] -): - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "UserID", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - additional_properties: typing.Type[AdditionalProperties] = dataclasses.field(default_factory=lambda: AdditionalProperties) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: PathParametersDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/request_body/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/request_body/__init__.py deleted file mode 100644 index ad29c4a8..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/request_body/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -class RequestBody(api_client.RequestBody): - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } - required = True diff --git a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/request_body/content/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/request_body/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/request_body/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/request_body/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/request_body/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/request_body/content/application_json/schema.py deleted file mode 100644 index 5121d31c..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/request_body/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import user_passphrase_post_data -Schema: typing_extensions.TypeAlias = user_passphrase_post_data.UserPassphrasePostData diff --git a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_204/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_204/__init__.py deleted file mode 100644 index 8e822e77..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_204/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor204(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_400/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_400/__init__.py deleted file mode 100644 index 0458793b..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_400/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor400(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_404/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_404/__init__.py deleted file mode 100644 index e43c74d8..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_404/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor404(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/security/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags/__init__.py deleted file mode 100644 index ad90ff4f..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.users_user_id_tags import UsersUserIDTags - -path = "/users/{UserID}/tags" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags/get/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags/get/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags/get/operation.py b/pynitrokey/nethsm/client/paths/users_user_id_tags/get/operation.py deleted file mode 100644 index f212dcf1..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags/get/operation.py +++ /dev/null @@ -1,197 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .. import path -from .responses import ( - response_200, - response_400, - response_401, - response_403, - response_404, - response_406, - response_412, -) -from .parameters import parameter_0 -from .security import security_requirement_object_0 -from .path_parameters import PathParameters, PathParametersDictInput, PathParametersDict -path_parameter_classes = ( - parameter_0.Parameter0, -) - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '200': typing.Type[response_200.ResponseFor200], - '400': typing.Type[response_400.ResponseFor400], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '404': typing.Type[response_404.ResponseFor404], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '200': response_200.ResponseFor200, - '400': response_400.ResponseFor400, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '404': response_404.ResponseFor404, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '200', -}) -_error_status_codes = frozenset({ - '400', - '401', - '403', - '404', - '406', - '412', -}) - -_all_accept_content_types = ( - "application/json", -) - - -class BaseApi(api_client.Api): - @typing.overload - def _users_user_id_tags_get( - self, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[False] = False, - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_200.ApiResponse: ... - - @typing.overload - def _users_user_id_tags_get( - self, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[True], - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _users_user_id_tags_get( - self, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: bool = False, - accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - path_params = PathParameters.validate(path_params) - used_path, query_params_suffix = self._get_used_path( - path, - path_parameters=path_parameter_classes, - path_params=path_params, - skip_validation=True - ) - headers = self._get_headers(accept_content_types=accept_content_types) - # TODO add cookie handling - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//users/{UserID}/tags/get/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='get', - host=host, - headers=headers, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '200', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '400', - '401', - '403', - '404', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class UsersUserIDTagsGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - users_user_id_tags_get = BaseApi._users_user_id_tags_get - - -class ApiForGet(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - get = BaseApi._users_user_id_tags_get diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags/get/parameters/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags/get/parameters/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags/get/parameters/parameter_0/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags/get/parameters/parameter_0/__init__.py deleted file mode 100644 index bba16eb3..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags/get/parameters/parameter_0/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from . import schema - - -class Parameter0(api_client.PathParameter): - name = "UserID" - style = api_client.ParameterStyle.SIMPLE - schema: typing_extensions.TypeAlias = schema.Schema - required = True diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags/get/parameters/parameter_0/schema.py b/pynitrokey/nethsm/client/paths/users_user_id_tags/get/parameters/parameter_0/schema.py deleted file mode 100644 index 951e9038..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags/get/parameters/parameter_0/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -Schema: typing_extensions.TypeAlias = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags/get/path_parameters.py b/pynitrokey/nethsm/client/paths/users_user_id_tags/get/path_parameters.py deleted file mode 100644 index 27609661..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags/get/path_parameters.py +++ /dev/null @@ -1,100 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema - -from pynitrokey.nethsm.client.paths.users_user_id_tags.get.parameters.parameter_0 import schema -Properties = typing.TypedDict( - 'Properties', - { - "UserID": typing.Type[schema.Schema], - } -) - - -class PathParametersDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - - __required_keys__: typing.FrozenSet[str] = frozenset({ - "UserID", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - UserID: str, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - ): - arg_: typing.Dict[str, typing.Any] = { - "UserID": UserID, - } - used_arg_ = typing.cast(PathParametersDictInput, arg_) - return PathParameters.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return PathParameters.validate(arg, configuration=configuration) - - @property - def UserID(self) -> str: - return typing.cast( - str, - self.__getitem__("UserID") - ) -PathParametersDictInput = typing.TypedDict( - 'PathParametersDictInput', - { - "UserID": str, - } -) - - -@dataclasses.dataclass(frozen=True) -class PathParameters( - schemas.Schema[PathParametersDict, tuple] -): - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "UserID", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - additional_properties: typing.Type[AdditionalProperties] = dataclasses.field(default_factory=lambda: AdditionalProperties) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: PathParametersDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_200/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_200/__init__.py deleted file mode 100644 index 02c74bb4..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_200/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .content.application_json import schema as application_json_schema - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: application_json_schema.tag_list.TagListTuple - headers: schemas.Unset = schemas.unset - - -class ResponseFor200(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) - - - class ApplicationJsonMediaType(api_client.MediaType): - schema: typing_extensions.TypeAlias = application_json_schema.Schema - content = { - 'application/json': ApplicationJsonMediaType, - } diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_200/content/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_200/content/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_200/content/application_json/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_200/content/application_json/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_200/content/application_json/schema.py b/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_200/content/application_json/schema.py deleted file mode 100644 index 9086ed6f..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_200/content/application_json/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - - -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.components.schema import tag_list -Schema: typing_extensions.TypeAlias = tag_list.TagList diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_400/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_400/__init__.py deleted file mode 100644 index 0458793b..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_400/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor400(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_404/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_404/__init__.py deleted file mode 100644 index e43c74d8..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_404/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor404(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags/get/security/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags/get/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags/get/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/users_user_id_tags/get/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags/get/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/__init__.py deleted file mode 100644 index fa912c1a..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# do not import all endpoints into this module because that uses a lot of memory and stack frames -# if you need the ability to import all endpoints from this module, import them with -# from pynitrokey.nethsm.client.apis.paths.users_user_id_tags_tag import UsersUserIDTagsTag - -path = "/users/{UserID}/tags/{Tag}" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/operation.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/operation.py deleted file mode 100644 index 398ceab5..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/operation.py +++ /dev/null @@ -1,187 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .. import path -from .responses import ( - response_204, - response_401, - response_403, - response_404, - response_406, - response_412, -) -from .parameters import ( - parameter_0, - parameter_1, -) -from .security import security_requirement_object_0 -from .path_parameters import PathParameters, PathParametersDictInput, PathParametersDict -path_parameter_classes = ( - parameter_0.Parameter0, - parameter_1.Parameter1, -) - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '204': typing.Type[response_204.ResponseFor204], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '404': typing.Type[response_404.ResponseFor404], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '204': response_204.ResponseFor204, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '404': response_404.ResponseFor404, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '204', -}) -_error_status_codes = frozenset({ - '401', - '403', - '404', - '406', - '412', -}) - - -class BaseApi(api_client.Api): - @typing.overload - def _users_user_id_tags_tag_delete( - self, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[False] = False, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> response_204.ApiResponse: ... - - @typing.overload - def _users_user_id_tags_tag_delete( - self, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[True], - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _users_user_id_tags_tag_delete( - self, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: bool = False, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - path_params = PathParameters.validate(path_params) - used_path, query_params_suffix = self._get_used_path( - path, - path_parameters=path_parameter_classes, - path_params=path_params, - skip_validation=True - ) - # TODO add cookie handling - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//users/{UserID}/tags/{Tag}/delete/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='delete', - host=host, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '204', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '401', - '403', - '404', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class UsersUserIDTagsTagDelete(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - users_user_id_tags_tag_delete = BaseApi._users_user_id_tags_tag_delete - - -class ApiForDelete(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - delete = BaseApi._users_user_id_tags_tag_delete diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/parameters/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/parameters/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/parameters/parameter_0/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/parameters/parameter_0/__init__.py deleted file mode 100644 index bba16eb3..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/parameters/parameter_0/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from . import schema - - -class Parameter0(api_client.PathParameter): - name = "UserID" - style = api_client.ParameterStyle.SIMPLE - schema: typing_extensions.TypeAlias = schema.Schema - required = True diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/parameters/parameter_0/schema.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/parameters/parameter_0/schema.py deleted file mode 100644 index 951e9038..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/parameters/parameter_0/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -Schema: typing_extensions.TypeAlias = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/parameters/parameter_1/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/parameters/parameter_1/__init__.py deleted file mode 100644 index 818efeef..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/parameters/parameter_1/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from . import schema - - -class Parameter1(api_client.PathParameter): - name = "Tag" - style = api_client.ParameterStyle.SIMPLE - schema: typing_extensions.TypeAlias = schema.Schema - required = True diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/parameters/parameter_1/schema.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/parameters/parameter_1/schema.py deleted file mode 100644 index 951e9038..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/parameters/parameter_1/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -Schema: typing_extensions.TypeAlias = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/path_parameters.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/path_parameters.py deleted file mode 100644 index 402ac9f4..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/path_parameters.py +++ /dev/null @@ -1,113 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema - -from pynitrokey.nethsm.client.paths.users_user_id_tags_tag.delete.parameters.parameter_0 import schema -from pynitrokey.nethsm.client.paths.users_user_id_tags_tag.delete.parameters.parameter_1 import schema as schema_2 -Properties = typing.TypedDict( - 'Properties', - { - "UserID": typing.Type[schema.Schema], - "Tag": typing.Type[schema_2.Schema], - } -) - - -class PathParametersDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - __required_keys__: typing.FrozenSet[str] = frozenset({ - "Tag", - "UserID", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - Tag: str, - UserID: str, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - ): - arg_: typing.Dict[str, typing.Any] = { - "Tag": Tag, - "UserID": UserID, - } - used_arg_ = typing.cast(PathParametersDictInput, arg_) - return PathParameters.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return PathParameters.validate(arg, configuration=configuration) - - @property - def Tag(self) -> str: - return typing.cast( - str, - self.__getitem__("Tag") - ) - - @property - def UserID(self) -> str: - return typing.cast( - str, - self.__getitem__("UserID") - ) -PathParametersDictInput = typing.TypedDict( - 'PathParametersDictInput', - { - "Tag": str, - "UserID": str, - } -) - - -@dataclasses.dataclass(frozen=True) -class PathParameters( - schemas.Schema[PathParametersDict, tuple] -): - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "Tag", - "UserID", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - additional_properties: typing.Type[AdditionalProperties] = dataclasses.field(default_factory=lambda: AdditionalProperties) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: PathParametersDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/response_204/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/response_204/__init__.py deleted file mode 100644 index 8e822e77..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/response_204/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor204(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/response_404/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/response_404/__init__.py deleted file mode 100644 index e43c74d8..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/response_404/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor404(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/security/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/operation.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/operation.py deleted file mode 100644 index 1784d1ea..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/operation.py +++ /dev/null @@ -1,200 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import api_client, exceptions, security_schemes -from pynitrokey.nethsm.client.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from .. import path -from .responses import ( - response_204, - response_304, - response_400, - response_401, - response_403, - response_404, - response_406, - response_412, -) -from .parameters import ( - parameter_0, - parameter_1, -) -from .security import security_requirement_object_0 -from .path_parameters import PathParameters, PathParametersDictInput, PathParametersDict -path_parameter_classes = ( - parameter_0.Parameter0, - parameter_1.Parameter1, -) - -_security: typing.List[security_schemes.SecurityRequirementObject] = [ - security_requirement_object_0.security_requirement_object, -] - - -__StatusCodeToResponse = typing.TypedDict( - '__StatusCodeToResponse', - { - '204': typing.Type[response_204.ResponseFor204], - '304': typing.Type[response_304.ResponseFor304], - '400': typing.Type[response_400.ResponseFor400], - '401': typing.Type[response_401.ResponseFor401], - '403': typing.Type[response_403.ResponseFor403], - '404': typing.Type[response_404.ResponseFor404], - '406': typing.Type[response_406.ResponseFor406], - '412': typing.Type[response_412.ResponseFor412], - } -) -_status_code_to_response: __StatusCodeToResponse = { - '204': response_204.ResponseFor204, - '304': response_304.ResponseFor304, - '400': response_400.ResponseFor400, - '401': response_401.ResponseFor401, - '403': response_403.ResponseFor403, - '404': response_404.ResponseFor404, - '406': response_406.ResponseFor406, - '412': response_412.ResponseFor412, -} -_non_error_status_codes = frozenset({ - '204', - '304', -}) -_error_status_codes = frozenset({ - '400', - '401', - '403', - '404', - '406', - '412', -}) - - -class BaseApi(api_client.Api): - @typing.overload - def _users_user_id_tags_tag_put( - self, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[False] = False, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> typing.Union[ - response_204.ApiResponse, - response_304.ApiResponse, - ]: ... - - @typing.overload - def _users_user_id_tags_tag_put( - self, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: typing.Literal[True], - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> api_response.ApiResponseWithoutDeserialization: ... - - def _users_user_id_tags_tag_put( - self, - path_params: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - *, - skip_deserialization: bool = False, - security_index: typing.Optional[int] = None, - server_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - path_params = PathParameters.validate(path_params) - used_path, query_params_suffix = self._get_used_path( - path, - path_parameters=path_parameter_classes, - path_params=path_params, - skip_validation=True - ) - # TODO add cookie handling - host = self.api_client.configuration.get_server_url( - "servers", server_index - ) - security_requirement_object = self.api_client.configuration.get_security_requirement_object( - "paths//users/{UserID}/tags/{Tag}/put/security", - _security, - security_index - ) - - raw_response = self.api_client.call_api( - resource_path=used_path, - method='put', - host=host, - security_requirement_object=security_requirement_object, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(skip_deser_response) - return skip_deser_response - - status = str(raw_response.status) - if status in _non_error_status_codes: - status_code = typing.cast( - typing.Literal[ - '204', - '304', - ], - status - ) - return _status_code_to_response[status_code].deserialize( - raw_response, self.api_client.schema_configuration) - elif status in _error_status_codes: - error_status_code = typing.cast( - typing.Literal[ - '400', - '401', - '403', - '404', - '406', - '412', - ], - status - ) - error_response = _status_code_to_response[error_status_code].deserialize( - raw_response, self.api_client.schema_configuration) - raise exceptions.ApiException( - status=error_response.response.status, - reason=error_response.response.reason, - api_response=error_response - ) - - response = api_response.ApiResponseWithoutDeserialization(response=raw_response) - self._verify_response_status(response) - return response - - -class UsersUserIDTagsTagPut(BaseApi): - # this class is used by api classes that refer to endpoints with operationId.snakeCase fn names - users_user_id_tags_tag_put = BaseApi._users_user_id_tags_tag_put - - -class ApiForPut(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - put = BaseApi._users_user_id_tags_tag_put diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/parameters/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/parameters/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/parameters/parameter_0/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/parameters/parameter_0/__init__.py deleted file mode 100644 index bba16eb3..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/parameters/parameter_0/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from . import schema - - -class Parameter0(api_client.PathParameter): - name = "UserID" - style = api_client.ParameterStyle.SIMPLE - schema: typing_extensions.TypeAlias = schema.Schema - required = True diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/parameters/parameter_0/schema.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/parameters/parameter_0/schema.py deleted file mode 100644 index 951e9038..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/parameters/parameter_0/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -Schema: typing_extensions.TypeAlias = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/parameters/parameter_1/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/parameters/parameter_1/__init__.py deleted file mode 100644 index 818efeef..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/parameters/parameter_1/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -from . import schema - - -class Parameter1(api_client.PathParameter): - name = "Tag" - style = api_client.ParameterStyle.SIMPLE - schema: typing_extensions.TypeAlias = schema.Schema - required = True diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/parameters/parameter_1/schema.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/parameters/parameter_1/schema.py deleted file mode 100644 index 951e9038..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/parameters/parameter_1/schema.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -Schema: typing_extensions.TypeAlias = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/path_parameters.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/path_parameters.py deleted file mode 100644 index 4eeef40e..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/path_parameters.py +++ /dev/null @@ -1,113 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - -AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema - -from pynitrokey.nethsm.client.paths.users_user_id_tags_tag.put.parameters.parameter_0 import schema -from pynitrokey.nethsm.client.paths.users_user_id_tags_tag.put.parameters.parameter_1 import schema as schema_2 -Properties = typing.TypedDict( - 'Properties', - { - "UserID": typing.Type[schema.Schema], - "Tag": typing.Type[schema_2.Schema], - } -) - - -class PathParametersDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): - __required_keys__: typing.FrozenSet[str] = frozenset({ - "Tag", - "UserID", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - Tag: str, - UserID: str, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - ): - arg_: typing.Dict[str, typing.Any] = { - "Tag": Tag, - "UserID": UserID, - } - used_arg_ = typing.cast(PathParametersDictInput, arg_) - return PathParameters.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return PathParameters.validate(arg, configuration=configuration) - - @property - def Tag(self) -> str: - return typing.cast( - str, - self.__getitem__("Tag") - ) - - @property - def UserID(self) -> str: - return typing.cast( - str, - self.__getitem__("UserID") - ) -PathParametersDictInput = typing.TypedDict( - 'PathParametersDictInput', - { - "Tag": str, - "UserID": str, - } -) - - -@dataclasses.dataclass(frozen=True) -class PathParameters( - schemas.Schema[PathParametersDict, tuple] -): - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "Tag", - "UserID", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - additional_properties: typing.Type[AdditionalProperties] = dataclasses.field(default_factory=lambda: AdditionalProperties) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: PathParametersDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - PathParametersDictInput, - PathParametersDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> PathParametersDict: - return super().validate_base( - arg, - configuration=configuration, - ) - diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_204/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_204/__init__.py deleted file mode 100644 index 8e822e77..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_204/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor204(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_304/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_304/__init__.py deleted file mode 100644 index 287e3265..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_304/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor304(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_400/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_400/__init__.py deleted file mode 100644 index 0458793b..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_400/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor400(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_401/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_401/__init__.py deleted file mode 100644 index cee35061..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_401/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor401(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_403/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_403/__init__.py deleted file mode 100644 index 7bc0249d..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_403/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor403(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_404/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_404/__init__.py deleted file mode 100644 index e43c74d8..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_404/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor404(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_406/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_406/__init__.py deleted file mode 100644 index 088c436c..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_406/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor406(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_412/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_412/__init__.py deleted file mode 100644 index 50b6212f..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_412/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary] - - -@dataclasses.dataclass -class ApiResponse(api_response.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -class ResponseFor412(api_client.OpenApiResponse[ApiResponse]): - @classmethod - def get_response(cls, response, headers, body) -> ApiResponse: - return ApiResponse(response=response, body=body, headers=headers) diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/security/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/security/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/security/security_requirement_object_0.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/security/security_requirement_object_0.py deleted file mode 100644 index f3b60942..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/security/security_requirement_object_0.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from pynitrokey.nethsm.client import security_schemes - -security_requirement_object: security_schemes.SecurityRequirementObject = { - "basic": (), -} diff --git a/pynitrokey/nethsm/client/py.typed b/pynitrokey/nethsm/client/py.typed deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/rest.py b/pynitrokey/nethsm/client/rest.py deleted file mode 100644 index fb4ce1ff..00000000 --- a/pynitrokey/nethsm/client/rest.py +++ /dev/null @@ -1,270 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -import logging -import ssl -from urllib.parse import urlencode -import typing - -import certifi # type: ignore[import] -import urllib3 -from urllib3 import fields -from urllib3 import exceptions as urllib3_exceptions -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import exceptions - - -logger = logging.getLogger(__name__) -_TYPE_FIELD_VALUE = typing.Union[str, bytes] - - -class RequestField(fields.RequestField): - def __init__( - self, - name: str, - data: _TYPE_FIELD_VALUE, - filename: typing.Optional[str] = None, - headers: typing.Optional[typing.Mapping[str, typing.Union[str, None]]] = None, - header_formatter: typing.Optional[typing.Callable[[str, _TYPE_FIELD_VALUE], str]] = None, - ): - super().__init__(name, data, filename, headers, header_formatter) # type: ignore - - def __eq__(self, other): - if not isinstance(other, fields.RequestField): - return False - return self.__dict__ == other.__dict__ - - -class RESTClientObject(object): - - def __init__(self, configuration, pools_size=4, maxsize=None): - # urllib3.PoolManager will pass all kw parameters to connectionpool - # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 - # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501 - # maxsize is the number of requests to host that are allowed in parallel # noqa: E501 - # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501 - - # cert_reqs - if configuration.verify_ssl: - cert_reqs = ssl.CERT_REQUIRED - else: - cert_reqs = ssl.CERT_NONE - - # ca_certs - if configuration.ssl_ca_cert: - ca_certs = configuration.ssl_ca_cert - else: - # if not set certificate file, use Mozilla's root certificates. - ca_certs = certifi.where() - - addition_pool_args = {} - if configuration.assert_hostname is not None: - addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501 - - if configuration.retries is not None: - addition_pool_args['retries'] = configuration.retries - - if configuration.socket_options is not None: - addition_pool_args['socket_options'] = configuration.socket_options - - if maxsize is None: - if configuration.connection_pool_maxsize is not None: - maxsize = configuration.connection_pool_maxsize - else: - maxsize = 4 - - # https pool manager - if configuration.proxy: - self.pool_manager = urllib3.ProxyManager( - num_pools=pools_size, - maxsize=maxsize, - cert_reqs=cert_reqs, - ca_certs=ca_certs, - cert_file=configuration.cert_file, - key_file=configuration.key_file, - proxy_url=configuration.proxy, - proxy_headers=configuration.proxy_headers, - **addition_pool_args - ) - else: - self.pool_manager = urllib3.PoolManager( - num_pools=pools_size, - maxsize=maxsize, - cert_reqs=cert_reqs, - ca_certs=ca_certs, - cert_file=configuration.cert_file, - key_file=configuration.key_file, - **addition_pool_args - ) - - def request( - self, - method: str, - url: str, - headers: typing.Optional[HTTPHeaderDict] = None, - fields: typing.Optional[typing.Tuple[RequestField, ...]] = None, - body: typing.Optional[typing.Union[str, bytes]] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - ) -> urllib3.HTTPResponse: - """Perform requests. - - :param method: http request method - :param url: http request url - :param headers: http request headers - :param body: request body, for other types - :param fields: request parameters for - `application/x-www-form-urlencoded` - or `multipart/form-data` - :param stream: if True, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is False. - :param timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - """ - assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT', - 'PATCH', 'OPTIONS'] - - if fields and body: - raise exceptions.ApiValueError( - "body parameter cannot be used with fields parameter." - ) - - headers = headers or HTTPHeaderDict() - - used_timeout: typing.Optional[urllib3.Timeout] = None - if timeout: - if isinstance(timeout, (int, float)): - used_timeout = urllib3.Timeout(total=timeout) - elif (isinstance(timeout, tuple) and - len(timeout) == 2): - used_timeout = urllib3.Timeout(connect=timeout[0], read=timeout[1]) - - try: - # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` - if method in {'POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE'}: - if 'Content-Type' not in headers and body is None: - r = self.pool_manager.request( - method, - url, - preload_content=not stream, - timeout=used_timeout, - headers=headers - ) - elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 - r = self.pool_manager.request( - method, url, - body=body, - encode_multipart=False, - preload_content=not stream, - timeout=used_timeout, - headers=headers) - elif headers['Content-Type'] == 'multipart/form-data': - # must del headers['Content-Type'], or the correct - # Content-Type which generated by urllib3 will be - # overwritten. - del headers['Content-Type'] - r = self.pool_manager.request( - method, url, - fields=fields, - encode_multipart=True, - preload_content=not stream, - timeout=used_timeout, - headers=headers) - # Pass a `string` parameter directly in the body to support - # other content types than Json when `body` argument is - # provided in serialized form - elif isinstance(body, str) or isinstance(body, bytes): - request_body = body - r = self.pool_manager.request( - method, url, - body=request_body, - preload_content=not stream, - timeout=used_timeout, - headers=headers) - else: - # Cannot generate the request from given parameters - msg = """Cannot prepare a request message for provided - arguments. Please check that your arguments match - declared content type.""" - raise exceptions.ApiException(status=0, reason=msg) - # For `GET`, `HEAD` - else: - r = self.pool_manager.request(method, url, - preload_content=not stream, - timeout=used_timeout, - headers=headers) - except urllib3_exceptions.SSLError as e: - msg = "{0}\n{1}".format(type(e).__name__, str(e)) - raise exceptions.ApiException(status=0, reason=msg) - - if not stream: - # log response body - logger.debug("response body: %s", r.data) - - return r - - def get(self, url, headers=None, stream=False, - timeout=None, fields=None) -> urllib3.HTTPResponse: - return self.request("GET", url, - headers=headers, - stream=stream, - timeout=timeout, - fields=fields) - - def head(self, url, headers=None, stream=False, - timeout=None, fields=None) -> urllib3.HTTPResponse: - return self.request("HEAD", url, - headers=headers, - stream=stream, - timeout=timeout, - fields=fields) - - def options(self, url, headers=None, - body=None, stream=False, timeout=None, fields=None) -> urllib3.HTTPResponse: - return self.request("OPTIONS", url, - headers=headers, - stream=stream, - timeout=timeout, - body=body, fields=fields) - - def delete(self, url, headers=None, body=None, - stream=False, timeout=None, fields=None) -> urllib3.HTTPResponse: - return self.request("DELETE", url, - headers=headers, - stream=stream, - timeout=timeout, - body=body, fields=fields) - - def post(self, url, headers=None, - body=None, stream=False, timeout=None, fields=None) -> urllib3.HTTPResponse: - return self.request("POST", url, - headers=headers, - stream=stream, - timeout=timeout, - body=body, fields=fields) - - def put(self, url, headers=None, - body=None, stream=False, timeout=None, fields=None) -> urllib3.HTTPResponse: - return self.request("PUT", url, - headers=headers, - stream=stream, - timeout=timeout, - body=body, fields=fields) - - def patch(self, url, headers=None, - body=None, stream=False, timeout=None, fields=None) -> urllib3.HTTPResponse: - return self.request("PATCH", url, - headers=headers, - stream=stream, - timeout=timeout, - body=body, fields=fields) diff --git a/pynitrokey/nethsm/client/schemas/__init__.py b/pynitrokey/nethsm/client/schemas/__init__.py deleted file mode 100644 index de2a9b79..00000000 --- a/pynitrokey/nethsm/client/schemas/__init__.py +++ /dev/null @@ -1,148 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -import typing - -import typing_extensions - -from .schema import ( - get_class, - none_type_, - classproperty, - Bool, - FileIO, - Schema, - SingletonMeta, - AnyTypeSchema, - UnsetAnyTypeSchema, - INPUT_TYPES_ALL -) - -from .schemas import ( - ListSchema, - NoneSchema, - NumberSchema, - IntSchema, - Int32Schema, - Int64Schema, - Float32Schema, - Float64Schema, - StrSchema, - UUIDSchema, - DateSchema, - DateTimeSchema, - DecimalSchema, - BytesSchema, - FileSchema, - BinarySchema, - BoolSchema, - NotAnyTypeSchema, - OUTPUT_BASE_TYPES, - DictSchema -) -from .validation import ( - PatternInfo, - ValidationMetadata, - immutabledict -) -from .format import ( - as_date, - as_datetime, - as_decimal, - as_uuid -) - -def typed_dict_to_instance(t_dict: typing_extensions._TypedDictMeta) -> typing.Mapping: # type: ignore - res = {} - for key, val in t_dict.__annotations__.items(): - if isinstance(val, typing._GenericAlias): # type: ignore - # typing.Type[W] -> W - val_cls = typing.get_args(val)[0] - res[key] = val_cls - return res - -X = typing.TypeVar('X', bound=typing.Tuple) - -def tuple_to_instance(tup: typing.Type[X]) -> X: - res = [] - for arg in typing.get_args(tup): - if isinstance(arg, typing._GenericAlias): # type: ignore - # typing.Type[Schema] -> Schema - arg_cls = typing.get_args(arg)[0] - res.append(arg_cls) - return tuple(res) # type: ignore - - -class Unset: - """ - An instance of this class is set as the default value for object type(dict) properties that are optional - When a property has an unset value, that property will not be assigned in the dict - """ - pass - -unset: Unset = Unset() - -def key_unknown_error_msg(key: str) -> str: - return (f"Invalid key. The key {key} is not a known key in this payload. " - "If this key is an additional property, use get_additional_property_" - ) - -def raise_if_key_known( - key: str, - required_keys: typing.FrozenSet[str], - optional_keys: typing.FrozenSet[str] -): - if key in required_keys or key in optional_keys: - raise ValueError(f"The key {key} is a known property, use get_property to access its value") - -__all__ = [ - 'get_class', - 'none_type_', - 'classproperty', - 'Bool', - 'FileIO', - 'Schema', - 'SingletonMeta', - 'AnyTypeSchema', - 'UnsetAnyTypeSchema', - 'INPUT_TYPES_ALL', - 'ListSchema', - 'NoneSchema', - 'NumberSchema', - 'IntSchema', - 'Int32Schema', - 'Int64Schema', - 'Float32Schema', - 'Float64Schema', - 'StrSchema', - 'UUIDSchema', - 'DateSchema', - 'DateTimeSchema', - 'DecimalSchema', - 'BytesSchema', - 'FileSchema', - 'BinarySchema', - 'BoolSchema', - 'NotAnyTypeSchema', - 'OUTPUT_BASE_TYPES', - 'DictSchema', - 'PatternInfo', - 'ValidationMetadata', - 'immutabledict', - 'as_date', - 'as_datetime', - 'as_decimal', - 'as_uuid', - 'typed_dict_to_instance', - 'tuple_to_instance', - 'Unset', - 'unset', - 'key_unknown_error_msg', - 'raise_if_key_known' -] \ No newline at end of file diff --git a/pynitrokey/nethsm/client/schemas/format.py b/pynitrokey/nethsm/client/schemas/format.py deleted file mode 100644 index bb614903..00000000 --- a/pynitrokey/nethsm/client/schemas/format.py +++ /dev/null @@ -1,115 +0,0 @@ -import datetime -import decimal -import functools -import typing -import uuid - -from dateutil import parser, tz - - -class CustomIsoparser(parser.isoparser): - def __init__(self, sep: typing.Optional[str] = None): - """ - :param sep: - A single character that separates date and time portions. If - ``None``, the parser will accept any single character. - For strict ISO-8601 adherence, pass ``'T'``. - """ - if sep is not None: - if (len(sep) != 1 or ord(sep) >= 128 or sep in '0123456789'): - raise ValueError('Separator must be a single, non-numeric ' + - 'ASCII character') - - used_sep = sep.encode('ascii') - else: - used_sep = None - - self._sep = used_sep - - @staticmethod - def __get_ascii_bytes(str_in: str) -> bytes: - # If it's unicode, turn it into bytes, since ISO-8601 only covers ASCII - # ASCII is the same in UTF-8 - try: - return str_in.encode('ascii') - except UnicodeEncodeError as e: - msg = 'ISO-8601 strings should contain only ASCII characters' - raise ValueError(msg) from e - - def __parse_isodate(self, dt_str: str) -> typing.Tuple[typing.Tuple[int, int, int], int]: - dt_str_ascii = self.__get_ascii_bytes(dt_str) - values = self._parse_isodate(dt_str_ascii) # type: ignore - values = typing.cast(typing.Tuple[typing.List[int], int], values) - components = typing.cast( typing.Tuple[int, int, int], tuple(values[0])) - pos = values[1] - return components, pos - - def __parse_isotime(self, dt_str: str) -> typing.Tuple[int, int, int, int, typing.Optional[typing.Union[tz.tzutc, tz.tzoffset]]]: - dt_str_ascii = self.__get_ascii_bytes(dt_str) - values = self._parse_isotime(dt_str_ascii) # type: ignore - components: typing.Tuple[int, int, int, int, typing.Optional[typing.Union[tz.tzutc, tz.tzoffset]]] = tuple(values) # type: ignore - return components - - def parse_isodatetime(self, dt_str: str) -> datetime.datetime: - date_components, pos = self.__parse_isodate(dt_str) - if len(dt_str) <= pos: - # len(components) <= 3 - raise ValueError('Value is not a datetime') - if self._sep is None or dt_str[pos:pos + 1] == self._sep: - hour, minute, second, microsecond, tzinfo = self.__parse_isotime(dt_str[pos + 1:]) - if hour == 24: - hour = 0 - components = (*date_components, hour, minute, second, microsecond, tzinfo) - return datetime.datetime(*components) + datetime.timedelta(days=1) - else: - components = (*date_components, hour, minute, second, microsecond, tzinfo) - else: - raise ValueError('String contains unknown ISO components') - - return datetime.datetime(*components) - - def parse_isodate_str(self, datestr: str) -> datetime.date: - components, pos = self.__parse_isodate(datestr) - - if len(datestr) > pos: - raise ValueError('String contains invalid time components') - - if len(components) > 3: - raise ValueError('String contains invalid time components') - - return datetime.date(*components) - -DEFAULT_ISOPARSER = CustomIsoparser() - -@functools.lru_cache() -def as_date(arg: str) -> datetime.date: - """ - type = "string" - format = "date" - """ - return DEFAULT_ISOPARSER.parse_isodate_str(arg) - -@functools.lru_cache() -def as_datetime(arg: str) -> datetime.datetime: - """ - type = "string" - format = "date-time" - """ - return DEFAULT_ISOPARSER.parse_isodatetime(arg) - -@functools.lru_cache() -def as_decimal(arg: str) -> decimal.Decimal: - """ - Applicable when storing decimals that are sent over the wire as strings - type = "string" - format = "number" - """ - return decimal.Decimal(arg) - -@functools.lru_cache() -def as_uuid(arg: str) -> uuid.UUID: - """ - type = "string" - format = "uuid" - """ - return uuid.UUID(arg) \ No newline at end of file diff --git a/pynitrokey/nethsm/client/schemas/original_immutabledict.py b/pynitrokey/nethsm/client/schemas/original_immutabledict.py deleted file mode 100644 index 3897e140..00000000 --- a/pynitrokey/nethsm/client/schemas/original_immutabledict.py +++ /dev/null @@ -1,97 +0,0 @@ -""" -MIT License - -Copyright (c) 2020 Corentin Garcia - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -""" -from __future__ import annotations -import typing -import typing_extensions - -_K = typing.TypeVar("_K") -_V = typing.TypeVar("_V", covariant=True) - - -class immutabledict(typing.Mapping[_K, _V]): - """ - An immutable wrapper around dictionaries that implements - the complete :py:class:`collections.Mapping` interface. - It can be used as a drop-in replacement for dictionaries - where immutability is desired. - - Note: custom version of this class made to remove __init__ - """ - - dict_cls: typing.Type[typing.Dict[typing.Any, typing.Any]] = dict - _dict: typing.Dict[_K, _V] - _hash: typing.Optional[int] - - @classmethod - def fromkeys( - cls, seq: typing.Iterable[_K], value: typing.Optional[_V] = None - ) -> "immutabledict[_K, _V]": - return cls(dict.fromkeys(seq, value)) - - def __new__(cls, *args: typing.Any) -> typing_extensions.Self: - inst = super().__new__(cls) - setattr(inst, '_dict', cls.dict_cls(*args)) - setattr(inst, '_hash', None) - return inst - - def __getitem__(self, key: _K) -> _V: - return self._dict[key] - - def __contains__(self, key: object) -> bool: - return key in self._dict - - def __iter__(self) -> typing.Iterator[_K]: - return iter(self._dict) - - def __len__(self) -> int: - return len(self._dict) - - def __repr__(self) -> str: - return "%s(%r)" % (self.__class__.__name__, self._dict) - - def __hash__(self) -> int: - if self._hash is None: - h = 0 - for key, value in self.items(): - h ^= hash((key, value)) - self._hash = h - - return self._hash - - def __or__(self, other: typing.Any) -> immutabledict[_K, _V]: - if not isinstance(other, (dict, self.__class__)): - return NotImplemented - new = dict(self) - new.update(other) - return self.__class__(new) - - def __ror__(self, other: typing.Any) -> typing.Dict[typing.Any, typing.Any]: - if not isinstance(other, (dict, self.__class__)): - return NotImplemented - new = dict(other) - new.update(self) - return new - - def __ior__(self, other: typing.Any) -> immutabledict[_K, _V]: - raise TypeError(f"'{self.__class__.__name__}' object is not mutable") diff --git a/pynitrokey/nethsm/client/schemas/schema.py b/pynitrokey/nethsm/client/schemas/schema.py deleted file mode 100644 index acce7d2e..00000000 --- a/pynitrokey/nethsm/client/schemas/schema.py +++ /dev/null @@ -1,729 +0,0 @@ -from __future__ import annotations -import datetime -import dataclasses -import io -import types -import typing -import uuid - -import functools -import typing_extensions - -from pynitrokey.nethsm.client import exceptions -from pynitrokey.nethsm.client.configurations import schema_configuration - -from . import validation - -_T_co = typing.TypeVar("_T_co", covariant=True) - - -class SequenceNotStr(typing.Protocol[_T_co]): - """ - if a Protocol would define the interface of Sequence, this protocol - would NOT allow str/bytes as their __contains__ methods are incompatible with the definition in Sequence - methods from: https://docs.python.org/3/library/collections.abc.html#collections.abc.Collection - """ - def __contains__(self, value: object, /) -> bool: - raise NotImplementedError - - def __getitem__(self, index, /): - raise NotImplementedError - - def __len__(self) -> int: - raise NotImplementedError - - def __iter__(self) -> typing.Iterator[_T_co]: - raise NotImplementedError - - def __reversed__(self, /) -> typing.Iterator[_T_co]: - raise NotImplementedError - -none_type_ = type(None) -T = typing.TypeVar('T', bound=typing.Mapping) -U = typing.TypeVar('U', bound=SequenceNotStr) -W = typing.TypeVar('W') - - -class SchemaTyped: - additional_properties: typing.Type[Schema] - all_of: typing.Tuple[typing.Type[Schema], ...] - any_of: typing.Tuple[typing.Type[Schema], ...] - discriminator: typing.Mapping[str, typing.Mapping[str, typing.Type[Schema]]] - default: typing.Union[str, int, float, bool, None] - enum_value_to_name: typing.Mapping[typing.Union[int, float, str, Bool, None], str] - exclusive_maximum: typing.Union[int, float] - exclusive_minimum: typing.Union[int, float] - format: str - inclusive_maximum: typing.Union[int, float] - inclusive_minimum: typing.Union[int, float] - items: typing.Type[Schema] - max_items: int - max_length: int - max_properties: int - min_items: int - min_length: int - min_properties: int - multiple_of: typing.Union[int, float] - not_: typing.Type[Schema] - one_of: typing.Tuple[typing.Type[Schema], ...] - pattern: validation.PatternInfo - properties: typing.Mapping[str, typing.Type[Schema]] - required: typing.FrozenSet[str] - types: typing.FrozenSet[typing.Type] - unique_items: bool - - -class FileIO(io.FileIO): - """ - A class for storing files - Note: this class is not immutable - """ - - def __new__(cls, arg: typing.Union[io.FileIO, io.BufferedReader]): - if isinstance(arg, (io.FileIO, io.BufferedReader)): - if arg.closed: - raise exceptions.ApiValueError('Invalid file state; file is closed and must be open') - arg.close() - inst = super(FileIO, cls).__new__(cls, arg.name) # type: ignore - super(FileIO, inst).__init__(arg.name) - return inst - raise exceptions.ApiValueError('FileIO must be passed arg which contains the open file') - - def __init__(self, arg: typing.Union[io.FileIO, io.BufferedReader]): - """ - Needed for instantiation when passing in arguments of the above type - """ - pass - - -class classproperty(typing.Generic[W]): - def __init__(self, method: typing.Callable[..., W]): - self.__method = method - functools.update_wrapper(self, method) # type: ignore - - def __get__(self, obj, cls=None) -> W: - if cls is None: - cls = type(obj) - return self.__method(cls) - - -class Bool: - _instances: typing.Dict[typing.Tuple[type, bool], Bool] = {} - """ - This class is needed to replace bool during validation processing - json schema requires that 0 != False and 1 != True - python implementation defines 0 == False and 1 == True - To meet the json schema requirements, all bool instances are replaced with Bool singletons - during validation only, and then bool values are returned from validation - """ - - def __new__(cls, arg_: bool, **kwargs): - """ - Method that implements singleton - cls base classes: BoolClass, NoneClass, str, decimal.Decimal - The 3rd key is used in the tuple below for a corner case where an enum contains integer 1 - However 1.0 can also be ingested into that enum schema because 1.0 == 1 and - Decimal('1.0') == Decimal('1') - But if we omitted the 3rd value in the key, then Decimal('1.0') would be stored as Decimal('1') - and json serializing that instance would be '1' rather than the expected '1.0' - Adding the 3rd value, the str of arg_ ensures that 1.0 -> Decimal('1.0') which is serialized as 1.0 - """ - key = (cls, arg_) - if key not in cls._instances: - inst = super().__new__(cls) - cls._instances[key] = inst - return cls._instances[key] - - def __repr__(self): - if bool(self): - return f'' - return f'' - - @classproperty - def TRUE(cls): - return cls(True) # type: ignore - - @classproperty - def FALSE(cls): - return cls(False) # type: ignore - - @functools.lru_cache() - def __bool__(self) -> bool: - for key, instance in self._instances.items(): - if self is instance: - return bool(key[1]) - raise ValueError('Unable to find the boolean value of this instance') - - -def cast_to_allowed_types( - arg: typing.Union[ - dict, - validation.immutabledict, - list, - tuple, - float, - int, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - bool, - None, - bytes, - io.FileIO, - io.BufferedReader, - ], - from_server: bool, - validated_path_to_schemas: typing.Dict[typing.Tuple[typing.Union[str, int], ...], typing.Set[typing.Union[str, int, float, bool, None, validation.immutabledict, tuple]]], - path_to_item: typing.Tuple[typing.Union[str, int], ...], - path_to_type: typing.Dict[typing.Tuple[typing.Union[str, int], ...], type] -) -> typing.Union[ - validation.immutabledict, - tuple, - float, - int, - str, - bytes, - Bool, - None, - FileIO -]: - """ - Casts the input payload arg into the allowed types - The input validated_path_to_schemas is mutated by running this function - - When from_server is False then - - date/datetime is cast to str - - int/float is cast to Decimal - - If a Schema instance is passed in it is converted back to a primitive instance because - One may need to validate that data to the original Schema class AND additional different classes - those additional classes will need to be added to the new manufactured class for that payload - If the code didn't do this and kept the payload as a Schema instance it would fail to validate to other - Schema classes and the code wouldn't be able to mfg a new class that includes all valid schemas - TODO: store the validated schema classes in validation_metadata - - Args: - arg: the payload - from_server: whether this payload came from the server or not - validated_path_to_schemas: a dict that stores the validated classes at any path location in the payload - """ - type_error = exceptions.ApiTypeError(f"Invalid type. Required value type is str and passed type was {type(arg)} at {path_to_item}") - if isinstance(arg, str): - path_to_type[path_to_item] = str - return str(arg) - elif isinstance(arg, (dict, validation.immutabledict)): - path_to_type[path_to_item] = validation.immutabledict - return validation.immutabledict( - { - key: cast_to_allowed_types( - val, - from_server, - validated_path_to_schemas, - path_to_item + (key,), - path_to_type, - ) - for key, val in arg.items() - } - ) - elif isinstance(arg, bool): - """ - this check must come before isinstance(arg, (int, float)) - because isinstance(True, int) is True - """ - path_to_type[path_to_item] = Bool - if arg: - return Bool.TRUE - return Bool.FALSE - elif isinstance(arg, int): - path_to_type[path_to_item] = int - return arg - elif isinstance(arg, float): - path_to_type[path_to_item] = float - return arg - elif isinstance(arg, (tuple, list)): - path_to_type[path_to_item] = tuple - return tuple( - [ - cast_to_allowed_types( - item, - from_server, - validated_path_to_schemas, - path_to_item + (i,), - path_to_type, - ) - for i, item in enumerate(arg) - ] - ) - elif arg is None: - path_to_type[path_to_item] = type(None) - return None - elif isinstance(arg, (datetime.date, datetime.datetime)): - path_to_type[path_to_item] = str - if not from_server: - return arg.isoformat() - raise type_error - elif isinstance(arg, uuid.UUID): - path_to_type[path_to_item] = str - if not from_server: - return str(arg) - raise type_error - elif isinstance(arg, bytes): - path_to_type[path_to_item] = bytes - return bytes(arg) - elif isinstance(arg, (io.FileIO, io.BufferedReader)): - path_to_type[path_to_item] = FileIO - return FileIO(arg) - raise exceptions.ApiTypeError('Invalid type passed in got input={} type={}'.format(arg, type(arg))) - - -class SingletonMeta(type): - """ - A singleton class for schemas - Schemas are frozen classes that are never instantiated with init args - All args come from defaults - """ - _instances: typing.Dict[type, typing.Any] = {} - - def __call__(cls, *args, **kwargs): - if cls not in cls._instances: - cls._instances[cls] = super().__call__(*args, **kwargs) - return cls._instances[cls] - - -class Schema(typing.Generic[T, U], validation.SchemaValidator, metaclass=SingletonMeta): - - @classmethod - def __get_path_to_schemas( - cls, - arg, - validation_metadata: validation.ValidationMetadata, - path_to_type: typing.Dict[typing.Tuple[typing.Union[str, int], ...], typing.Type] - ) -> typing.Dict[typing.Tuple[typing.Union[str, int], ...], typing.Type[Schema]]: - """ - Run all validations in the json schema and return a dict of - json schema to tuple of validated schemas - """ - _path_to_schemas: validation.PathToSchemasType = {} - if validation_metadata.validation_ran_earlier(cls): - validation.add_deeper_validated_schemas(validation_metadata, _path_to_schemas) - else: - other_path_to_schemas = cls._validate(arg, validation_metadata=validation_metadata) - validation.update(_path_to_schemas, other_path_to_schemas) - # loop through it make a new class for each entry - # do not modify the returned result because it is cached and we would be modifying the cached value - path_to_schemas: typing.Dict[typing.Tuple[typing.Union[str, int], ...], typing.Type[Schema]] = {} - for path, schema_classes in _path_to_schemas.items(): - schema = typing.cast(typing.Type[Schema], tuple(schema_classes)[-1]) - path_to_schemas[path] = schema - """ - For locations that validation did not check - the code still needs to store type + schema information for instantiation - All of those schemas will be UnsetAnyTypeSchema - """ - missing_paths = path_to_type.keys() - path_to_schemas.keys() - for missing_path in missing_paths: - path_to_schemas[missing_path] = UnsetAnyTypeSchema - - return path_to_schemas - - @staticmethod - def __get_items( - arg: tuple, - path_to_item: typing.Tuple[typing.Union[str, int], ...], - path_to_schemas: typing.Dict[typing.Tuple[typing.Union[str, int], ...], typing.Type[Schema]] - ): - ''' - Schema __get_items - ''' - cast_items = [] - - for i, value in enumerate(arg): - item_path_to_item = path_to_item + (i,) - item_cls = path_to_schemas[item_path_to_item] - new_value = item_cls._get_new_instance_without_conversion( - value, - item_path_to_item, - path_to_schemas - ) - cast_items.append(new_value) - - return tuple(cast_items) - - @staticmethod - def __get_properties( - arg: validation.immutabledict[str, typing.Any], - path_to_item: typing.Tuple[typing.Union[str, int], ...], - path_to_schemas: typing.Dict[typing.Tuple[typing.Union[str, int], ...], typing.Type[Schema]] - ): - """ - Schema __get_properties, this is how properties are set - These values already passed validation - """ - dict_items = {} - - for property_name_js, value in arg.items(): - property_path_to_item = path_to_item + (property_name_js,) - property_cls = path_to_schemas[property_path_to_item] - new_value = property_cls._get_new_instance_without_conversion( - value, - property_path_to_item, - path_to_schemas - ) - dict_items[property_name_js] = new_value - - return validation.immutabledict(dict_items) - - @classmethod - def _get_new_instance_without_conversion( - cls, - arg: typing.Union[int, float, None, Bool, str, validation.immutabledict, tuple, FileIO, bytes], - path_to_item: typing.Tuple[typing.Union[str, int], ...], - path_to_schemas: typing.Dict[typing.Tuple[typing.Union[str, int], ...], typing.Type[Schema]] - ): - # We have a Dynamic class and we are making an instance of it - if isinstance(arg, validation.immutabledict): - used_arg = cls.__get_properties(arg, path_to_item, path_to_schemas) - elif isinstance(arg, tuple): - used_arg = cls.__get_items(arg, path_to_item, path_to_schemas) - elif isinstance(arg, Bool): - return bool(arg) - else: - """ - str, int, float, FileIO, bytes - FileIO = openapi binary type and the user inputs a file - bytes = openapi binary type and the user inputs bytes - """ - return arg - arg_type = type(arg) - type_to_output_cls = cls.__get_type_to_output_cls() - if type_to_output_cls is None: - return used_arg - if arg_type not in type_to_output_cls: - return used_arg - output_cls = type_to_output_cls[arg_type] - if arg_type is tuple: - inst = super(output_cls, output_cls).__new__(output_cls, used_arg) # type: ignore - inst = typing.cast(U, inst) - return inst - assert issubclass(output_cls, validation.immutabledict) - inst = super(output_cls, output_cls).__new__(output_cls, used_arg) # type: ignore - inst = typing.cast(T, inst) - return inst - - @typing.overload - @classmethod - def validate_base( - cls, - arg: None, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> None: ... - - @typing.overload - @classmethod - def validate_base( - cls, - arg: typing.Literal[True], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal[True]: ... - - @typing.overload - @classmethod - def validate_base( - cls, - arg: typing.Literal[False], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal[False]: ... - - @typing.overload - @classmethod - def validate_base( - cls, - arg: bool, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> bool: ... - - @typing.overload - @classmethod - def validate_base( - cls, - arg: int, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> int: ... - - @typing.overload - @classmethod - def validate_base( - cls, - arg: float, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> float: ... - - @typing.overload - @classmethod - def validate_base( - cls, - arg: typing.Union[str, datetime.date, datetime.datetime, uuid.UUID], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> str: ... - - @typing.overload - @classmethod - def validate_base( - cls, - arg: SequenceNotStr[INPUT_TYPES_ALL], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> U: ... - - @typing.overload - @classmethod - def validate_base( - cls, - arg: U, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> U: ... - - @typing.overload - @classmethod - def validate_base( - cls, - arg: typing.Mapping[str, object], # object needed as value type for typeddict inputs - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> T: ... - - @typing.overload - @classmethod - def validate_base( - cls, - arg: typing.Union[ - typing.Mapping[str, INPUT_TYPES_ALL], - T - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> T: ... - - @typing.overload - @classmethod - def validate_base( - cls, - arg: typing.Union[io.FileIO, io.BufferedReader], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> FileIO: ... - - @typing.overload - @classmethod - def validate_base( - cls, - arg: bytes, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> bytes: ... - - @classmethod - def validate_base( - cls, - arg, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None, - ): - """ - Schema validate_base - - Args: - arg (int/float/str/list/tuple/dict/validation.immutabledict/bool/None): the value - configuration: contains the schema_configuration.SchemaConfiguration that enables json schema validation keywords - like minItems, minLength etc - """ - if isinstance(arg, (tuple, validation.immutabledict)): - type_to_output_cls = cls.__get_type_to_output_cls() - if type_to_output_cls is not None: - for output_cls in type_to_output_cls.values(): - if isinstance(arg, output_cls): - # U + T use case, don't run validations twice - return arg - - from_server = False - validated_path_to_schemas: typing.Dict[ - typing.Tuple[typing.Union[str, int], ...], - typing.Set[typing.Union[str, int, float, bool, None, validation.immutabledict, tuple]] - ] = {} - path_to_type: typing.Dict[typing.Tuple[typing.Union[str, int], ...], type] = {} - cast_arg = cast_to_allowed_types( - arg, from_server, validated_path_to_schemas, ('args[0]',), path_to_type) - validation_metadata = validation.ValidationMetadata( - path_to_item=('args[0]',), - configuration=configuration or schema_configuration.SchemaConfiguration(), - validated_path_to_schemas=validation.immutabledict(validated_path_to_schemas) - ) - path_to_schemas = cls.__get_path_to_schemas(cast_arg, validation_metadata, path_to_type) - return cls._get_new_instance_without_conversion( - cast_arg, - validation_metadata.path_to_item, - path_to_schemas, - ) - - @classmethod - def __get_type_to_output_cls(cls) -> typing.Optional[typing.Mapping[type, type]]: - type_to_output_cls = getattr(cls(), 'type_to_output_cls', None) - type_to_output_cls = typing.cast(typing.Optional[typing.Mapping[type, type]], type_to_output_cls) - return type_to_output_cls - - -def get_class( - item_cls: typing.Union[types.FunctionType, staticmethod, typing.Type[Schema]], - local_namespace: typing.Optional[dict] = None -) -> typing.Type[Schema]: - if isinstance(item_cls, typing._GenericAlias): # type: ignore - # petstore_api.schemas.StrSchema[~U] -> petstore_api.schemas.StrSchema - origin_cls = typing.get_origin(item_cls) - if origin_cls is None: - raise ValueError('origin class must not be None') - return origin_cls - elif isinstance(item_cls, types.FunctionType): - # referenced schema - return item_cls() - elif isinstance(item_cls, staticmethod): - # referenced schema - return item_cls.__func__() - elif isinstance(item_cls, type): - return item_cls - elif isinstance(item_cls, typing.ForwardRef): - return item_cls._evaluate(None, local_namespace) - raise ValueError('invalid class value passed in') - - -@dataclasses.dataclass(frozen=True) -class AnyTypeSchema(Schema[T, U]): - # Python representation of a schema defined as true or {} - - @typing.overload - @classmethod - def validate( - cls, - arg: None, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> None: ... - - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal[True], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal[True]: ... - - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal[False], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal[False]: ... - - @typing.overload - @classmethod - def validate( - cls, - arg: bool, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> bool: ... - - @typing.overload - @classmethod - def validate( - cls, - arg: int, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> int: ... - - @typing.overload - @classmethod - def validate( - cls, - arg: float, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> float: ... - - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Union[str, datetime.date, datetime.datetime, uuid.UUID], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> str: ... - - @typing.overload - @classmethod - def validate( - cls, - arg: SequenceNotStr[INPUT_TYPES_ALL], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> U: ... - - @typing.overload - @classmethod - def validate( - cls, - arg: U, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> U: ... - - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Union[ - typing.Mapping[str, INPUT_TYPES_ALL], - T - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> T: ... - - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Union[io.FileIO, io.BufferedReader], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> FileIO: ... - - @typing.overload - @classmethod - def validate( - cls, - arg: bytes, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> bytes: ... - - @classmethod - def validate( - cls, - arg, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None, - ): - return cls.validate_base( - arg, - configuration=configuration - ) - -class UnsetAnyTypeSchema(AnyTypeSchema[T, U]): - # Used when additionalProperties/items was not explicitly defined and a defining schema is needed - pass - -INPUT_TYPES_ALL = typing.Union[ - dict, - validation.immutabledict, - typing.Mapping[str, object], # for TypedDict - list, - tuple, - float, - int, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - bool, - None, - bytes, - io.FileIO, - io.BufferedReader, - FileIO -] \ No newline at end of file diff --git a/pynitrokey/nethsm/client/schemas/schemas.py b/pynitrokey/nethsm/client/schemas/schemas.py deleted file mode 100644 index c07050e9..00000000 --- a/pynitrokey/nethsm/client/schemas/schemas.py +++ /dev/null @@ -1,375 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -import datetime -import dataclasses -import io -import typing -import uuid - -import typing_extensions - -from pynitrokey.nethsm.client.configurations import schema_configuration - -from . import schema, validation - - -@dataclasses.dataclass(frozen=True) -class ListSchema(schema.Schema[validation.immutabledict, tuple]): - types: typing.FrozenSet[typing.Type] = frozenset({tuple}) - - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Union[ - typing.List[schema.INPUT_TYPES_ALL], - schema.U - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> schema.U: ... - - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Union[ - typing.Tuple[schema.INPUT_TYPES_ALL, ...], - schema.U - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> schema.U: ... - - @classmethod - def validate( - cls, - arg, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ): - return super().validate_base(arg, configuration=configuration) - - -@dataclasses.dataclass(frozen=True) -class NoneSchema(schema.Schema): - types: typing.FrozenSet[typing.Type] = frozenset({type(None)}) - - @classmethod - def validate( - cls, - arg: None, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> None: - return super().validate_base(arg, configuration=configuration) - - -@dataclasses.dataclass(frozen=True) -class NumberSchema(schema.Schema): - """ - This is used for type: number with no format - Both integers AND floats are accepted - """ - types: typing.FrozenSet[typing.Type] = frozenset({float, int}) - - @typing.overload - @classmethod - def validate( - cls, - arg: int, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> int: ... - - @typing.overload - @classmethod - def validate( - cls, - arg: float, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> float: ... - - @classmethod - def validate( - cls, - arg, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ): - return super().validate_base(arg, configuration=configuration) - - -@dataclasses.dataclass(frozen=True) -class IntSchema(NumberSchema): - types: typing.FrozenSet[typing.Type] = frozenset({int, float}) - format: str = 'int' - - -@dataclasses.dataclass(frozen=True) -class Int32Schema(IntSchema): - types: typing.FrozenSet[typing.Type] = frozenset({int, float}) - format: str = 'int32' - - -@dataclasses.dataclass(frozen=True) -class Int64Schema(IntSchema): - types: typing.FrozenSet[typing.Type] = frozenset({int, float}) - format: str = 'int64' - - -@dataclasses.dataclass(frozen=True) -class Float32Schema(NumberSchema): - types: typing.FrozenSet[typing.Type] = frozenset({float}) - format: str = 'float' - - -@dataclasses.dataclass(frozen=True) -class Float64Schema(NumberSchema): - types: typing.FrozenSet[typing.Type] = frozenset({float}) - format: str = 'double' - - -@dataclasses.dataclass(frozen=True) -class StrSchema(schema.Schema): - """ - date + datetime string types must inherit from this class - That is because one can validate a str payload as both: - - type: string (format unset) - - type: string, format: date - """ - types: typing.FrozenSet[typing.Type] = frozenset({str}) - - @classmethod - def validate( - cls, - arg: str, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> str: - return super().validate_base(arg, configuration=configuration) - - -@dataclasses.dataclass(frozen=True) -class UUIDSchema(schema.Schema): - types: typing.FrozenSet[typing.Type] = frozenset({str}) - format: str = 'uuid' - - @classmethod - def validate( - cls, - arg: typing.Union[str, uuid.UUID], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> str: - return super().validate_base(arg, configuration=configuration) - - -@dataclasses.dataclass(frozen=True) -class DateSchema(schema.Schema): - types: typing.FrozenSet[typing.Type] = frozenset({str}) - format: str = 'date' - - @classmethod - def validate( - cls, - arg: typing.Union[str, datetime.date], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> str: - return super().validate_base(arg, configuration=configuration) - - -@dataclasses.dataclass(frozen=True) -class DateTimeSchema(schema.Schema): - types: typing.FrozenSet[typing.Type] = frozenset({str}) - format: str = 'date-time' - - @classmethod - def validate( - cls, - arg: typing.Union[str, datetime.datetime], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> str: - return super().validate_base(arg, configuration=configuration) - - -@dataclasses.dataclass(frozen=True) -class DecimalSchema(schema.Schema): - types: typing.FrozenSet[typing.Type] = frozenset({str}) - format: str = 'number' - - @classmethod - def validate( - cls, - arg: str, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> str: - """ - Note: Decimals may not be passed in because cast_to_allowed_types is only invoked once for payloads - which can be simple (str) or complex (dicts or lists with nested values) - Because casting is only done once and recursively casts all values prior to validation then for a potential - client side Decimal input if Decimal was accepted as an input in DecimalSchema then one would not know - if one was using it for a StrSchema (where it should be cast to str) or one is using it for NumberSchema - where it should stay as Decimal. - """ - return super().validate_base(arg, configuration=configuration) - - -@dataclasses.dataclass(frozen=True) -class BytesSchema(schema.Schema): - """ - this class will subclass bytes and is immutable - """ - types: typing.FrozenSet[typing.Type] = frozenset({bytes}) - - @classmethod - def validate( - cls, - arg: bytes, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> bytes: - return cls.validate_base(arg) - - -@dataclasses.dataclass(frozen=True) -class FileSchema(schema.Schema): - """ - This class is NOT immutable - Dynamic classes are built using it for example when AnyType allows in binary data - Al other schema classes ARE immutable - If one wanted to make this immutable one could make this a DictSchema with required properties: - - data = BytesSchema (which would be an immutable bytes based schema) - - file_name = StrSchema - and cast_to_allowed_types would convert bytes and file instances into dicts containing data + file_name - The downside would be that data would be stored in memory which one may not want to do for very large files - - The developer is responsible for closing this file and deleting it - - This class was kept as mutable: - - to allow file reading and writing to disk - - to be able to preserve file name info - """ - types: typing.FrozenSet[typing.Type] = frozenset({schema.FileIO}) - - @classmethod - def validate( - cls, - arg: typing.Union[io.FileIO, io.BufferedReader], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> schema.FileIO: - return cls.validate_base(arg) - - -@dataclasses.dataclass(frozen=True) -class BinarySchema(schema.Schema): - types: typing.FrozenSet[typing.Type] = frozenset({schema.FileIO, bytes}) - format: str = 'binary' - - one_of: typing.Tuple[typing.Type[schema.Schema], ...] = ( - BytesSchema, - FileSchema, - ) - - @classmethod - def validate( - cls, - arg: typing.Union[io.FileIO, io.BufferedReader, bytes], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Union[schema.FileIO, bytes]: - return cls.validate_base(arg) - - -@dataclasses.dataclass(frozen=True) -class BoolSchema(schema.Schema): - types: typing.FrozenSet[typing.Type] = frozenset({schema.Bool}) - - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal[True], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal[True]: ... - - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Literal[False], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> typing.Literal[False]: ... - - @typing.overload - @classmethod - def validate( - cls, - arg: bool, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> bool: ... - - @classmethod - def validate( - cls, - arg, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ): - return super().validate_base(arg, configuration=configuration) - - -@dataclasses.dataclass(frozen=True) -class NotAnyTypeSchema(schema.AnyTypeSchema): - """ - Python representation of a schema defined as false or {'not': {}} - Does not allow inputs in of AnyType - Note: validations on this class are never run because the code knows that no inputs will ever validate - """ - not_: typing.Type[schema.Schema] = schema.AnyTypeSchema - - @classmethod - def validate( - cls, - arg, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None, - ): - return super().validate_base(arg, configuration=configuration) - -OUTPUT_BASE_TYPES = typing.Union[ - validation.immutabledict[str, 'OUTPUT_BASE_TYPES'], - str, - int, - float, - bool, - schema.none_type_, - typing.Tuple['OUTPUT_BASE_TYPES', ...], - bytes, - schema.FileIO -] - - -@dataclasses.dataclass(frozen=True) -class DictSchema(schema.Schema[schema.validation.immutabledict[str, OUTPUT_BASE_TYPES], tuple]): - types: typing.FrozenSet[typing.Type] = frozenset({validation.immutabledict}) - - @typing.overload - @classmethod - def validate( - cls, - arg: schema.validation.immutabledict[str, OUTPUT_BASE_TYPES], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> schema.validation.immutabledict[str, OUTPUT_BASE_TYPES]: ... - - @typing.overload - @classmethod - def validate( - cls, - arg: typing.Mapping[str, schema.INPUT_TYPES_ALL], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> schema.validation.immutabledict[str, OUTPUT_BASE_TYPES]: ... - - @classmethod - def validate( - cls, - arg, - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None, - ) -> schema.validation.immutabledict[str, OUTPUT_BASE_TYPES]: - return super().validate_base(arg, configuration=configuration) diff --git a/pynitrokey/nethsm/client/schemas/validation.py b/pynitrokey/nethsm/client/schemas/validation.py deleted file mode 100644 index e85ac119..00000000 --- a/pynitrokey/nethsm/client/schemas/validation.py +++ /dev/null @@ -1,1285 +0,0 @@ -# coding: utf-8 - -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -import collections -import dataclasses -import decimal -import re -import sys -import types -import typing -import uuid - -import typing_extensions - -from pynitrokey.nethsm.client import exceptions -from pynitrokey.nethsm.client.configurations import schema_configuration - -from . import format, original_immutabledict - -immutabledict = original_immutabledict.immutabledict - - -@dataclasses.dataclass -class ValidationMetadata: - """ - A class storing metadata that is needed to validate OpenApi Schema payloads - """ - path_to_item: typing.Tuple[typing.Union[str, int], ...] - configuration: schema_configuration.SchemaConfiguration - validated_path_to_schemas: typing.Mapping[ - typing.Tuple[typing.Union[str, int], ...], - typing.Mapping[type, None] - ] = dataclasses.field(default_factory=dict) - seen_classes: typing.FrozenSet[type] = frozenset() - - def validation_ran_earlier(self, cls: type) -> bool: - validated_schemas: typing.Union[typing.Mapping[type, None], None] = self.validated_path_to_schemas.get(self.path_to_item) - if validated_schemas and cls in validated_schemas: - return True - if cls in self.seen_classes: - return True - return False - -def _raise_validation_error_message(value, constraint_msg, constraint_value, path_to_item, additional_txt=""): - raise exceptions.ApiValueError( - "Invalid value `{value}`, {constraint_msg} `{constraint_value}`{additional_txt} at {path_to_item}".format( - value=value, - constraint_msg=constraint_msg, - constraint_value=constraint_value, - additional_txt=additional_txt, - path_to_item=path_to_item, - ) - ) - - -class SchemaValidator: - __excluded_cls_properties = { - '__module__', - '__dict__', - '__weakref__', - '__doc__', - '__annotations__', - 'default', # excluded because it has no impact on validation - 'type_to_output_cls', # used to pluck the output class for instantiation - } - - @classmethod - def _validate( - cls, - arg, - validation_metadata: ValidationMetadata, - ) -> PathToSchemasType: - """ - SchemaValidator validate - All keyword validation except for type checking was done in calling stack frames - If those validations passed, the validated classes are collected in path_to_schemas - """ - cls_schema = cls() - json_schema_data = { - k: v - for k, v in vars(cls_schema).items() - if k not in cls.__excluded_cls_properties - and k - not in validation_metadata.configuration.disabled_json_schema_python_keywords - } - contains_qty = 0 - path_to_schemas: PathToSchemasType = {} - if 'contains' in vars(cls_schema): - contains_qty = _get_contains_qty( - arg, - vars(cls_schema)['contains'], - validation_metadata, - path_to_schemas - ) - prefix_items_length = 0 - if 'prefix_items' in vars(cls_schema): - prefix_items_length = len(vars(cls_schema)['prefix_items']) - for keyword, val in json_schema_data.items(): - used_val: typing.Any - if keyword in {'contains', 'min_contains', 'max_contains'}: - used_val = (val, contains_qty) - elif keyword == 'items': - used_val = (val, prefix_items_length) - elif keyword in {'unevaluated_items', 'unevaluated_properties'}: - used_val = (val, path_to_schemas) - else: - used_val = val - validator = json_schema_keyword_to_validator[keyword] - - other_path_to_schemas = validator( - arg, - used_val, - cls, - validation_metadata, - ) - if other_path_to_schemas: - update(path_to_schemas, other_path_to_schemas) - - base_class = type(arg) - if validation_metadata.path_to_item not in path_to_schemas: - path_to_schemas[validation_metadata.path_to_item] = dict() - path_to_schemas[validation_metadata.path_to_item][base_class] = None - path_to_schemas[validation_metadata.path_to_item][cls] = None - return path_to_schemas - -PathToSchemasType = typing.Dict[ - typing.Tuple[typing.Union[str, int], ...], - typing.Dict[ - typing.Union[ - typing.Type[SchemaValidator], - typing.Type[str], - typing.Type[int], - typing.Type[float], - typing.Type[bool], - typing.Type[None], - typing.Type[immutabledict], - typing.Type[tuple] - ], - None - ] -] - -def _get_class( - item_cls: typing.Union[types.FunctionType, staticmethod, typing.Type[SchemaValidator]], - local_namespace: typing.Optional[dict] = None -) -> typing.Type[SchemaValidator]: - if isinstance(item_cls, typing._GenericAlias): # type: ignore - # petstore_api.schemas.StrSchema[~U] -> petstore_api.schemas.StrSchema - origin_cls = typing.get_origin(item_cls) - if origin_cls is None: - raise ValueError('origin class must not be None') - return origin_cls - elif isinstance(item_cls, types.FunctionType): - # referenced schema - return item_cls() - elif isinstance(item_cls, staticmethod): - # referenced schema - return item_cls.__func__() - elif isinstance(item_cls, type): - return item_cls - elif isinstance(item_cls, typing.ForwardRef): - if sys.version_info < (3, 9): - return item_cls._evaluate(None, local_namespace) - return item_cls._evaluate(None, local_namespace, set()) - raise ValueError('invalid class value passed in') - - -def update(d: dict, u: dict): - """ - Adds u to d - Where each dict is collections.defaultdict(dict) - """ - if not u: - return d - for k, v in u.items(): - if k not in d: - d[k] = v - else: - d[k].update(v) - - -def add_deeper_validated_schemas(validation_metadata: ValidationMetadata, path_to_schemas: dict): - # this is called if validation_ran_earlier and current and deeper locations need to be added - current_path_to_item = validation_metadata.path_to_item - other_path_to_schemas = {} - for path_to_item, schemas in validation_metadata.validated_path_to_schemas.items(): - if len(path_to_item) < len(current_path_to_item): - continue - path_begins_with_current_path = path_to_item[:len(current_path_to_item)] == current_path_to_item - if path_begins_with_current_path: - other_path_to_schemas[path_to_item] = schemas - update(path_to_schemas, other_path_to_schemas) - - -def __get_valid_classes_phrase(input_classes): - """Returns a string phrase describing what types are allowed""" - all_classes = list(input_classes) - all_classes = sorted(all_classes, key=lambda cls: cls.__name__) - all_class_names = [cls.__name__ for cls in all_classes] - if len(all_class_names) == 1: - return "is {0}".format(all_class_names[0]) - return "is one of [{0}]".format(", ".join(all_class_names)) - - -def __type_error_message( - var_value=None, var_name=None, valid_classes=None, key_type=None -): - """ - Keyword Args: - var_value (any): the variable which has the type_error - var_name (str): the name of the variable which has the typ error - valid_classes (tuple): the accepted classes for current_item's - value - key_type (bool): False if our value is a value in a dict - True if it is a key in a dict - False if our item is an item in a tuple - """ - key_or_value = "value" - if key_type: - key_or_value = "key" - valid_classes_phrase = __get_valid_classes_phrase(valid_classes) - msg = "Invalid type. Required {0} type {1} and " "passed type was {2}".format( - key_or_value, - valid_classes_phrase, - type(var_value).__name__, - ) - return msg - - -def __get_type_error(var_value, path_to_item, valid_classes, key_type=False): - error_msg = __type_error_message( - var_name=path_to_item[-1], - var_value=var_value, - valid_classes=valid_classes, - key_type=key_type, - ) - return exceptions.ApiTypeError( - error_msg, - path_to_item=path_to_item, - valid_classes=valid_classes, - key_type=key_type, - ) - - -@dataclasses.dataclass(frozen=True) -class PatternInfo: - pattern: str - flags: typing.Optional[re.RegexFlag] = None - - -def validate_types( - arg: typing.Any, - allowed_types: typing.Set[typing.Type], - cls: typing.Type, - validation_metadata: ValidationMetadata, -) -> None: - if type(arg) not in allowed_types: - print("arg: ", arg) - raise __get_type_error( - arg, - validation_metadata.path_to_item, - allowed_types, - key_type=False, - ) - return None - -def validate_enum( - arg: typing.Any, - enum_value_to_name: typing.Dict[typing.Any, str], - cls: typing.Type, - validation_metadata: ValidationMetadata, -) -> None: - if arg not in enum_value_to_name: - raise exceptions.ApiValueError("Invalid value {} passed in to {}, allowed_values={}".format(arg, cls, enum_value_to_name.keys())) - return None - - -def validate_unique_items( - arg: typing.Any, - unique_items_value: bool, - cls: typing.Type, - validation_metadata: ValidationMetadata, -) -> None: - if not unique_items_value or not isinstance(arg, tuple): - return None - if len(arg) == len(set(arg)): - return None - _raise_validation_error_message( - value=arg, - constraint_msg="duplicate items were found, and the tuple must not contain duplicates because", - constraint_value='unique_items==True', - path_to_item=validation_metadata.path_to_item - ) - - -def validate_min_items( - arg: typing.Any, - min_items: int, - cls: typing.Type, - validation_metadata: ValidationMetadata, -) -> None: - if not isinstance(arg, tuple): - return None - if len(arg) < min_items: - _raise_validation_error_message( - value=arg, - constraint_msg="number of items must be greater than or equal to", - constraint_value=min_items, - path_to_item=validation_metadata.path_to_item - ) - return None - - -def validate_max_items( - arg: typing.Any, - max_items: int, - cls: typing.Type, - validation_metadata: ValidationMetadata, -) -> None: - if not isinstance(arg, tuple): - return None - if len(arg) > max_items: - _raise_validation_error_message( - value=arg, - constraint_msg="number of items must be less than or equal to", - constraint_value=max_items, - path_to_item=validation_metadata.path_to_item - ) - return None - - -def validate_min_properties( - arg: typing.Any, - min_properties: int, - cls: typing.Type, - validation_metadata: ValidationMetadata, -) -> None: - if not isinstance(arg, immutabledict): - return None - if len(arg) < min_properties: - _raise_validation_error_message( - value=arg, - constraint_msg="number of properties must be greater than or equal to", - constraint_value=min_properties, - path_to_item=validation_metadata.path_to_item - ) - return None - - -def validate_max_properties( - arg: typing.Any, - max_properties: int, - cls: typing.Type, - validation_metadata: ValidationMetadata, -) -> None: - if not isinstance(arg, immutabledict): - return None - if len(arg) > max_properties: - _raise_validation_error_message( - value=arg, - constraint_msg="number of properties must be less than or equal to", - constraint_value=max_properties, - path_to_item=validation_metadata.path_to_item - ) - return None - - -def validate_min_length( - arg: typing.Any, - min_length: int, - cls: typing.Type, - validation_metadata: ValidationMetadata, -) -> None: - if not isinstance(arg, str): - return None - if len(arg) < min_length: - _raise_validation_error_message( - value=arg, - constraint_msg="length must be greater than or equal to", - constraint_value=min_length, - path_to_item=validation_metadata.path_to_item - ) - return None - - -def validate_max_length( - arg: typing.Any, - max_length: int, - cls: typing.Type, - validation_metadata: ValidationMetadata, -) -> None: - if not isinstance(arg, str): - return None - if len(arg) > max_length: - _raise_validation_error_message( - value=arg, - constraint_msg="length must be less than or equal to", - constraint_value=max_length, - path_to_item=validation_metadata.path_to_item - ) - return None - - -def validate_inclusive_minimum( - arg: typing.Any, - inclusive_minimum: typing.Union[int, float], - cls: typing.Type, - validation_metadata: ValidationMetadata, -) -> None: - if not isinstance(arg, (int, float)): - return None - if arg < inclusive_minimum: - _raise_validation_error_message( - value=arg, - constraint_msg="must be a value greater than or equal to", - constraint_value=inclusive_minimum, - path_to_item=validation_metadata.path_to_item - ) - return None - - -def validate_exclusive_minimum( - arg: typing.Any, - exclusive_minimum: typing.Union[int, float], - cls: typing.Type, - validation_metadata: ValidationMetadata, -) -> None: - if not isinstance(arg, (int, float)): - return None - if arg <= exclusive_minimum: - _raise_validation_error_message( - value=arg, - constraint_msg="must be a value greater than", - constraint_value=exclusive_minimum, - path_to_item=validation_metadata.path_to_item - ) - return None - - -def validate_inclusive_maximum( - arg: typing.Any, - inclusive_maximum: typing.Union[int, float], - cls: typing.Type, - validation_metadata: ValidationMetadata, -) -> None: - if not isinstance(arg, (int, float)): - return None - if arg > inclusive_maximum: - _raise_validation_error_message( - value=arg, - constraint_msg="must be a value less than or equal to", - constraint_value=inclusive_maximum, - path_to_item=validation_metadata.path_to_item - ) - return None - - -def validate_exclusive_maximum( - arg: typing.Any, - exclusive_maximum: typing.Union[int, float], - cls: typing.Type, - validation_metadata: ValidationMetadata, -) -> None: - if not isinstance(arg, (int, float)): - return None - if arg >= exclusive_maximum: - _raise_validation_error_message( - value=arg, - constraint_msg="must be a value less than", - constraint_value=exclusive_maximum, - path_to_item=validation_metadata.path_to_item - ) - return None - -def validate_multiple_of( - arg: typing.Any, - multiple_of: typing.Union[int, float], - cls: typing.Type, - validation_metadata: ValidationMetadata, -) -> None: - if not isinstance(arg, (int, float)): - return None - if (not (float(arg) / multiple_of).is_integer()): - # Note 'multipleOf' will be as good as the floating point arithmetic. - _raise_validation_error_message( - value=arg, - constraint_msg="value must be a multiple of", - constraint_value=multiple_of, - path_to_item=validation_metadata.path_to_item - ) - return None - - -def validate_pattern( - arg: typing.Any, - pattern_info: PatternInfo, - cls: typing.Type, - validation_metadata: ValidationMetadata, -) -> None: - if not isinstance(arg, str): - return None - flags = pattern_info.flags if pattern_info.flags is not None else 0 - if not re.search(pattern_info.pattern, arg, flags=flags): - if flags != 0: - # Don't print the regex flags if the flags are not - # specified in the OAS document. - _raise_validation_error_message( - value=arg, - constraint_msg="must match regular expression", - constraint_value=pattern_info.pattern, - path_to_item=validation_metadata.path_to_item, - additional_txt=" with flags=`{}`".format(flags) - ) - _raise_validation_error_message( - value=arg, - constraint_msg="must match regular expression", - constraint_value=pattern_info.pattern, - path_to_item=validation_metadata.path_to_item - ) - return None - - -__int32_inclusive_minimum = -2147483648 -__int32_inclusive_maximum = 2147483647 -__int64_inclusive_minimum = -9223372036854775808 -__int64_inclusive_maximum = 9223372036854775807 -__float_inclusive_minimum = -3.4028234663852886e+38 -__float_inclusive_maximum = 3.4028234663852886e+38 -__double_inclusive_minimum = -1.7976931348623157E+308 -__double_inclusive_maximum = 1.7976931348623157E+308 - -def __validate_numeric_format( - arg: typing.Union[int, float], - format_value: str, - validation_metadata: ValidationMetadata -) -> None: - if format_value[:3] == 'int': - # there is a json schema test where 1.0 validates as an integer - if arg != int(arg): - raise exceptions.ApiValueError( - "Invalid non-integer value '{}' for type {} at {}".format( - arg, format, validation_metadata.path_to_item - ) - ) - if format_value == 'int32': - if not __int32_inclusive_minimum <= arg <= __int32_inclusive_maximum: - raise exceptions.ApiValueError( - "Invalid value '{}' for type int32 at {}".format(arg, validation_metadata.path_to_item) - ) - return None - elif format_value == 'int64': - if not __int64_inclusive_minimum <= arg <= __int64_inclusive_maximum: - raise exceptions.ApiValueError( - "Invalid value '{}' for type int64 at {}".format(arg, validation_metadata.path_to_item) - ) - return None - return None - elif format_value in {'float', 'double'}: - if format_value == 'float': - if not __float_inclusive_minimum <= arg <= __float_inclusive_maximum: - raise exceptions.ApiValueError( - "Invalid value '{}' for type float at {}".format(arg, validation_metadata.path_to_item) - ) - return None - # double - if not __double_inclusive_minimum <= arg <= __double_inclusive_maximum: - raise exceptions.ApiValueError( - "Invalid value '{}' for type double at {}".format(arg, validation_metadata.path_to_item) - ) - return None - return None - - -def __validate_string_format( - arg: str, - format_value: str, - validation_metadata: ValidationMetadata -) -> None: - if format_value == 'uuid': - try: - uuid.UUID(arg) - return None - except ValueError: - raise exceptions.ApiValueError( - "Invalid value '{}' for type UUID at {}".format(arg, validation_metadata.path_to_item) - ) - elif format_value == 'number': - try: - decimal.Decimal(arg) - return None - except decimal.InvalidOperation: - raise exceptions.ApiValueError( - "Value cannot be converted to a decimal. " - "Invalid value '{}' for type decimal at {}".format(arg, validation_metadata.path_to_item) - ) - elif format_value == 'date': - try: - format.DEFAULT_ISOPARSER.parse_isodate_str(arg) - return None - except ValueError: - raise exceptions.ApiValueError( - "Value does not conform to the required ISO-8601 date format. " - "Invalid value '{}' for type date at {}".format(arg, validation_metadata.path_to_item) - ) - elif format_value == 'date-time': - try: - format.DEFAULT_ISOPARSER.parse_isodatetime(arg) - return None - except ValueError: - raise exceptions.ApiValueError( - "Value does not conform to the required ISO-8601 datetime format. " - "Invalid value '{}' for type datetime at {}".format(arg, validation_metadata.path_to_item) - ) - return None - - -def validate_format( - arg: typing.Union[str, int, float], - format_value: str, - cls: typing.Type, - validation_metadata: ValidationMetadata, -) -> None: - # formats work for strings + numbers - if isinstance(arg, (int, float)): - return __validate_numeric_format( - arg, - format_value, - validation_metadata - ) - elif isinstance(arg, str): - return __validate_string_format( - arg, - format_value, - validation_metadata - ) - return None - - -def validate_required( - arg: typing.Any, - required: typing.Set[str], - cls: typing.Type, - validation_metadata: ValidationMetadata, -) -> None: - if not isinstance(arg, immutabledict): - return None - missing_req_args = required - arg.keys() - if missing_req_args: - missing_required_arguments = list(missing_req_args) - missing_required_arguments.sort() - raise exceptions.ApiTypeError( - "{} is missing {} required argument{}: {}".format( - cls.__name__, - len(missing_required_arguments), - "s" if len(missing_required_arguments) > 1 else "", - missing_required_arguments - ) - ) - return None - - -def validate_items( - arg: typing.Any, - item_cls_prefix_items_length: typing.Tuple[typing.Type[SchemaValidator], int], - cls: typing.Type, - validation_metadata: ValidationMetadata, -) -> typing.Optional[PathToSchemasType]: - if not isinstance(arg, tuple): - return None - item_cls = _get_class(item_cls_prefix_items_length[0]) - prefix_items_length = item_cls_prefix_items_length[1] - path_to_schemas: PathToSchemasType = {} - for i in range(prefix_items_length, len(arg)): - value = arg[i] - item_validation_metadata = ValidationMetadata( - path_to_item=validation_metadata.path_to_item+(i,), - configuration=validation_metadata.configuration, - validated_path_to_schemas=validation_metadata.validated_path_to_schemas - ) - if item_validation_metadata.validation_ran_earlier(item_cls): - add_deeper_validated_schemas(item_validation_metadata, path_to_schemas) - continue - other_path_to_schemas = item_cls._validate( - value, validation_metadata=item_validation_metadata) - update(path_to_schemas, other_path_to_schemas) - return path_to_schemas - - -def validate_properties( - arg: typing.Any, - properties: typing.Mapping[str, typing.Type[SchemaValidator]], - cls: typing.Type, - validation_metadata: ValidationMetadata, -) -> typing.Optional[PathToSchemasType]: - if not isinstance(arg, immutabledict): - return None - path_to_schemas: PathToSchemasType = {} - present_properties = {k: v for k, v, in arg.items() if k in properties} - module_namespace = vars(sys.modules[cls.__module__]) - for property_name, value in present_properties.items(): - path_to_item = validation_metadata.path_to_item + (property_name,) - schema = properties[property_name] - schema = _get_class(schema, module_namespace) - arg_validation_metadata = ValidationMetadata( - path_to_item=path_to_item, - configuration=validation_metadata.configuration, - validated_path_to_schemas=validation_metadata.validated_path_to_schemas - ) - if arg_validation_metadata.validation_ran_earlier(schema): - add_deeper_validated_schemas(arg_validation_metadata, path_to_schemas) - continue - other_path_to_schemas = schema._validate(value, validation_metadata=arg_validation_metadata) - update(path_to_schemas, other_path_to_schemas) - return path_to_schemas - - -def validate_additional_properties( - arg: typing.Any, - additional_properties_cls: typing.Type[SchemaValidator], - cls: typing.Type, - validation_metadata: ValidationMetadata, -) -> typing.Optional[PathToSchemasType]: - if not isinstance(arg, immutabledict): - return None - schema = _get_class(additional_properties_cls) - path_to_schemas: PathToSchemasType = {} - cls_schema = cls() - properties = cls_schema.properties if hasattr(cls_schema, 'properties') else {} - present_additional_properties = {k: v for k, v, in arg.items() if k not in properties} - for property_name, value in present_additional_properties.items(): - path_to_item = validation_metadata.path_to_item + (property_name,) - arg_validation_metadata = ValidationMetadata( - path_to_item=path_to_item, - configuration=validation_metadata.configuration, - validated_path_to_schemas=validation_metadata.validated_path_to_schemas - ) - if arg_validation_metadata.validation_ran_earlier(schema): - add_deeper_validated_schemas(arg_validation_metadata, path_to_schemas) - continue - other_path_to_schemas = schema._validate(value, validation_metadata=arg_validation_metadata) - update(path_to_schemas, other_path_to_schemas) - return path_to_schemas - - -def validate_one_of( - arg: typing.Any, - classes: typing.Tuple[typing.Type[SchemaValidator], ...], - cls: typing.Type, - validation_metadata: ValidationMetadata, -) -> PathToSchemasType: - oneof_classes = [] - path_to_schemas: PathToSchemasType = collections.defaultdict(dict) - for schema in classes: - schema = _get_class(schema) - if schema in path_to_schemas[validation_metadata.path_to_item]: - oneof_classes.append(schema) - continue - if schema is cls: - """ - optimistically assume that cls schema will pass validation - do not invoke _validate on it because that is recursive - """ - oneof_classes.append(schema) - continue - if validation_metadata.validation_ran_earlier(schema): - oneof_classes.append(schema) - add_deeper_validated_schemas(validation_metadata, path_to_schemas) - continue - try: - path_to_schemas = schema._validate(arg, validation_metadata=validation_metadata) - except (exceptions.ApiValueError, exceptions.ApiTypeError) as ex: - # silence exceptions because the code needs to accumulate oneof_classes - continue - oneof_classes.append(schema) - if not oneof_classes: - raise exceptions.ApiValueError( - "Invalid inputs given to generate an instance of {}. None " - "of the oneOf schemas matched the input data.".format(cls) - ) - elif len(oneof_classes) > 1: - raise exceptions.ApiValueError( - "Invalid inputs given to generate an instance of {}. Multiple " - "oneOf schemas {} matched the inputs, but a max of one is allowed.".format(cls, oneof_classes) - ) - # exactly one class matches - return path_to_schemas - - -def validate_any_of( - arg: typing.Any, - classes: typing.Tuple[typing.Type[SchemaValidator], ...], - cls: typing.Type, - validation_metadata: ValidationMetadata, -) -> PathToSchemasType: - anyof_classes = [] - path_to_schemas: PathToSchemasType = collections.defaultdict(dict) - for schema in classes: - schema = _get_class(schema) - if schema is cls: - """ - optimistically assume that cls schema will pass validation - do not invoke _validate on it because that is recursive - """ - anyof_classes.append(schema) - continue - if validation_metadata.validation_ran_earlier(schema): - anyof_classes.append(schema) - add_deeper_validated_schemas(validation_metadata, path_to_schemas) - continue - - try: - other_path_to_schemas = schema._validate(arg, validation_metadata=validation_metadata) - except (exceptions.ApiValueError, exceptions.ApiTypeError) as ex: - # silence exceptions because the code needs to accumulate anyof_classes - continue - anyof_classes.append(schema) - update(path_to_schemas, other_path_to_schemas) - if not anyof_classes: - raise exceptions.ApiValueError( - "Invalid inputs given to generate an instance of {}. None " - "of the anyOf schemas matched the input data.".format(cls) - ) - return path_to_schemas - - -def validate_all_of( - arg: typing.Any, - classes: typing.Tuple[typing.Type[SchemaValidator], ...], - cls: typing.Type, - validation_metadata: ValidationMetadata, -) -> PathToSchemasType: - path_to_schemas: PathToSchemasType = collections.defaultdict(dict) - for schema in classes: - schema = _get_class(schema) - if schema is cls: - """ - optimistically assume that cls schema will pass validation - do not invoke _validate on it because that is recursive - """ - continue - if validation_metadata.validation_ran_earlier(schema): - add_deeper_validated_schemas(validation_metadata, path_to_schemas) - continue - other_path_to_schemas = schema._validate(arg, validation_metadata=validation_metadata) - update(path_to_schemas, other_path_to_schemas) - return path_to_schemas - - -def validate_not( - arg: typing.Any, - not_cls: typing.Type[SchemaValidator], - cls: typing.Type, - validation_metadata: ValidationMetadata, -) -> None: - not_schema = _get_class(not_cls) - other_path_to_schemas = None - not_exception = exceptions.ApiValueError( - "Invalid value '{}' was passed in to {}. Value is invalid because it is disallowed by {}".format( - arg, - cls.__name__, - not_schema.__name__, - ) - ) - if validation_metadata.validation_ran_earlier(not_schema): - raise not_exception - - try: - other_path_to_schemas = not_schema._validate(arg, validation_metadata=validation_metadata) - except (exceptions.ApiValueError, exceptions.ApiTypeError): - pass - if other_path_to_schemas: - raise not_exception - return None - - -def __ensure_discriminator_value_present( - disc_property_name: str, - validation_metadata: ValidationMetadata, - arg -): - if disc_property_name not in arg: - # The input data does not contain the discriminator property - raise exceptions.ApiValueError( - "Cannot deserialize input data due to missing discriminator. " - "The discriminator property '{}' is missing at path: {}".format(disc_property_name, validation_metadata.path_to_item) - ) - - -def __get_discriminated_class(cls, disc_property_name: str, disc_payload_value: str): - """ - Used in schemas with discriminators - """ - cls_schema = cls() - if not hasattr(cls_schema, 'discriminator'): - return None - disc = cls_schema.discriminator - if disc_property_name not in disc: - return None - discriminated_cls = disc[disc_property_name].get(disc_payload_value) - if discriminated_cls is not None: - return discriminated_cls - if not ( - hasattr(cls_schema, 'all_of') or - hasattr(cls_schema, 'one_of') or - hasattr(cls_schema, 'any_of') - ): - return None - # TODO stop traveling if a cycle is hit - if hasattr(cls_schema, 'all_of'): - for allof_cls in cls_schema.all_of: - discriminated_cls = __get_discriminated_class( - allof_cls, disc_property_name=disc_property_name, disc_payload_value=disc_payload_value) - if discriminated_cls is not None: - return discriminated_cls - if hasattr(cls_schema, 'one_of'): - for oneof_cls in cls_schema.one_of: - discriminated_cls = __get_discriminated_class( - oneof_cls, disc_property_name=disc_property_name, disc_payload_value=disc_payload_value) - if discriminated_cls is not None: - return discriminated_cls - if hasattr(cls_schema, 'any_of'): - for anyof_cls in cls_schema.any_of: - discriminated_cls = __get_discriminated_class( - anyof_cls, disc_property_name=disc_property_name, disc_payload_value=disc_payload_value) - if discriminated_cls is not None: - return discriminated_cls - return None - - -def validate_discriminator( - arg: typing.Any, - discriminator: typing.Mapping[str, typing.Mapping[str, typing.Type[SchemaValidator]]], - cls: typing.Type, - validation_metadata: ValidationMetadata, -) -> typing.Optional[PathToSchemasType]: - if not isinstance(arg, immutabledict): - return None - disc_prop_name = list(discriminator.keys())[0] - __ensure_discriminator_value_present(disc_prop_name, validation_metadata, arg) - discriminated_cls = __get_discriminated_class( - cls, disc_property_name=disc_prop_name, disc_payload_value=arg[disc_prop_name] - ) - if discriminated_cls is None: - raise exceptions.ApiValueError( - "Invalid discriminator value was passed in to {}.{} Only the values {} are allowed at {}".format( - cls.__name__, - disc_prop_name, - list(discriminator[disc_prop_name].keys()), - validation_metadata.path_to_item + (disc_prop_name,) - ) - ) - if discriminated_cls is cls: - """ - Optimistically assume that cls will pass validation - If the code invoked _validate on cls it would infinitely recurse - """ - return None - if validation_metadata.validation_ran_earlier(discriminated_cls): - path_to_schemas: PathToSchemasType = {} - add_deeper_validated_schemas(validation_metadata, path_to_schemas) - return path_to_schemas - updated_vm = ValidationMetadata( - path_to_item=validation_metadata.path_to_item, - configuration=validation_metadata.configuration, - seen_classes=validation_metadata.seen_classes | frozenset({cls}), - validated_path_to_schemas=validation_metadata.validated_path_to_schemas - ) - return discriminated_cls._validate(arg, validation_metadata=updated_vm) - - -def _get_contains_qty( - arg: typing.Any, - contains_cls: typing.Type[SchemaValidator], - validation_metadata: ValidationMetadata, - path_to_schemas: PathToSchemasType -) -> int: - if not isinstance(arg, tuple): - return 0 - contains_cls = _get_class(contains_cls) - these_path_to_schemas: PathToSchemasType = {} - contains_qty = 0 - for i, value in enumerate(arg): - item_validation_metadata = ValidationMetadata( - path_to_item=validation_metadata.path_to_item+(i,), - configuration=validation_metadata.configuration, - validated_path_to_schemas=validation_metadata.validated_path_to_schemas - ) - if item_validation_metadata.validation_ran_earlier(contains_cls): - add_deeper_validated_schemas(item_validation_metadata, path_to_schemas) - contains_qty += 1 - continue - try: - other_path_to_schemas = contains_cls._validate( - value, validation_metadata=item_validation_metadata) - update(these_path_to_schemas, other_path_to_schemas) - contains_qty += 1 - except exceptions.OpenApiException: - pass - if contains_qty: - update(path_to_schemas, these_path_to_schemas) - return contains_qty - - -def validate_contains( - arg: typing.Any, - contains_qty: typing.Tuple[typing.Type[SchemaValidator], int], - cls: typing.Type, - validation_metadata: ValidationMetadata, -) -> typing.Optional[PathToSchemasType]: - if not isinstance(arg, tuple): - return None - if not contains_qty[1]: - raise exceptions.ApiValueError( - "Validation failed for contains keyword in class={} at path_to_item={}. No " - "items validated to the contains schema.".format(cls, validation_metadata.path_to_item) - ) - return None - - -def validate_min_contains( - arg: typing.Any, - min_contains_and_qty: typing.Tuple[int, int], - cls: typing.Type, - validation_metadata: ValidationMetadata, -) -> typing.Optional[PathToSchemasType]: - if not isinstance(arg, tuple): - return None - min_contains = min_contains_and_qty[0] - contains_qty = min_contains_and_qty[1] - if not contains_qty or contains_qty < min_contains: - raise exceptions.ApiValueError( - "Validation failed for minContains keyword in class={} at path_to_item={}. No " - "items validated to the contains schema.".format(cls, validation_metadata.path_to_item) - ) - return None - - -def validate_max_contains( - arg: typing.Any, - max_contains_and_qty: typing.Tuple[int, int], - cls: typing.Type, - validation_metadata: ValidationMetadata, -) -> typing.Optional[PathToSchemasType]: - if not isinstance(arg, tuple): - return None - max_contains = max_contains_and_qty[0] - contains_qty = max_contains_and_qty[1] - if not contains_qty or contains_qty > max_contains: - raise exceptions.ApiValueError( - "Validation failed for maxContains keyword in class={} at path_to_item={}. Too " - "many items validated to the contains schema.".format(cls, validation_metadata.path_to_item) - ) - return None - - -def validate_const( - arg: typing.Any, - const_value_to_name: typing.Dict[typing.Any, str], - cls: typing.Type, - validation_metadata: ValidationMetadata, -) -> None: - if arg not in const_value_to_name: - raise exceptions.ApiValueError("Invalid value {} passed in to {}, allowed_values={}".format(arg, cls, const_value_to_name.keys())) - return None - - -def validate_dependent_required( - arg: typing.Any, - dependent_required: typing.Mapping[str, typing.Set[str]], - cls: typing.Type, - validation_metadata: ValidationMetadata, -) -> None: - if not isinstance(arg, immutabledict): - return None - for key, keys_that_must_exist in dependent_required.items(): - if key not in arg: - continue - missing_keys = keys_that_must_exist - arg.keys() - if missing_keys: - raise exceptions.ApiValueError( - f"Validation failed for dependentRequired because these_keys={missing_keys} are " - f"missing at path_to_item={validation_metadata.path_to_item} in class {cls}" - ) - return None - - -def validate_dependent_schemas( - arg: typing.Any, - dependent_schemas: typing.Mapping[str, typing.Type[SchemaValidator]], - cls: typing.Type, - validation_metadata: ValidationMetadata, -) -> typing.Optional[PathToSchemasType]: - if not isinstance(arg, immutabledict): - return None - path_to_schemas: PathToSchemasType = {} - module_namespace = vars(sys.modules[cls.__module__]) - for key, schema in dependent_schemas.items(): - if key not in arg: - continue - schema = _get_class(schema, module_namespace) - if validation_metadata.validation_ran_earlier(schema): - add_deeper_validated_schemas(validation_metadata, path_to_schemas) - continue - other_path_to_schemas = schema._validate(arg, validation_metadata=validation_metadata) - update(path_to_schemas, other_path_to_schemas) - return path_to_schemas - - -def validate_property_names( - arg: typing.Any, - property_names_schema: typing.Type[SchemaValidator], - cls: typing.Type, - validation_metadata: ValidationMetadata, -) -> None: - if not isinstance(arg, immutabledict): - return None - module_namespace = vars(sys.modules[cls.__module__]) - property_names_schema = _get_class(property_names_schema, module_namespace) - for key in arg.keys(): - path_to_item = validation_metadata.path_to_item + (key,) - key_validation_metadata = ValidationMetadata( - path_to_item=path_to_item, - configuration=validation_metadata.configuration, - validated_path_to_schemas=validation_metadata.validated_path_to_schemas - ) - property_names_schema._validate(key, validation_metadata=key_validation_metadata) - return None - - -def validate_pattern_properties( - arg: typing.Any, - pattern_properties: typing.Mapping[PatternInfo, typing.Type[SchemaValidator]], - cls: typing.Type, - validation_metadata: ValidationMetadata, -) -> typing.Optional[PathToSchemasType]: - if not isinstance(arg, immutabledict): - return None - path_to_schemas: PathToSchemasType = {} - module_namespace = vars(sys.modules[cls.__module__]) - for property_name, property_value in arg.items(): - path_to_item = validation_metadata.path_to_item + (property_name,) - property_validation_metadata = ValidationMetadata( - path_to_item=path_to_item, - configuration=validation_metadata.configuration, - validated_path_to_schemas=validation_metadata.validated_path_to_schemas - ) - for pattern_info, schema in pattern_properties.items(): - flags = pattern_info.flags if pattern_info.flags is not None else 0 - if not re.search(pattern_info.pattern, property_name, flags=flags): - continue - schema = _get_class(schema, module_namespace) - if validation_metadata.validation_ran_earlier(schema): - add_deeper_validated_schemas(validation_metadata, path_to_schemas) - continue - other_path_to_schemas = schema._validate(property_value, validation_metadata=property_validation_metadata) - update(path_to_schemas, other_path_to_schemas) - return path_to_schemas - - -def validate_prefix_items( - arg: typing.Any, - prefix_items: typing.Tuple[typing.Type[SchemaValidator], ...], - cls: typing.Type, - validation_metadata: ValidationMetadata, -) -> typing.Optional[PathToSchemasType]: - if not isinstance(arg, tuple): - return None - path_to_schemas: PathToSchemasType = {} - module_namespace = vars(sys.modules[cls.__module__]) - for i, val in enumerate(arg): - if i >= len(prefix_items): - break - schema = _get_class(prefix_items[i], module_namespace) - path_to_item = validation_metadata.path_to_item + (i,) - item_validation_metadata = ValidationMetadata( - path_to_item=path_to_item, - configuration=validation_metadata.configuration, - validated_path_to_schemas=validation_metadata.validated_path_to_schemas - ) - if item_validation_metadata.validation_ran_earlier(schema): - add_deeper_validated_schemas(validation_metadata, path_to_schemas) - continue - other_path_to_schemas = schema._validate(val, validation_metadata=item_validation_metadata) - update(path_to_schemas, other_path_to_schemas) - return path_to_schemas - - -def validate_unevaluated_items( - arg: typing.Any, - unevaluated_items_validated_path_to_schemas: typing.Tuple[typing.Type[SchemaValidator], PathToSchemasType], - cls: typing.Type, - validation_metadata: ValidationMetadata, -) -> typing.Optional[PathToSchemasType]: - if not isinstance(arg, tuple): - return None - path_to_schemas: PathToSchemasType = {} - module_namespace = vars(sys.modules[cls.__module__]) - schema = _get_class(unevaluated_items_validated_path_to_schemas[0], module_namespace) - validated_path_to_schemas = unevaluated_items_validated_path_to_schemas[1] - for i, val in enumerate(arg): - path_to_item = validation_metadata.path_to_item + (i,) - if path_to_item in validated_path_to_schemas: - continue - item_validation_metadata = ValidationMetadata( - path_to_item=path_to_item, - configuration=validation_metadata.configuration, - validated_path_to_schemas=validation_metadata.validated_path_to_schemas - ) - other_path_to_schemas = schema._validate(val, validation_metadata=item_validation_metadata) - update(path_to_schemas, other_path_to_schemas) - return path_to_schemas - - -def validate_unevaluated_properties( - arg: typing.Any, - unevaluated_properties_validated_path_to_schemas: typing.Tuple[typing.Type[SchemaValidator], PathToSchemasType], - cls: typing.Type, - validation_metadata: ValidationMetadata, -) -> typing.Optional[PathToSchemasType]: - if not isinstance(arg, immutabledict): - return None - path_to_schemas: PathToSchemasType = {} - module_namespace = vars(sys.modules[cls.__module__]) - schema = _get_class(unevaluated_properties_validated_path_to_schemas[0], module_namespace) - validated_path_to_schemas = unevaluated_properties_validated_path_to_schemas[1] - for property_name, val in arg.items(): - path_to_item = validation_metadata.path_to_item + (property_name,) - if path_to_item in validated_path_to_schemas: - continue - property_validation_metadata = ValidationMetadata( - path_to_item=path_to_item, - configuration=validation_metadata.configuration, - validated_path_to_schemas=validation_metadata.validated_path_to_schemas - ) - other_path_to_schemas = schema._validate(val, validation_metadata=property_validation_metadata) - update(path_to_schemas, other_path_to_schemas) - return path_to_schemas - - -validator_type = typing.Callable[[typing.Any, typing.Any, type, ValidationMetadata], typing.Optional[PathToSchemasType]] -json_schema_keyword_to_validator: typing.Mapping[str, validator_type] = { - 'types': validate_types, - 'enum_value_to_name': validate_enum, - 'unique_items': validate_unique_items, - 'min_items': validate_min_items, - 'max_items': validate_max_items, - 'min_properties': validate_min_properties, - 'max_properties': validate_max_properties, - 'min_length': validate_min_length, - 'max_length': validate_max_length, - 'inclusive_minimum': validate_inclusive_minimum, - 'exclusive_minimum': validate_exclusive_minimum, - 'inclusive_maximum': validate_inclusive_maximum, - 'exclusive_maximum': validate_exclusive_maximum, - 'multiple_of': validate_multiple_of, - 'pattern': validate_pattern, - 'format': validate_format, - 'required': validate_required, - 'items': validate_items, - 'properties': validate_properties, - 'additional_properties': validate_additional_properties, - 'one_of': validate_one_of, - 'any_of': validate_any_of, - 'all_of': validate_all_of, - 'not_': validate_not, - 'discriminator': validate_discriminator, - 'contains': validate_contains, - 'min_contains': validate_min_contains, - 'max_contains': validate_max_contains, - 'const_value_to_name': validate_const, - 'dependent_required': validate_dependent_required, - 'dependent_schemas': validate_dependent_schemas, - 'property_names': validate_property_names, - 'pattern_properties': validate_pattern_properties, - 'prefix_items': validate_prefix_items, - 'unevaluated_items': validate_unevaluated_items, - 'unevaluated_properties': validate_unevaluated_properties -} diff --git a/pynitrokey/nethsm/client/security_schemes.py b/pynitrokey/nethsm/client/security_schemes.py deleted file mode 100644 index 14965775..00000000 --- a/pynitrokey/nethsm/client/security_schemes.py +++ /dev/null @@ -1,228 +0,0 @@ -# coding: utf-8 -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -import abc -import base64 -import dataclasses -import enum -import typing -import typing_extensions - -from urllib3 import _collections - - -class SecuritySchemeType(enum.Enum): - API_KEY = 'apiKey' - HTTP = 'http' - MUTUAL_TLS = 'mutualTLS' - OAUTH_2 = 'oauth2' - OPENID_CONNECT = 'openIdConnect' - - -class ApiKeyInLocation(enum.Enum): - QUERY = 'query' - HEADER = 'header' - COOKIE = 'cookie' - - -class __SecuritySchemeBase(metaclass=abc.ABCMeta): - @abc.abstractmethod - def apply_auth( - self, - headers: _collections.HTTPHeaderDict, - resource_path: str, - method: str, - body: typing.Optional[typing.Union[str, bytes]], - query_params_suffix: typing.Optional[str], - scope_names: typing.Tuple[str, ...] = (), - ) -> None: - pass - - -@dataclasses.dataclass -class ApiKeySecurityScheme(__SecuritySchemeBase, abc.ABC): - api_key: str # this must be set by the developer - name: str = '' - in_location: ApiKeyInLocation = ApiKeyInLocation.QUERY - type: SecuritySchemeType = SecuritySchemeType.API_KEY - - def apply_auth( - self, - headers: _collections.HTTPHeaderDict, - resource_path: str, - method: str, - body: typing.Optional[typing.Union[str, bytes]], - query_params_suffix: typing.Optional[str], - scope_names: typing.Tuple[str, ...] = (), - ) -> None: - if self.in_location is ApiKeyInLocation.COOKIE: - headers.add('Cookie', self.api_key) - elif self.in_location is ApiKeyInLocation.HEADER: - headers.add(self.name, self.api_key) - elif self.in_location is ApiKeyInLocation.QUERY: - # todo add query handling - raise NotImplementedError("ApiKeySecurityScheme in query not yet implemented") - return - - -class HTTPSchemeType(enum.Enum): - BASIC = 'basic' - BEARER = 'bearer' - DIGEST = 'digest' - SIGNATURE = 'signature' # https://datatracker.ietf.org/doc/draft-cavage-http-signatures/ - - -@dataclasses.dataclass -class HTTPBasicSecurityScheme(__SecuritySchemeBase): - user_id: str # user name - password: str - scheme: HTTPSchemeType = HTTPSchemeType.BASIC - encoding: str = 'utf-8' - type: SecuritySchemeType = SecuritySchemeType.HTTP - """ - https://www.rfc-editor.org/rfc/rfc7617.html - """ - - def apply_auth( - self, - headers: _collections.HTTPHeaderDict, - resource_path: str, - method: str, - body: typing.Optional[typing.Union[str, bytes]], - query_params_suffix: typing.Optional[str], - scope_names: typing.Tuple[str, ...] = (), - ) -> None: - user_pass = f"{self.user_id}:{self.password}" - b64_user_pass = base64.b64encode(user_pass.encode(encoding=self.encoding)) - headers.add('Authorization', f"Basic {b64_user_pass.decode()}") - - -@dataclasses.dataclass -class HTTPBearerSecurityScheme(__SecuritySchemeBase): - access_token: str - bearer_format: typing.Optional[str] = None - scheme: HTTPSchemeType = HTTPSchemeType.BEARER - type: SecuritySchemeType = SecuritySchemeType.HTTP - - def apply_auth( - self, - headers: _collections.HTTPHeaderDict, - resource_path: str, - method: str, - body: typing.Optional[typing.Union[str, bytes]], - query_params_suffix: typing.Optional[str], - scope_names: typing.Tuple[str, ...] = (), - ) -> None: - headers.add('Authorization', f"Bearer {self.access_token}") - - -@dataclasses.dataclass -class HTTPDigestSecurityScheme(__SecuritySchemeBase): - scheme: HTTPSchemeType = HTTPSchemeType.DIGEST - type: SecuritySchemeType = SecuritySchemeType.HTTP - - def apply_auth( - self, - headers: _collections.HTTPHeaderDict, - resource_path: str, - method: str, - body: typing.Optional[typing.Union[str, bytes]], - query_params_suffix: typing.Optional[str], - scope_names: typing.Tuple[str, ...] = (), - ) -> None: - raise NotImplementedError("HTTPDigestSecurityScheme not yet implemented") - - -@dataclasses.dataclass -class MutualTLSSecurityScheme(__SecuritySchemeBase): - type: SecuritySchemeType = SecuritySchemeType.MUTUAL_TLS - - def apply_auth( - self, - headers: _collections.HTTPHeaderDict, - resource_path: str, - method: str, - body: typing.Optional[typing.Union[str, bytes]], - query_params_suffix: typing.Optional[str], - scope_names: typing.Tuple[str, ...] = (), - ) -> None: - raise NotImplementedError("MutualTLSSecurityScheme not yet implemented") - - -@dataclasses.dataclass -class ImplicitOAuthFlow: - authorization_url: str - scopes: typing.Dict[str, str] - refresh_url: typing.Optional[str] = None - - -@dataclasses.dataclass -class TokenUrlOauthFlow: - token_url: str - scopes: typing.Dict[str, str] - refresh_url: typing.Optional[str] = None - - -@dataclasses.dataclass -class AuthorizationCodeOauthFlow: - authorization_url: str - token_url: str - scopes: typing.Dict[str, str] - refresh_url: typing.Optional[str] = None - - -@dataclasses.dataclass -class OAuthFlows: - implicit: typing.Optional[ImplicitOAuthFlow] = None - password: typing.Optional[TokenUrlOauthFlow] = None - client_credentials: typing.Optional[TokenUrlOauthFlow] = None - authorization_code: typing.Optional[AuthorizationCodeOauthFlow] = None - - -class OAuth2SecurityScheme(__SecuritySchemeBase, abc.ABC): - flows: OAuthFlows - type: SecuritySchemeType = SecuritySchemeType.OAUTH_2 - - def apply_auth( - self, - headers: _collections.HTTPHeaderDict, - resource_path: str, - method: str, - body: typing.Optional[typing.Union[str, bytes]], - query_params_suffix: typing.Optional[str], - scope_names: typing.Tuple[str, ...] = (), - ) -> None: - raise NotImplementedError("OAuth2SecurityScheme not yet implemented") - - -class OpenIdConnectSecurityScheme(__SecuritySchemeBase, abc.ABC): - openid_connect_url: str - type: SecuritySchemeType = SecuritySchemeType.OPENID_CONNECT - - def apply_auth( - self, - headers: _collections.HTTPHeaderDict, - resource_path: str, - method: str, - body: typing.Optional[typing.Union[str, bytes]], - query_params_suffix: typing.Optional[str], - scope_names: typing.Tuple[str, ...] = (), - ) -> None: - raise NotImplementedError("OpenIdConnectSecurityScheme not yet implemented") - -""" -Key is the Security scheme class -Value is the list of scopes -""" -SecurityRequirementObject = typing.TypedDict( - 'SecurityRequirementObject', - { - 'basic': typing.Tuple[str, ...], - }, - total=False -) \ No newline at end of file diff --git a/pynitrokey/nethsm/client/server.py b/pynitrokey/nethsm/client/server.py deleted file mode 100644 index 1c65dde4..00000000 --- a/pynitrokey/nethsm/client/server.py +++ /dev/null @@ -1,34 +0,0 @@ -# coding: utf-8 -""" - NetHSM - All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. # noqa: E501 - The version of the OpenAPI document: v1 - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -import abc -import dataclasses -import typing - -from pynitrokey.nethsm.client.schemas import validation, schema - - -@dataclasses.dataclass -class ServerWithoutVariables(abc.ABC): - url: str - - -@dataclasses.dataclass -class ServerWithVariables(abc.ABC): - _url: str - variables: validation.immutabledict[str, str] - variables_schema: typing.Type[schema.Schema] - url: str = dataclasses.field(init=False) - - def __post_init__(self): - url = self._url - assert isinstance (self.variables, self.variables_schema().type_to_output_cls[validation.immutabledict]) - for (key, value) in self.variables.items(): - url = url.replace("{" + key + "}", value) - self.url = url diff --git a/pynitrokey/nethsm/client/servers/__init__.py b/pynitrokey/nethsm/client/servers/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/servers/server_0.py b/pynitrokey/nethsm/client/servers/server_0.py deleted file mode 100644 index 057a998e..00000000 --- a/pynitrokey/nethsm/client/servers/server_0.py +++ /dev/null @@ -1,139 +0,0 @@ -# coding: utf-8 -""" - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator -""" - -from __future__ import annotations -from pynitrokey.nethsm.client.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -from pynitrokey.nethsm.client.shared_imports.server_imports import * # pyright: ignore [reportWildcardImportFromLibrary] -AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema - - -@dataclasses.dataclass(frozen=True) -class Host( - schemas.StrSchema -): - types: typing.FrozenSet[typing.Type] = frozenset({ - str, - }) - default: typing.Literal["nethsmdemo.nitrokey.com"] = "nethsmdemo.nitrokey.com" - - -@dataclasses.dataclass(frozen=True) -class Version( - schemas.StrSchema -): - types: typing.FrozenSet[typing.Type] = frozenset({ - str, - }) - default: typing.Literal["v1"] = "v1" -Properties = typing.TypedDict( - 'Properties', - { - "host": typing.Type[Host], - "version": typing.Type[Version], - } -) - - -class VariablesDict(schemas.immutabledict[str, str]): - - __required_keys__: typing.FrozenSet[str] = frozenset({ - "host", - "version", - }) - __optional_keys__: typing.FrozenSet[str] = frozenset({ - }) - - def __new__( - cls, - *, - host: str, - version: str, - configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, - ): - arg_: typing.Dict[str, typing.Any] = { - "host": host, - "version": version, - } - used_arg_ = typing.cast(VariablesDictInput, arg_) - return Variables.validate(used_arg_, configuration=configuration_) - - @staticmethod - def from_dict_( - arg: typing.Union[ - VariablesDictInput, - VariablesDict - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> VariablesDict: - return Variables.validate(arg, configuration=configuration) - - @property - def host(self) -> str: - return typing.cast( - str, - self.__getitem__("host") - ) - - @property - def version(self) -> str: - return typing.cast( - str, - self.__getitem__("version") - ) -VariablesDictInput = typing.TypedDict( - 'VariablesDictInput', - { - "host": str, - "version": str, - } -) - - -@dataclasses.dataclass(frozen=True) -class Variables( - schemas.Schema[VariablesDict, tuple] -): - types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict}) - required: typing.FrozenSet[str] = frozenset({ - "host", - "version", - }) - properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore - additional_properties: typing.Type[AdditionalProperties] = dataclasses.field(default_factory=lambda: AdditionalProperties) # type: ignore - type_to_output_cls: typing.Mapping[ - typing.Type, - typing.Type - ] = dataclasses.field( - default_factory=lambda: { - schemas.immutabledict: VariablesDict - } - ) - - @classmethod - def validate( - cls, - arg: typing.Union[ - VariablesDictInput, - VariablesDict, - ], - configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None - ) -> VariablesDict: - return super().validate_base( - arg, - configuration=configuration, - ) - - - -@dataclasses.dataclass -class Server0(server.ServerWithVariables): - variables: VariablesDict = dataclasses.field( - default_factory=lambda: Variables.validate({ - "host": Host.default, - "version": Version.default, - }) - ) - variables_schema: typing.Type[Variables] = Variables - _url: str = "https://{host}/api/{version}" diff --git a/pynitrokey/nethsm/client/shared_imports/__init__.py b/pynitrokey/nethsm/client/shared_imports/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pynitrokey/nethsm/client/shared_imports/header_imports.py b/pynitrokey/nethsm/client/shared_imports/header_imports.py deleted file mode 100644 index c338a9b4..00000000 --- a/pynitrokey/nethsm/client/shared_imports/header_imports.py +++ /dev/null @@ -1,15 +0,0 @@ -import decimal -import io -import typing -import typing_extensions - -from pynitrokey.nethsm.client import api_client, schemas - -__all__ = [ - 'decimal', - 'io', - 'typing', - 'typing_extensions', - 'api_client', - 'schemas' -] \ No newline at end of file diff --git a/pynitrokey/nethsm/client/shared_imports/operation_imports.py b/pynitrokey/nethsm/client/shared_imports/operation_imports.py deleted file mode 100644 index 0043e1e9..00000000 --- a/pynitrokey/nethsm/client/shared_imports/operation_imports.py +++ /dev/null @@ -1,18 +0,0 @@ -import datetime -import decimal -import io -import typing -import typing_extensions -import uuid - -from pynitrokey.nethsm.client import schemas, api_response - -__all__ = [ - 'decimal', - 'io', - 'typing', - 'typing_extensions', - 'uuid', - 'schemas', - 'api_response' -] \ No newline at end of file diff --git a/pynitrokey/nethsm/client/shared_imports/response_imports.py b/pynitrokey/nethsm/client/shared_imports/response_imports.py deleted file mode 100644 index 648e9781..00000000 --- a/pynitrokey/nethsm/client/shared_imports/response_imports.py +++ /dev/null @@ -1,25 +0,0 @@ -import dataclasses -import datetime -import decimal -import io -import typing -import uuid - -import typing_extensions -import urllib3 - -from pynitrokey.nethsm.client import api_client, schemas, api_response - -__all__ = [ - 'dataclasses', - 'datetime', - 'decimal', - 'io', - 'typing', - 'uuid', - 'typing_extensions', - 'urllib3', - 'api_client', - 'schemas', - 'api_response' -] \ No newline at end of file diff --git a/pynitrokey/nethsm/client/shared_imports/schema_imports.py b/pynitrokey/nethsm/client/shared_imports/schema_imports.py deleted file mode 100644 index 07f06390..00000000 --- a/pynitrokey/nethsm/client/shared_imports/schema_imports.py +++ /dev/null @@ -1,28 +0,0 @@ -import dataclasses -import datetime -import decimal -import io -import numbers -import re -import typing -import typing_extensions -import uuid - -from pynitrokey.nethsm.client import schemas -from pynitrokey.nethsm.client.configurations import schema_configuration - -U = typing.TypeVar('U') - -__all__ = [ - 'dataclasses', - 'datetime', - 'decimal', - 'io', - 'numbers', - 're', - 'typing', - 'typing_extensions', - 'uuid', - 'schemas', - 'schema_configuration' -] \ No newline at end of file diff --git a/pynitrokey/nethsm/client/shared_imports/security_scheme_imports.py b/pynitrokey/nethsm/client/shared_imports/security_scheme_imports.py deleted file mode 100644 index 9a7cfc62..00000000 --- a/pynitrokey/nethsm/client/shared_imports/security_scheme_imports.py +++ /dev/null @@ -1,12 +0,0 @@ -import dataclasses -import typing -import typing_extensions - -from pynitrokey.nethsm.client import security_schemes - -__all__ = [ - 'dataclasses', - 'typing', - 'typing_extensions', - 'security_schemes' -] \ No newline at end of file diff --git a/pynitrokey/nethsm/client/shared_imports/server_imports.py b/pynitrokey/nethsm/client/shared_imports/server_imports.py deleted file mode 100644 index e69927a9..00000000 --- a/pynitrokey/nethsm/client/shared_imports/server_imports.py +++ /dev/null @@ -1,13 +0,0 @@ -import dataclasses -import typing -import typing_extensions - -from pynitrokey.nethsm.client import server, schemas - -__all__ = [ - 'dataclasses', - 'typing', - 'typing_extensions', - 'server', - 'schemas' -] \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 285958fe..6b61d288 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,13 +34,13 @@ dependencies = [ "requests", "spsdk >=1.11.0,<1.12.0", "tqdm", - "urllib3 >=2.0,<2.1", "tlv8", "typing_extensions ~= 4.3.0", "pyserial", "protobuf >=3.17.3, < 4.0.0", "click-aliases", "semver", + "nethsm >= 0.3.1", ] dynamic = ["version", "description"] @@ -70,12 +70,10 @@ nitropy = "pynitrokey.cli:main" [tool.black] target-version = ["py39"] -extend-exclude = 'pynitrokey/nethsm/client' [tool.isort] py_version = "39" profile = "black" -extend_skip = ["pynitrokey/nethsm/client"] [tool.mypy] mypy_path = "stubs" @@ -108,10 +106,6 @@ strict_equality = true warn_unused_ignores = true warn_return_any = true -# pynitrokey.nethsm.client is auto-generated -[[tool.mypy.overrides]] -module = "pynitrokey.nethsm.client.*" -ignore_errors = true # pynitrokey.nk3.bootloader.nrf52_upload is only temporary in this package [[tool.mypy.overrides]] @@ -135,7 +129,6 @@ module = [ "nkdfu.*", "ruamel.*", "serial.*", - "urllib3.*", "usb.*", "usb1.*", "tlv8.*", @@ -157,7 +150,6 @@ markers = [ line-length = 120 exclude = [ "venv", - "nethsm", "start", "nk3", ]